{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Lightsail.AttachInstancesToLoadBalancer
(
AttachInstancesToLoadBalancer (..),
newAttachInstancesToLoadBalancer,
attachInstancesToLoadBalancer_loadBalancerName,
attachInstancesToLoadBalancer_instanceNames,
AttachInstancesToLoadBalancerResponse (..),
newAttachInstancesToLoadBalancerResponse,
attachInstancesToLoadBalancerResponse_operations,
attachInstancesToLoadBalancerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AttachInstancesToLoadBalancer = AttachInstancesToLoadBalancer'
{
AttachInstancesToLoadBalancer -> Text
loadBalancerName :: Prelude.Text,
AttachInstancesToLoadBalancer -> [Text]
instanceNames :: [Prelude.Text]
}
deriving (AttachInstancesToLoadBalancer
-> AttachInstancesToLoadBalancer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachInstancesToLoadBalancer
-> AttachInstancesToLoadBalancer -> Bool
$c/= :: AttachInstancesToLoadBalancer
-> AttachInstancesToLoadBalancer -> Bool
== :: AttachInstancesToLoadBalancer
-> AttachInstancesToLoadBalancer -> Bool
$c== :: AttachInstancesToLoadBalancer
-> AttachInstancesToLoadBalancer -> Bool
Prelude.Eq, ReadPrec [AttachInstancesToLoadBalancer]
ReadPrec AttachInstancesToLoadBalancer
Int -> ReadS AttachInstancesToLoadBalancer
ReadS [AttachInstancesToLoadBalancer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachInstancesToLoadBalancer]
$creadListPrec :: ReadPrec [AttachInstancesToLoadBalancer]
readPrec :: ReadPrec AttachInstancesToLoadBalancer
$creadPrec :: ReadPrec AttachInstancesToLoadBalancer
readList :: ReadS [AttachInstancesToLoadBalancer]
$creadList :: ReadS [AttachInstancesToLoadBalancer]
readsPrec :: Int -> ReadS AttachInstancesToLoadBalancer
$creadsPrec :: Int -> ReadS AttachInstancesToLoadBalancer
Prelude.Read, Int -> AttachInstancesToLoadBalancer -> ShowS
[AttachInstancesToLoadBalancer] -> ShowS
AttachInstancesToLoadBalancer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachInstancesToLoadBalancer] -> ShowS
$cshowList :: [AttachInstancesToLoadBalancer] -> ShowS
show :: AttachInstancesToLoadBalancer -> String
$cshow :: AttachInstancesToLoadBalancer -> String
showsPrec :: Int -> AttachInstancesToLoadBalancer -> ShowS
$cshowsPrec :: Int -> AttachInstancesToLoadBalancer -> ShowS
Prelude.Show, forall x.
Rep AttachInstancesToLoadBalancer x
-> AttachInstancesToLoadBalancer
forall x.
AttachInstancesToLoadBalancer
-> Rep AttachInstancesToLoadBalancer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AttachInstancesToLoadBalancer x
-> AttachInstancesToLoadBalancer
$cfrom :: forall x.
AttachInstancesToLoadBalancer
-> Rep AttachInstancesToLoadBalancer x
Prelude.Generic)
newAttachInstancesToLoadBalancer ::
Prelude.Text ->
AttachInstancesToLoadBalancer
newAttachInstancesToLoadBalancer :: Text -> AttachInstancesToLoadBalancer
newAttachInstancesToLoadBalancer Text
pLoadBalancerName_ =
AttachInstancesToLoadBalancer'
{ $sel:loadBalancerName:AttachInstancesToLoadBalancer' :: Text
loadBalancerName =
Text
pLoadBalancerName_,
$sel:instanceNames:AttachInstancesToLoadBalancer' :: [Text]
instanceNames = forall a. Monoid a => a
Prelude.mempty
}
attachInstancesToLoadBalancer_loadBalancerName :: Lens.Lens' AttachInstancesToLoadBalancer Prelude.Text
attachInstancesToLoadBalancer_loadBalancerName :: Lens' AttachInstancesToLoadBalancer Text
attachInstancesToLoadBalancer_loadBalancerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachInstancesToLoadBalancer' {Text
loadBalancerName :: Text
$sel:loadBalancerName:AttachInstancesToLoadBalancer' :: AttachInstancesToLoadBalancer -> Text
loadBalancerName} -> Text
loadBalancerName) (\s :: AttachInstancesToLoadBalancer
s@AttachInstancesToLoadBalancer' {} Text
a -> AttachInstancesToLoadBalancer
s {$sel:loadBalancerName:AttachInstancesToLoadBalancer' :: Text
loadBalancerName = Text
a} :: AttachInstancesToLoadBalancer)
attachInstancesToLoadBalancer_instanceNames :: Lens.Lens' AttachInstancesToLoadBalancer [Prelude.Text]
attachInstancesToLoadBalancer_instanceNames :: Lens' AttachInstancesToLoadBalancer [Text]
attachInstancesToLoadBalancer_instanceNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachInstancesToLoadBalancer' {[Text]
instanceNames :: [Text]
$sel:instanceNames:AttachInstancesToLoadBalancer' :: AttachInstancesToLoadBalancer -> [Text]
instanceNames} -> [Text]
instanceNames) (\s :: AttachInstancesToLoadBalancer
s@AttachInstancesToLoadBalancer' {} [Text]
a -> AttachInstancesToLoadBalancer
s {$sel:instanceNames:AttachInstancesToLoadBalancer' :: [Text]
instanceNames = [Text]
a} :: AttachInstancesToLoadBalancer) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance
Core.AWSRequest
AttachInstancesToLoadBalancer
where
type
AWSResponse AttachInstancesToLoadBalancer =
AttachInstancesToLoadBalancerResponse
request :: (Service -> Service)
-> AttachInstancesToLoadBalancer
-> Request AttachInstancesToLoadBalancer
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AttachInstancesToLoadBalancer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AttachInstancesToLoadBalancer)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Operation] -> Int -> AttachInstancesToLoadBalancerResponse
AttachInstancesToLoadBalancerResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance
Prelude.Hashable
AttachInstancesToLoadBalancer
where
hashWithSalt :: Int -> AttachInstancesToLoadBalancer -> Int
hashWithSalt Int
_salt AttachInstancesToLoadBalancer' {[Text]
Text
instanceNames :: [Text]
loadBalancerName :: Text
$sel:instanceNames:AttachInstancesToLoadBalancer' :: AttachInstancesToLoadBalancer -> [Text]
$sel:loadBalancerName:AttachInstancesToLoadBalancer' :: AttachInstancesToLoadBalancer -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
loadBalancerName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
instanceNames
instance Prelude.NFData AttachInstancesToLoadBalancer where
rnf :: AttachInstancesToLoadBalancer -> ()
rnf AttachInstancesToLoadBalancer' {[Text]
Text
instanceNames :: [Text]
loadBalancerName :: Text
$sel:instanceNames:AttachInstancesToLoadBalancer' :: AttachInstancesToLoadBalancer -> [Text]
$sel:loadBalancerName:AttachInstancesToLoadBalancer' :: AttachInstancesToLoadBalancer -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
loadBalancerName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
instanceNames
instance Data.ToHeaders AttachInstancesToLoadBalancer where
toHeaders :: AttachInstancesToLoadBalancer -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Lightsail_20161128.AttachInstancesToLoadBalancer" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON AttachInstancesToLoadBalancer where
toJSON :: AttachInstancesToLoadBalancer -> Value
toJSON AttachInstancesToLoadBalancer' {[Text]
Text
instanceNames :: [Text]
loadBalancerName :: Text
$sel:instanceNames:AttachInstancesToLoadBalancer' :: AttachInstancesToLoadBalancer -> [Text]
$sel:loadBalancerName:AttachInstancesToLoadBalancer' :: AttachInstancesToLoadBalancer -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"loadBalancerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
loadBalancerName),
forall a. a -> Maybe a
Prelude.Just
(Key
"instanceNames" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
instanceNames)
]
)
instance Data.ToPath AttachInstancesToLoadBalancer where
toPath :: AttachInstancesToLoadBalancer -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AttachInstancesToLoadBalancer where
toQuery :: AttachInstancesToLoadBalancer -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AttachInstancesToLoadBalancerResponse = AttachInstancesToLoadBalancerResponse'
{
AttachInstancesToLoadBalancerResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
AttachInstancesToLoadBalancerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AttachInstancesToLoadBalancerResponse
-> AttachInstancesToLoadBalancerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachInstancesToLoadBalancerResponse
-> AttachInstancesToLoadBalancerResponse -> Bool
$c/= :: AttachInstancesToLoadBalancerResponse
-> AttachInstancesToLoadBalancerResponse -> Bool
== :: AttachInstancesToLoadBalancerResponse
-> AttachInstancesToLoadBalancerResponse -> Bool
$c== :: AttachInstancesToLoadBalancerResponse
-> AttachInstancesToLoadBalancerResponse -> Bool
Prelude.Eq, ReadPrec [AttachInstancesToLoadBalancerResponse]
ReadPrec AttachInstancesToLoadBalancerResponse
Int -> ReadS AttachInstancesToLoadBalancerResponse
ReadS [AttachInstancesToLoadBalancerResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachInstancesToLoadBalancerResponse]
$creadListPrec :: ReadPrec [AttachInstancesToLoadBalancerResponse]
readPrec :: ReadPrec AttachInstancesToLoadBalancerResponse
$creadPrec :: ReadPrec AttachInstancesToLoadBalancerResponse
readList :: ReadS [AttachInstancesToLoadBalancerResponse]
$creadList :: ReadS [AttachInstancesToLoadBalancerResponse]
readsPrec :: Int -> ReadS AttachInstancesToLoadBalancerResponse
$creadsPrec :: Int -> ReadS AttachInstancesToLoadBalancerResponse
Prelude.Read, Int -> AttachInstancesToLoadBalancerResponse -> ShowS
[AttachInstancesToLoadBalancerResponse] -> ShowS
AttachInstancesToLoadBalancerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachInstancesToLoadBalancerResponse] -> ShowS
$cshowList :: [AttachInstancesToLoadBalancerResponse] -> ShowS
show :: AttachInstancesToLoadBalancerResponse -> String
$cshow :: AttachInstancesToLoadBalancerResponse -> String
showsPrec :: Int -> AttachInstancesToLoadBalancerResponse -> ShowS
$cshowsPrec :: Int -> AttachInstancesToLoadBalancerResponse -> ShowS
Prelude.Show, forall x.
Rep AttachInstancesToLoadBalancerResponse x
-> AttachInstancesToLoadBalancerResponse
forall x.
AttachInstancesToLoadBalancerResponse
-> Rep AttachInstancesToLoadBalancerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AttachInstancesToLoadBalancerResponse x
-> AttachInstancesToLoadBalancerResponse
$cfrom :: forall x.
AttachInstancesToLoadBalancerResponse
-> Rep AttachInstancesToLoadBalancerResponse x
Prelude.Generic)
newAttachInstancesToLoadBalancerResponse ::
Prelude.Int ->
AttachInstancesToLoadBalancerResponse
newAttachInstancesToLoadBalancerResponse :: Int -> AttachInstancesToLoadBalancerResponse
newAttachInstancesToLoadBalancerResponse Int
pHttpStatus_ =
AttachInstancesToLoadBalancerResponse'
{ $sel:operations:AttachInstancesToLoadBalancerResponse' :: Maybe [Operation]
operations =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AttachInstancesToLoadBalancerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
attachInstancesToLoadBalancerResponse_operations :: Lens.Lens' AttachInstancesToLoadBalancerResponse (Prelude.Maybe [Operation])
attachInstancesToLoadBalancerResponse_operations :: Lens' AttachInstancesToLoadBalancerResponse (Maybe [Operation])
attachInstancesToLoadBalancerResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachInstancesToLoadBalancerResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:AttachInstancesToLoadBalancerResponse' :: AttachInstancesToLoadBalancerResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: AttachInstancesToLoadBalancerResponse
s@AttachInstancesToLoadBalancerResponse' {} Maybe [Operation]
a -> AttachInstancesToLoadBalancerResponse
s {$sel:operations:AttachInstancesToLoadBalancerResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: AttachInstancesToLoadBalancerResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
attachInstancesToLoadBalancerResponse_httpStatus :: Lens.Lens' AttachInstancesToLoadBalancerResponse Prelude.Int
attachInstancesToLoadBalancerResponse_httpStatus :: Lens' AttachInstancesToLoadBalancerResponse Int
attachInstancesToLoadBalancerResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachInstancesToLoadBalancerResponse' {Int
httpStatus :: Int
$sel:httpStatus:AttachInstancesToLoadBalancerResponse' :: AttachInstancesToLoadBalancerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AttachInstancesToLoadBalancerResponse
s@AttachInstancesToLoadBalancerResponse' {} Int
a -> AttachInstancesToLoadBalancerResponse
s {$sel:httpStatus:AttachInstancesToLoadBalancerResponse' :: Int
httpStatus = Int
a} :: AttachInstancesToLoadBalancerResponse)
instance
Prelude.NFData
AttachInstancesToLoadBalancerResponse
where
rnf :: AttachInstancesToLoadBalancerResponse -> ()
rnf AttachInstancesToLoadBalancerResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:AttachInstancesToLoadBalancerResponse' :: AttachInstancesToLoadBalancerResponse -> Int
$sel:operations:AttachInstancesToLoadBalancerResponse' :: AttachInstancesToLoadBalancerResponse -> Maybe [Operation]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Operation]
operations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus