{-# 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.ECS.DeregisterContainerInstance
(
DeregisterContainerInstance (..),
newDeregisterContainerInstance,
deregisterContainerInstance_cluster,
deregisterContainerInstance_force,
deregisterContainerInstance_containerInstance,
DeregisterContainerInstanceResponse (..),
newDeregisterContainerInstanceResponse,
deregisterContainerInstanceResponse_containerInstance,
deregisterContainerInstanceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeregisterContainerInstance = DeregisterContainerInstance'
{
DeregisterContainerInstance -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
DeregisterContainerInstance -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
DeregisterContainerInstance -> Text
containerInstance :: Prelude.Text
}
deriving (DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
(DeregisterContainerInstance
-> DeregisterContainerInstance -> Bool)
-> (DeregisterContainerInstance
-> DeregisterContainerInstance -> Bool)
-> Eq DeregisterContainerInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
$c/= :: DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
== :: DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
$c== :: DeregisterContainerInstance -> DeregisterContainerInstance -> Bool
Prelude.Eq, ReadPrec [DeregisterContainerInstance]
ReadPrec DeregisterContainerInstance
Int -> ReadS DeregisterContainerInstance
ReadS [DeregisterContainerInstance]
(Int -> ReadS DeregisterContainerInstance)
-> ReadS [DeregisterContainerInstance]
-> ReadPrec DeregisterContainerInstance
-> ReadPrec [DeregisterContainerInstance]
-> Read DeregisterContainerInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterContainerInstance]
$creadListPrec :: ReadPrec [DeregisterContainerInstance]
readPrec :: ReadPrec DeregisterContainerInstance
$creadPrec :: ReadPrec DeregisterContainerInstance
readList :: ReadS [DeregisterContainerInstance]
$creadList :: ReadS [DeregisterContainerInstance]
readsPrec :: Int -> ReadS DeregisterContainerInstance
$creadsPrec :: Int -> ReadS DeregisterContainerInstance
Prelude.Read, Int -> DeregisterContainerInstance -> ShowS
[DeregisterContainerInstance] -> ShowS
DeregisterContainerInstance -> String
(Int -> DeregisterContainerInstance -> ShowS)
-> (DeregisterContainerInstance -> String)
-> ([DeregisterContainerInstance] -> ShowS)
-> Show DeregisterContainerInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterContainerInstance] -> ShowS
$cshowList :: [DeregisterContainerInstance] -> ShowS
show :: DeregisterContainerInstance -> String
$cshow :: DeregisterContainerInstance -> String
showsPrec :: Int -> DeregisterContainerInstance -> ShowS
$cshowsPrec :: Int -> DeregisterContainerInstance -> ShowS
Prelude.Show, (forall x.
DeregisterContainerInstance -> Rep DeregisterContainerInstance x)
-> (forall x.
Rep DeregisterContainerInstance x -> DeregisterContainerInstance)
-> Generic DeregisterContainerInstance
forall x.
Rep DeregisterContainerInstance x -> DeregisterContainerInstance
forall x.
DeregisterContainerInstance -> Rep DeregisterContainerInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterContainerInstance x -> DeregisterContainerInstance
$cfrom :: forall x.
DeregisterContainerInstance -> Rep DeregisterContainerInstance x
Prelude.Generic)
newDeregisterContainerInstance ::
Prelude.Text ->
DeregisterContainerInstance
newDeregisterContainerInstance :: Text -> DeregisterContainerInstance
newDeregisterContainerInstance Text
pContainerInstance_ =
DeregisterContainerInstance' :: Maybe Text -> Maybe Bool -> Text -> DeregisterContainerInstance
DeregisterContainerInstance'
{ $sel:cluster:DeregisterContainerInstance' :: Maybe Text
cluster =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:force:DeregisterContainerInstance' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:containerInstance:DeregisterContainerInstance' :: Text
containerInstance = Text
pContainerInstance_
}
deregisterContainerInstance_cluster :: Lens.Lens' DeregisterContainerInstance (Prelude.Maybe Prelude.Text)
deregisterContainerInstance_cluster :: (Maybe Text -> f (Maybe Text))
-> DeregisterContainerInstance -> f DeregisterContainerInstance
deregisterContainerInstance_cluster = (DeregisterContainerInstance -> Maybe Text)
-> (DeregisterContainerInstance
-> Maybe Text -> DeregisterContainerInstance)
-> Lens
DeregisterContainerInstance
DeregisterContainerInstance
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterContainerInstance' {Maybe Text
cluster :: Maybe Text
$sel:cluster:DeregisterContainerInstance' :: DeregisterContainerInstance -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: DeregisterContainerInstance
s@DeregisterContainerInstance' {} Maybe Text
a -> DeregisterContainerInstance
s {$sel:cluster:DeregisterContainerInstance' :: Maybe Text
cluster = Maybe Text
a} :: DeregisterContainerInstance)
deregisterContainerInstance_force :: Lens.Lens' DeregisterContainerInstance (Prelude.Maybe Prelude.Bool)
deregisterContainerInstance_force :: (Maybe Bool -> f (Maybe Bool))
-> DeregisterContainerInstance -> f DeregisterContainerInstance
deregisterContainerInstance_force = (DeregisterContainerInstance -> Maybe Bool)
-> (DeregisterContainerInstance
-> Maybe Bool -> DeregisterContainerInstance)
-> Lens
DeregisterContainerInstance
DeregisterContainerInstance
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterContainerInstance' {Maybe Bool
force :: Maybe Bool
$sel:force:DeregisterContainerInstance' :: DeregisterContainerInstance -> Maybe Bool
force} -> Maybe Bool
force) (\s :: DeregisterContainerInstance
s@DeregisterContainerInstance' {} Maybe Bool
a -> DeregisterContainerInstance
s {$sel:force:DeregisterContainerInstance' :: Maybe Bool
force = Maybe Bool
a} :: DeregisterContainerInstance)
deregisterContainerInstance_containerInstance :: Lens.Lens' DeregisterContainerInstance Prelude.Text
deregisterContainerInstance_containerInstance :: (Text -> f Text)
-> DeregisterContainerInstance -> f DeregisterContainerInstance
deregisterContainerInstance_containerInstance = (DeregisterContainerInstance -> Text)
-> (DeregisterContainerInstance
-> Text -> DeregisterContainerInstance)
-> Lens
DeregisterContainerInstance DeregisterContainerInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterContainerInstance' {Text
containerInstance :: Text
$sel:containerInstance:DeregisterContainerInstance' :: DeregisterContainerInstance -> Text
containerInstance} -> Text
containerInstance) (\s :: DeregisterContainerInstance
s@DeregisterContainerInstance' {} Text
a -> DeregisterContainerInstance
s {$sel:containerInstance:DeregisterContainerInstance' :: Text
containerInstance = Text
a} :: DeregisterContainerInstance)
instance Core.AWSRequest DeregisterContainerInstance where
type
AWSResponse DeregisterContainerInstance =
DeregisterContainerInstanceResponse
request :: DeregisterContainerInstance -> Request DeregisterContainerInstance
request = Service
-> DeregisterContainerInstance
-> Request DeregisterContainerInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeregisterContainerInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeregisterContainerInstance)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeregisterContainerInstance))
-> Logger
-> Service
-> Proxy DeregisterContainerInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeregisterContainerInstance)))
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 ContainerInstance
-> Int -> DeregisterContainerInstanceResponse
DeregisterContainerInstanceResponse'
(Maybe ContainerInstance
-> Int -> DeregisterContainerInstanceResponse)
-> Either String (Maybe ContainerInstance)
-> Either String (Int -> DeregisterContainerInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ContainerInstance)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"containerInstance")
Either String (Int -> DeregisterContainerInstanceResponse)
-> Either String Int
-> Either String DeregisterContainerInstanceResponse
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 DeregisterContainerInstance
instance Prelude.NFData DeregisterContainerInstance
instance Core.ToHeaders DeregisterContainerInstance where
toHeaders :: DeregisterContainerInstance -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeregisterContainerInstance -> 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
"AmazonEC2ContainerServiceV20141113.DeregisterContainerInstance" ::
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 DeregisterContainerInstance where
toJSON :: DeregisterContainerInstance -> Value
toJSON DeregisterContainerInstance' {Maybe Bool
Maybe Text
Text
containerInstance :: Text
force :: Maybe Bool
cluster :: Maybe Text
$sel:containerInstance:DeregisterContainerInstance' :: DeregisterContainerInstance -> Text
$sel:force:DeregisterContainerInstance' :: DeregisterContainerInstance -> Maybe Bool
$sel:cluster:DeregisterContainerInstance' :: DeregisterContainerInstance -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"cluster" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cluster,
(Text
"force" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
force,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"containerInstance" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
containerInstance)
]
)
instance Core.ToPath DeregisterContainerInstance where
toPath :: DeregisterContainerInstance -> ByteString
toPath = ByteString -> DeregisterContainerInstance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeregisterContainerInstance where
toQuery :: DeregisterContainerInstance -> QueryString
toQuery = QueryString -> DeregisterContainerInstance -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeregisterContainerInstanceResponse = DeregisterContainerInstanceResponse'
{
DeregisterContainerInstanceResponse -> Maybe ContainerInstance
containerInstance :: Prelude.Maybe ContainerInstance,
DeregisterContainerInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
(DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool)
-> (DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool)
-> Eq DeregisterContainerInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
$c/= :: DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
== :: DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
$c== :: DeregisterContainerInstanceResponse
-> DeregisterContainerInstanceResponse -> Bool
Prelude.Eq, ReadPrec [DeregisterContainerInstanceResponse]
ReadPrec DeregisterContainerInstanceResponse
Int -> ReadS DeregisterContainerInstanceResponse
ReadS [DeregisterContainerInstanceResponse]
(Int -> ReadS DeregisterContainerInstanceResponse)
-> ReadS [DeregisterContainerInstanceResponse]
-> ReadPrec DeregisterContainerInstanceResponse
-> ReadPrec [DeregisterContainerInstanceResponse]
-> Read DeregisterContainerInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterContainerInstanceResponse]
$creadListPrec :: ReadPrec [DeregisterContainerInstanceResponse]
readPrec :: ReadPrec DeregisterContainerInstanceResponse
$creadPrec :: ReadPrec DeregisterContainerInstanceResponse
readList :: ReadS [DeregisterContainerInstanceResponse]
$creadList :: ReadS [DeregisterContainerInstanceResponse]
readsPrec :: Int -> ReadS DeregisterContainerInstanceResponse
$creadsPrec :: Int -> ReadS DeregisterContainerInstanceResponse
Prelude.Read, Int -> DeregisterContainerInstanceResponse -> ShowS
[DeregisterContainerInstanceResponse] -> ShowS
DeregisterContainerInstanceResponse -> String
(Int -> DeregisterContainerInstanceResponse -> ShowS)
-> (DeregisterContainerInstanceResponse -> String)
-> ([DeregisterContainerInstanceResponse] -> ShowS)
-> Show DeregisterContainerInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterContainerInstanceResponse] -> ShowS
$cshowList :: [DeregisterContainerInstanceResponse] -> ShowS
show :: DeregisterContainerInstanceResponse -> String
$cshow :: DeregisterContainerInstanceResponse -> String
showsPrec :: Int -> DeregisterContainerInstanceResponse -> ShowS
$cshowsPrec :: Int -> DeregisterContainerInstanceResponse -> ShowS
Prelude.Show, (forall x.
DeregisterContainerInstanceResponse
-> Rep DeregisterContainerInstanceResponse x)
-> (forall x.
Rep DeregisterContainerInstanceResponse x
-> DeregisterContainerInstanceResponse)
-> Generic DeregisterContainerInstanceResponse
forall x.
Rep DeregisterContainerInstanceResponse x
-> DeregisterContainerInstanceResponse
forall x.
DeregisterContainerInstanceResponse
-> Rep DeregisterContainerInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterContainerInstanceResponse x
-> DeregisterContainerInstanceResponse
$cfrom :: forall x.
DeregisterContainerInstanceResponse
-> Rep DeregisterContainerInstanceResponse x
Prelude.Generic)
newDeregisterContainerInstanceResponse ::
Prelude.Int ->
DeregisterContainerInstanceResponse
newDeregisterContainerInstanceResponse :: Int -> DeregisterContainerInstanceResponse
newDeregisterContainerInstanceResponse Int
pHttpStatus_ =
DeregisterContainerInstanceResponse' :: Maybe ContainerInstance
-> Int -> DeregisterContainerInstanceResponse
DeregisterContainerInstanceResponse'
{ $sel:containerInstance:DeregisterContainerInstanceResponse' :: Maybe ContainerInstance
containerInstance =
Maybe ContainerInstance
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeregisterContainerInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deregisterContainerInstanceResponse_containerInstance :: Lens.Lens' DeregisterContainerInstanceResponse (Prelude.Maybe ContainerInstance)
deregisterContainerInstanceResponse_containerInstance :: (Maybe ContainerInstance -> f (Maybe ContainerInstance))
-> DeregisterContainerInstanceResponse
-> f DeregisterContainerInstanceResponse
deregisterContainerInstanceResponse_containerInstance = (DeregisterContainerInstanceResponse -> Maybe ContainerInstance)
-> (DeregisterContainerInstanceResponse
-> Maybe ContainerInstance -> DeregisterContainerInstanceResponse)
-> Lens
DeregisterContainerInstanceResponse
DeregisterContainerInstanceResponse
(Maybe ContainerInstance)
(Maybe ContainerInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterContainerInstanceResponse' {Maybe ContainerInstance
containerInstance :: Maybe ContainerInstance
$sel:containerInstance:DeregisterContainerInstanceResponse' :: DeregisterContainerInstanceResponse -> Maybe ContainerInstance
containerInstance} -> Maybe ContainerInstance
containerInstance) (\s :: DeregisterContainerInstanceResponse
s@DeregisterContainerInstanceResponse' {} Maybe ContainerInstance
a -> DeregisterContainerInstanceResponse
s {$sel:containerInstance:DeregisterContainerInstanceResponse' :: Maybe ContainerInstance
containerInstance = Maybe ContainerInstance
a} :: DeregisterContainerInstanceResponse)
deregisterContainerInstanceResponse_httpStatus :: Lens.Lens' DeregisterContainerInstanceResponse Prelude.Int
deregisterContainerInstanceResponse_httpStatus :: (Int -> f Int)
-> DeregisterContainerInstanceResponse
-> f DeregisterContainerInstanceResponse
deregisterContainerInstanceResponse_httpStatus = (DeregisterContainerInstanceResponse -> Int)
-> (DeregisterContainerInstanceResponse
-> Int -> DeregisterContainerInstanceResponse)
-> Lens
DeregisterContainerInstanceResponse
DeregisterContainerInstanceResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterContainerInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeregisterContainerInstanceResponse' :: DeregisterContainerInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeregisterContainerInstanceResponse
s@DeregisterContainerInstanceResponse' {} Int
a -> DeregisterContainerInstanceResponse
s {$sel:httpStatus:DeregisterContainerInstanceResponse' :: Int
httpStatus = Int
a} :: DeregisterContainerInstanceResponse)
instance
Prelude.NFData
DeregisterContainerInstanceResponse