{-# 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.DetachInstancesFromLoadBalancer
(
DetachInstancesFromLoadBalancer (..),
newDetachInstancesFromLoadBalancer,
detachInstancesFromLoadBalancer_loadBalancerName,
detachInstancesFromLoadBalancer_instanceNames,
DetachInstancesFromLoadBalancerResponse (..),
newDetachInstancesFromLoadBalancerResponse,
detachInstancesFromLoadBalancerResponse_operations,
detachInstancesFromLoadBalancerResponse_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 DetachInstancesFromLoadBalancer = DetachInstancesFromLoadBalancer'
{
DetachInstancesFromLoadBalancer -> Text
loadBalancerName :: Prelude.Text,
DetachInstancesFromLoadBalancer -> [Text]
instanceNames :: [Prelude.Text]
}
deriving (DetachInstancesFromLoadBalancer
-> DetachInstancesFromLoadBalancer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachInstancesFromLoadBalancer
-> DetachInstancesFromLoadBalancer -> Bool
$c/= :: DetachInstancesFromLoadBalancer
-> DetachInstancesFromLoadBalancer -> Bool
== :: DetachInstancesFromLoadBalancer
-> DetachInstancesFromLoadBalancer -> Bool
$c== :: DetachInstancesFromLoadBalancer
-> DetachInstancesFromLoadBalancer -> Bool
Prelude.Eq, ReadPrec [DetachInstancesFromLoadBalancer]
ReadPrec DetachInstancesFromLoadBalancer
Int -> ReadS DetachInstancesFromLoadBalancer
ReadS [DetachInstancesFromLoadBalancer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachInstancesFromLoadBalancer]
$creadListPrec :: ReadPrec [DetachInstancesFromLoadBalancer]
readPrec :: ReadPrec DetachInstancesFromLoadBalancer
$creadPrec :: ReadPrec DetachInstancesFromLoadBalancer
readList :: ReadS [DetachInstancesFromLoadBalancer]
$creadList :: ReadS [DetachInstancesFromLoadBalancer]
readsPrec :: Int -> ReadS DetachInstancesFromLoadBalancer
$creadsPrec :: Int -> ReadS DetachInstancesFromLoadBalancer
Prelude.Read, Int -> DetachInstancesFromLoadBalancer -> ShowS
[DetachInstancesFromLoadBalancer] -> ShowS
DetachInstancesFromLoadBalancer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachInstancesFromLoadBalancer] -> ShowS
$cshowList :: [DetachInstancesFromLoadBalancer] -> ShowS
show :: DetachInstancesFromLoadBalancer -> String
$cshow :: DetachInstancesFromLoadBalancer -> String
showsPrec :: Int -> DetachInstancesFromLoadBalancer -> ShowS
$cshowsPrec :: Int -> DetachInstancesFromLoadBalancer -> ShowS
Prelude.Show, forall x.
Rep DetachInstancesFromLoadBalancer x
-> DetachInstancesFromLoadBalancer
forall x.
DetachInstancesFromLoadBalancer
-> Rep DetachInstancesFromLoadBalancer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetachInstancesFromLoadBalancer x
-> DetachInstancesFromLoadBalancer
$cfrom :: forall x.
DetachInstancesFromLoadBalancer
-> Rep DetachInstancesFromLoadBalancer x
Prelude.Generic)
newDetachInstancesFromLoadBalancer ::
Prelude.Text ->
DetachInstancesFromLoadBalancer
newDetachInstancesFromLoadBalancer :: Text -> DetachInstancesFromLoadBalancer
newDetachInstancesFromLoadBalancer Text
pLoadBalancerName_ =
DetachInstancesFromLoadBalancer'
{ $sel:loadBalancerName:DetachInstancesFromLoadBalancer' :: Text
loadBalancerName =
Text
pLoadBalancerName_,
$sel:instanceNames:DetachInstancesFromLoadBalancer' :: [Text]
instanceNames = forall a. Monoid a => a
Prelude.mempty
}
detachInstancesFromLoadBalancer_loadBalancerName :: Lens.Lens' DetachInstancesFromLoadBalancer Prelude.Text
detachInstancesFromLoadBalancer_loadBalancerName :: Lens' DetachInstancesFromLoadBalancer Text
detachInstancesFromLoadBalancer_loadBalancerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachInstancesFromLoadBalancer' {Text
loadBalancerName :: Text
$sel:loadBalancerName:DetachInstancesFromLoadBalancer' :: DetachInstancesFromLoadBalancer -> Text
loadBalancerName} -> Text
loadBalancerName) (\s :: DetachInstancesFromLoadBalancer
s@DetachInstancesFromLoadBalancer' {} Text
a -> DetachInstancesFromLoadBalancer
s {$sel:loadBalancerName:DetachInstancesFromLoadBalancer' :: Text
loadBalancerName = Text
a} :: DetachInstancesFromLoadBalancer)
detachInstancesFromLoadBalancer_instanceNames :: Lens.Lens' DetachInstancesFromLoadBalancer [Prelude.Text]
detachInstancesFromLoadBalancer_instanceNames :: Lens' DetachInstancesFromLoadBalancer [Text]
detachInstancesFromLoadBalancer_instanceNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachInstancesFromLoadBalancer' {[Text]
instanceNames :: [Text]
$sel:instanceNames:DetachInstancesFromLoadBalancer' :: DetachInstancesFromLoadBalancer -> [Text]
instanceNames} -> [Text]
instanceNames) (\s :: DetachInstancesFromLoadBalancer
s@DetachInstancesFromLoadBalancer' {} [Text]
a -> DetachInstancesFromLoadBalancer
s {$sel:instanceNames:DetachInstancesFromLoadBalancer' :: [Text]
instanceNames = [Text]
a} :: DetachInstancesFromLoadBalancer) 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
DetachInstancesFromLoadBalancer
where
type
AWSResponse DetachInstancesFromLoadBalancer =
DetachInstancesFromLoadBalancerResponse
request :: (Service -> Service)
-> DetachInstancesFromLoadBalancer
-> Request DetachInstancesFromLoadBalancer
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 DetachInstancesFromLoadBalancer
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse DetachInstancesFromLoadBalancer)))
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 -> DetachInstancesFromLoadBalancerResponse
DetachInstancesFromLoadBalancerResponse'
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
DetachInstancesFromLoadBalancer
where
hashWithSalt :: Int -> DetachInstancesFromLoadBalancer -> Int
hashWithSalt
Int
_salt
DetachInstancesFromLoadBalancer' {[Text]
Text
instanceNames :: [Text]
loadBalancerName :: Text
$sel:instanceNames:DetachInstancesFromLoadBalancer' :: DetachInstancesFromLoadBalancer -> [Text]
$sel:loadBalancerName:DetachInstancesFromLoadBalancer' :: DetachInstancesFromLoadBalancer -> 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
DetachInstancesFromLoadBalancer
where
rnf :: DetachInstancesFromLoadBalancer -> ()
rnf DetachInstancesFromLoadBalancer' {[Text]
Text
instanceNames :: [Text]
loadBalancerName :: Text
$sel:instanceNames:DetachInstancesFromLoadBalancer' :: DetachInstancesFromLoadBalancer -> [Text]
$sel:loadBalancerName:DetachInstancesFromLoadBalancer' :: DetachInstancesFromLoadBalancer -> 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
DetachInstancesFromLoadBalancer
where
toHeaders :: DetachInstancesFromLoadBalancer -> 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.DetachInstancesFromLoadBalancer" ::
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 DetachInstancesFromLoadBalancer where
toJSON :: DetachInstancesFromLoadBalancer -> Value
toJSON DetachInstancesFromLoadBalancer' {[Text]
Text
instanceNames :: [Text]
loadBalancerName :: Text
$sel:instanceNames:DetachInstancesFromLoadBalancer' :: DetachInstancesFromLoadBalancer -> [Text]
$sel:loadBalancerName:DetachInstancesFromLoadBalancer' :: DetachInstancesFromLoadBalancer -> 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 DetachInstancesFromLoadBalancer where
toPath :: DetachInstancesFromLoadBalancer -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery DetachInstancesFromLoadBalancer where
toQuery :: DetachInstancesFromLoadBalancer -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DetachInstancesFromLoadBalancerResponse = DetachInstancesFromLoadBalancerResponse'
{
DetachInstancesFromLoadBalancerResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
DetachInstancesFromLoadBalancerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DetachInstancesFromLoadBalancerResponse
-> DetachInstancesFromLoadBalancerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachInstancesFromLoadBalancerResponse
-> DetachInstancesFromLoadBalancerResponse -> Bool
$c/= :: DetachInstancesFromLoadBalancerResponse
-> DetachInstancesFromLoadBalancerResponse -> Bool
== :: DetachInstancesFromLoadBalancerResponse
-> DetachInstancesFromLoadBalancerResponse -> Bool
$c== :: DetachInstancesFromLoadBalancerResponse
-> DetachInstancesFromLoadBalancerResponse -> Bool
Prelude.Eq, ReadPrec [DetachInstancesFromLoadBalancerResponse]
ReadPrec DetachInstancesFromLoadBalancerResponse
Int -> ReadS DetachInstancesFromLoadBalancerResponse
ReadS [DetachInstancesFromLoadBalancerResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachInstancesFromLoadBalancerResponse]
$creadListPrec :: ReadPrec [DetachInstancesFromLoadBalancerResponse]
readPrec :: ReadPrec DetachInstancesFromLoadBalancerResponse
$creadPrec :: ReadPrec DetachInstancesFromLoadBalancerResponse
readList :: ReadS [DetachInstancesFromLoadBalancerResponse]
$creadList :: ReadS [DetachInstancesFromLoadBalancerResponse]
readsPrec :: Int -> ReadS DetachInstancesFromLoadBalancerResponse
$creadsPrec :: Int -> ReadS DetachInstancesFromLoadBalancerResponse
Prelude.Read, Int -> DetachInstancesFromLoadBalancerResponse -> ShowS
[DetachInstancesFromLoadBalancerResponse] -> ShowS
DetachInstancesFromLoadBalancerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachInstancesFromLoadBalancerResponse] -> ShowS
$cshowList :: [DetachInstancesFromLoadBalancerResponse] -> ShowS
show :: DetachInstancesFromLoadBalancerResponse -> String
$cshow :: DetachInstancesFromLoadBalancerResponse -> String
showsPrec :: Int -> DetachInstancesFromLoadBalancerResponse -> ShowS
$cshowsPrec :: Int -> DetachInstancesFromLoadBalancerResponse -> ShowS
Prelude.Show, forall x.
Rep DetachInstancesFromLoadBalancerResponse x
-> DetachInstancesFromLoadBalancerResponse
forall x.
DetachInstancesFromLoadBalancerResponse
-> Rep DetachInstancesFromLoadBalancerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetachInstancesFromLoadBalancerResponse x
-> DetachInstancesFromLoadBalancerResponse
$cfrom :: forall x.
DetachInstancesFromLoadBalancerResponse
-> Rep DetachInstancesFromLoadBalancerResponse x
Prelude.Generic)
newDetachInstancesFromLoadBalancerResponse ::
Prelude.Int ->
DetachInstancesFromLoadBalancerResponse
newDetachInstancesFromLoadBalancerResponse :: Int -> DetachInstancesFromLoadBalancerResponse
newDetachInstancesFromLoadBalancerResponse
Int
pHttpStatus_ =
DetachInstancesFromLoadBalancerResponse'
{ $sel:operations:DetachInstancesFromLoadBalancerResponse' :: Maybe [Operation]
operations =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DetachInstancesFromLoadBalancerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
detachInstancesFromLoadBalancerResponse_operations :: Lens.Lens' DetachInstancesFromLoadBalancerResponse (Prelude.Maybe [Operation])
detachInstancesFromLoadBalancerResponse_operations :: Lens' DetachInstancesFromLoadBalancerResponse (Maybe [Operation])
detachInstancesFromLoadBalancerResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachInstancesFromLoadBalancerResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:DetachInstancesFromLoadBalancerResponse' :: DetachInstancesFromLoadBalancerResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: DetachInstancesFromLoadBalancerResponse
s@DetachInstancesFromLoadBalancerResponse' {} Maybe [Operation]
a -> DetachInstancesFromLoadBalancerResponse
s {$sel:operations:DetachInstancesFromLoadBalancerResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: DetachInstancesFromLoadBalancerResponse) 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
detachInstancesFromLoadBalancerResponse_httpStatus :: Lens.Lens' DetachInstancesFromLoadBalancerResponse Prelude.Int
detachInstancesFromLoadBalancerResponse_httpStatus :: Lens' DetachInstancesFromLoadBalancerResponse Int
detachInstancesFromLoadBalancerResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachInstancesFromLoadBalancerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetachInstancesFromLoadBalancerResponse' :: DetachInstancesFromLoadBalancerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetachInstancesFromLoadBalancerResponse
s@DetachInstancesFromLoadBalancerResponse' {} Int
a -> DetachInstancesFromLoadBalancerResponse
s {$sel:httpStatus:DetachInstancesFromLoadBalancerResponse' :: Int
httpStatus = Int
a} :: DetachInstancesFromLoadBalancerResponse)
instance
Prelude.NFData
DetachInstancesFromLoadBalancerResponse
where
rnf :: DetachInstancesFromLoadBalancerResponse -> ()
rnf DetachInstancesFromLoadBalancerResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:DetachInstancesFromLoadBalancerResponse' :: DetachInstancesFromLoadBalancerResponse -> Int
$sel:operations:DetachInstancesFromLoadBalancerResponse' :: DetachInstancesFromLoadBalancerResponse -> 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