{-# 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.Lens as Lens
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
(AttachInstancesToLoadBalancer
-> AttachInstancesToLoadBalancer -> Bool)
-> (AttachInstancesToLoadBalancer
-> AttachInstancesToLoadBalancer -> Bool)
-> Eq AttachInstancesToLoadBalancer
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]
(Int -> ReadS AttachInstancesToLoadBalancer)
-> ReadS [AttachInstancesToLoadBalancer]
-> ReadPrec AttachInstancesToLoadBalancer
-> ReadPrec [AttachInstancesToLoadBalancer]
-> Read 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
(Int -> AttachInstancesToLoadBalancer -> ShowS)
-> (AttachInstancesToLoadBalancer -> String)
-> ([AttachInstancesToLoadBalancer] -> ShowS)
-> Show AttachInstancesToLoadBalancer
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.
AttachInstancesToLoadBalancer
-> Rep AttachInstancesToLoadBalancer x)
-> (forall x.
Rep AttachInstancesToLoadBalancer x
-> AttachInstancesToLoadBalancer)
-> Generic AttachInstancesToLoadBalancer
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' :: Text -> [Text] -> AttachInstancesToLoadBalancer
AttachInstancesToLoadBalancer'
{ $sel:loadBalancerName:AttachInstancesToLoadBalancer' :: Text
loadBalancerName =
Text
pLoadBalancerName_,
$sel:instanceNames:AttachInstancesToLoadBalancer' :: [Text]
instanceNames = [Text]
forall a. Monoid a => a
Prelude.mempty
}
attachInstancesToLoadBalancer_loadBalancerName :: Lens.Lens' AttachInstancesToLoadBalancer Prelude.Text
attachInstancesToLoadBalancer_loadBalancerName :: (Text -> f Text)
-> AttachInstancesToLoadBalancer -> f AttachInstancesToLoadBalancer
attachInstancesToLoadBalancer_loadBalancerName = (AttachInstancesToLoadBalancer -> Text)
-> (AttachInstancesToLoadBalancer
-> Text -> AttachInstancesToLoadBalancer)
-> Lens
AttachInstancesToLoadBalancer
AttachInstancesToLoadBalancer
Text
Text
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 :: ([Text] -> f [Text])
-> AttachInstancesToLoadBalancer -> f AttachInstancesToLoadBalancer
attachInstancesToLoadBalancer_instanceNames = (AttachInstancesToLoadBalancer -> [Text])
-> (AttachInstancesToLoadBalancer
-> [Text] -> AttachInstancesToLoadBalancer)
-> Lens
AttachInstancesToLoadBalancer
AttachInstancesToLoadBalancer
[Text]
[Text]
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) (([Text] -> f [Text])
-> AttachInstancesToLoadBalancer
-> f AttachInstancesToLoadBalancer)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> AttachInstancesToLoadBalancer
-> f AttachInstancesToLoadBalancer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
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 :: AttachInstancesToLoadBalancer
-> Request AttachInstancesToLoadBalancer
request = Service
-> AttachInstancesToLoadBalancer
-> Request AttachInstancesToLoadBalancer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AttachInstancesToLoadBalancer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AttachInstancesToLoadBalancer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AttachInstancesToLoadBalancer))
-> Logger
-> Service
-> Proxy AttachInstancesToLoadBalancer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AttachInstancesToLoadBalancer)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Operation] -> Int -> AttachInstancesToLoadBalancerResponse
AttachInstancesToLoadBalancerResponse'
(Maybe [Operation] -> Int -> AttachInstancesToLoadBalancerResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> AttachInstancesToLoadBalancerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> AttachInstancesToLoadBalancerResponse)
-> Either String Int
-> Either String AttachInstancesToLoadBalancerResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance
Prelude.Hashable
AttachInstancesToLoadBalancer
instance Prelude.NFData AttachInstancesToLoadBalancer
instance Core.ToHeaders AttachInstancesToLoadBalancer where
toHeaders :: AttachInstancesToLoadBalancer -> ResponseHeaders
toHeaders =
ResponseHeaders -> AttachInstancesToLoadBalancer -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Lightsail_20161128.AttachInstancesToLoadBalancer" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"loadBalancerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
loadBalancerName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"instanceNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
instanceNames)
]
)
instance Core.ToPath AttachInstancesToLoadBalancer where
toPath :: AttachInstancesToLoadBalancer -> ByteString
toPath = ByteString -> AttachInstancesToLoadBalancer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AttachInstancesToLoadBalancer where
toQuery :: AttachInstancesToLoadBalancer -> QueryString
toQuery = QueryString -> AttachInstancesToLoadBalancer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(AttachInstancesToLoadBalancerResponse
-> AttachInstancesToLoadBalancerResponse -> Bool)
-> (AttachInstancesToLoadBalancerResponse
-> AttachInstancesToLoadBalancerResponse -> Bool)
-> Eq AttachInstancesToLoadBalancerResponse
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]
(Int -> ReadS AttachInstancesToLoadBalancerResponse)
-> ReadS [AttachInstancesToLoadBalancerResponse]
-> ReadPrec AttachInstancesToLoadBalancerResponse
-> ReadPrec [AttachInstancesToLoadBalancerResponse]
-> Read 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
(Int -> AttachInstancesToLoadBalancerResponse -> ShowS)
-> (AttachInstancesToLoadBalancerResponse -> String)
-> ([AttachInstancesToLoadBalancerResponse] -> ShowS)
-> Show AttachInstancesToLoadBalancerResponse
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.
AttachInstancesToLoadBalancerResponse
-> Rep AttachInstancesToLoadBalancerResponse x)
-> (forall x.
Rep AttachInstancesToLoadBalancerResponse x
-> AttachInstancesToLoadBalancerResponse)
-> Generic AttachInstancesToLoadBalancerResponse
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' :: Maybe [Operation] -> Int -> AttachInstancesToLoadBalancerResponse
AttachInstancesToLoadBalancerResponse'
{ $sel:operations:AttachInstancesToLoadBalancerResponse' :: Maybe [Operation]
operations =
Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AttachInstancesToLoadBalancerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
attachInstancesToLoadBalancerResponse_operations :: Lens.Lens' AttachInstancesToLoadBalancerResponse (Prelude.Maybe [Operation])
attachInstancesToLoadBalancerResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> AttachInstancesToLoadBalancerResponse
-> f AttachInstancesToLoadBalancerResponse
attachInstancesToLoadBalancerResponse_operations = (AttachInstancesToLoadBalancerResponse -> Maybe [Operation])
-> (AttachInstancesToLoadBalancerResponse
-> Maybe [Operation] -> AttachInstancesToLoadBalancerResponse)
-> Lens
AttachInstancesToLoadBalancerResponse
AttachInstancesToLoadBalancerResponse
(Maybe [Operation])
(Maybe [Operation])
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) ((Maybe [Operation] -> f (Maybe [Operation]))
-> AttachInstancesToLoadBalancerResponse
-> f AttachInstancesToLoadBalancerResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> AttachInstancesToLoadBalancerResponse
-> f AttachInstancesToLoadBalancerResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 AnIso [Operation] [Operation] [Operation] [Operation]
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 :: (Int -> f Int)
-> AttachInstancesToLoadBalancerResponse
-> f AttachInstancesToLoadBalancerResponse
attachInstancesToLoadBalancerResponse_httpStatus = (AttachInstancesToLoadBalancerResponse -> Int)
-> (AttachInstancesToLoadBalancerResponse
-> Int -> AttachInstancesToLoadBalancerResponse)
-> Lens
AttachInstancesToLoadBalancerResponse
AttachInstancesToLoadBalancerResponse
Int
Int
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