{-# 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.UpdateContainerAgent
(
UpdateContainerAgent (..),
newUpdateContainerAgent,
updateContainerAgent_cluster,
updateContainerAgent_containerInstance,
UpdateContainerAgentResponse (..),
newUpdateContainerAgentResponse,
updateContainerAgentResponse_containerInstance,
updateContainerAgentResponse_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 UpdateContainerAgent = UpdateContainerAgent'
{
UpdateContainerAgent -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
UpdateContainerAgent -> Text
containerInstance :: Prelude.Text
}
deriving (UpdateContainerAgent -> UpdateContainerAgent -> Bool
(UpdateContainerAgent -> UpdateContainerAgent -> Bool)
-> (UpdateContainerAgent -> UpdateContainerAgent -> Bool)
-> Eq UpdateContainerAgent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContainerAgent -> UpdateContainerAgent -> Bool
$c/= :: UpdateContainerAgent -> UpdateContainerAgent -> Bool
== :: UpdateContainerAgent -> UpdateContainerAgent -> Bool
$c== :: UpdateContainerAgent -> UpdateContainerAgent -> Bool
Prelude.Eq, ReadPrec [UpdateContainerAgent]
ReadPrec UpdateContainerAgent
Int -> ReadS UpdateContainerAgent
ReadS [UpdateContainerAgent]
(Int -> ReadS UpdateContainerAgent)
-> ReadS [UpdateContainerAgent]
-> ReadPrec UpdateContainerAgent
-> ReadPrec [UpdateContainerAgent]
-> Read UpdateContainerAgent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContainerAgent]
$creadListPrec :: ReadPrec [UpdateContainerAgent]
readPrec :: ReadPrec UpdateContainerAgent
$creadPrec :: ReadPrec UpdateContainerAgent
readList :: ReadS [UpdateContainerAgent]
$creadList :: ReadS [UpdateContainerAgent]
readsPrec :: Int -> ReadS UpdateContainerAgent
$creadsPrec :: Int -> ReadS UpdateContainerAgent
Prelude.Read, Int -> UpdateContainerAgent -> ShowS
[UpdateContainerAgent] -> ShowS
UpdateContainerAgent -> String
(Int -> UpdateContainerAgent -> ShowS)
-> (UpdateContainerAgent -> String)
-> ([UpdateContainerAgent] -> ShowS)
-> Show UpdateContainerAgent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContainerAgent] -> ShowS
$cshowList :: [UpdateContainerAgent] -> ShowS
show :: UpdateContainerAgent -> String
$cshow :: UpdateContainerAgent -> String
showsPrec :: Int -> UpdateContainerAgent -> ShowS
$cshowsPrec :: Int -> UpdateContainerAgent -> ShowS
Prelude.Show, (forall x. UpdateContainerAgent -> Rep UpdateContainerAgent x)
-> (forall x. Rep UpdateContainerAgent x -> UpdateContainerAgent)
-> Generic UpdateContainerAgent
forall x. Rep UpdateContainerAgent x -> UpdateContainerAgent
forall x. UpdateContainerAgent -> Rep UpdateContainerAgent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateContainerAgent x -> UpdateContainerAgent
$cfrom :: forall x. UpdateContainerAgent -> Rep UpdateContainerAgent x
Prelude.Generic)
newUpdateContainerAgent ::
Prelude.Text ->
UpdateContainerAgent
newUpdateContainerAgent :: Text -> UpdateContainerAgent
newUpdateContainerAgent Text
pContainerInstance_ =
UpdateContainerAgent' :: Maybe Text -> Text -> UpdateContainerAgent
UpdateContainerAgent'
{ $sel:cluster:UpdateContainerAgent' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:containerInstance:UpdateContainerAgent' :: Text
containerInstance = Text
pContainerInstance_
}
updateContainerAgent_cluster :: Lens.Lens' UpdateContainerAgent (Prelude.Maybe Prelude.Text)
updateContainerAgent_cluster :: (Maybe Text -> f (Maybe Text))
-> UpdateContainerAgent -> f UpdateContainerAgent
updateContainerAgent_cluster = (UpdateContainerAgent -> Maybe Text)
-> (UpdateContainerAgent -> Maybe Text -> UpdateContainerAgent)
-> Lens
UpdateContainerAgent UpdateContainerAgent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerAgent' {Maybe Text
cluster :: Maybe Text
$sel:cluster:UpdateContainerAgent' :: UpdateContainerAgent -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: UpdateContainerAgent
s@UpdateContainerAgent' {} Maybe Text
a -> UpdateContainerAgent
s {$sel:cluster:UpdateContainerAgent' :: Maybe Text
cluster = Maybe Text
a} :: UpdateContainerAgent)
updateContainerAgent_containerInstance :: Lens.Lens' UpdateContainerAgent Prelude.Text
updateContainerAgent_containerInstance :: (Text -> f Text) -> UpdateContainerAgent -> f UpdateContainerAgent
updateContainerAgent_containerInstance = (UpdateContainerAgent -> Text)
-> (UpdateContainerAgent -> Text -> UpdateContainerAgent)
-> Lens UpdateContainerAgent UpdateContainerAgent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerAgent' {Text
containerInstance :: Text
$sel:containerInstance:UpdateContainerAgent' :: UpdateContainerAgent -> Text
containerInstance} -> Text
containerInstance) (\s :: UpdateContainerAgent
s@UpdateContainerAgent' {} Text
a -> UpdateContainerAgent
s {$sel:containerInstance:UpdateContainerAgent' :: Text
containerInstance = Text
a} :: UpdateContainerAgent)
instance Core.AWSRequest UpdateContainerAgent where
type
AWSResponse UpdateContainerAgent =
UpdateContainerAgentResponse
request :: UpdateContainerAgent -> Request UpdateContainerAgent
request = Service -> UpdateContainerAgent -> Request UpdateContainerAgent
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateContainerAgent
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateContainerAgent)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateContainerAgent))
-> Logger
-> Service
-> Proxy UpdateContainerAgent
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateContainerAgent)))
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 -> UpdateContainerAgentResponse
UpdateContainerAgentResponse'
(Maybe ContainerInstance -> Int -> UpdateContainerAgentResponse)
-> Either String (Maybe ContainerInstance)
-> Either String (Int -> UpdateContainerAgentResponse)
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 -> UpdateContainerAgentResponse)
-> Either String Int -> Either String UpdateContainerAgentResponse
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 UpdateContainerAgent
instance Prelude.NFData UpdateContainerAgent
instance Core.ToHeaders UpdateContainerAgent where
toHeaders :: UpdateContainerAgent -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateContainerAgent -> 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.UpdateContainerAgent" ::
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 UpdateContainerAgent where
toJSON :: UpdateContainerAgent -> Value
toJSON UpdateContainerAgent' {Maybe Text
Text
containerInstance :: Text
cluster :: Maybe Text
$sel:containerInstance:UpdateContainerAgent' :: UpdateContainerAgent -> Text
$sel:cluster:UpdateContainerAgent' :: UpdateContainerAgent -> 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,
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 UpdateContainerAgent where
toPath :: UpdateContainerAgent -> ByteString
toPath = ByteString -> UpdateContainerAgent -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateContainerAgent where
toQuery :: UpdateContainerAgent -> QueryString
toQuery = QueryString -> UpdateContainerAgent -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateContainerAgentResponse = UpdateContainerAgentResponse'
{
UpdateContainerAgentResponse -> Maybe ContainerInstance
containerInstance :: Prelude.Maybe ContainerInstance,
UpdateContainerAgentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateContainerAgentResponse
-> UpdateContainerAgentResponse -> Bool
(UpdateContainerAgentResponse
-> UpdateContainerAgentResponse -> Bool)
-> (UpdateContainerAgentResponse
-> UpdateContainerAgentResponse -> Bool)
-> Eq UpdateContainerAgentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContainerAgentResponse
-> UpdateContainerAgentResponse -> Bool
$c/= :: UpdateContainerAgentResponse
-> UpdateContainerAgentResponse -> Bool
== :: UpdateContainerAgentResponse
-> UpdateContainerAgentResponse -> Bool
$c== :: UpdateContainerAgentResponse
-> UpdateContainerAgentResponse -> Bool
Prelude.Eq, ReadPrec [UpdateContainerAgentResponse]
ReadPrec UpdateContainerAgentResponse
Int -> ReadS UpdateContainerAgentResponse
ReadS [UpdateContainerAgentResponse]
(Int -> ReadS UpdateContainerAgentResponse)
-> ReadS [UpdateContainerAgentResponse]
-> ReadPrec UpdateContainerAgentResponse
-> ReadPrec [UpdateContainerAgentResponse]
-> Read UpdateContainerAgentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContainerAgentResponse]
$creadListPrec :: ReadPrec [UpdateContainerAgentResponse]
readPrec :: ReadPrec UpdateContainerAgentResponse
$creadPrec :: ReadPrec UpdateContainerAgentResponse
readList :: ReadS [UpdateContainerAgentResponse]
$creadList :: ReadS [UpdateContainerAgentResponse]
readsPrec :: Int -> ReadS UpdateContainerAgentResponse
$creadsPrec :: Int -> ReadS UpdateContainerAgentResponse
Prelude.Read, Int -> UpdateContainerAgentResponse -> ShowS
[UpdateContainerAgentResponse] -> ShowS
UpdateContainerAgentResponse -> String
(Int -> UpdateContainerAgentResponse -> ShowS)
-> (UpdateContainerAgentResponse -> String)
-> ([UpdateContainerAgentResponse] -> ShowS)
-> Show UpdateContainerAgentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContainerAgentResponse] -> ShowS
$cshowList :: [UpdateContainerAgentResponse] -> ShowS
show :: UpdateContainerAgentResponse -> String
$cshow :: UpdateContainerAgentResponse -> String
showsPrec :: Int -> UpdateContainerAgentResponse -> ShowS
$cshowsPrec :: Int -> UpdateContainerAgentResponse -> ShowS
Prelude.Show, (forall x.
UpdateContainerAgentResponse -> Rep UpdateContainerAgentResponse x)
-> (forall x.
Rep UpdateContainerAgentResponse x -> UpdateContainerAgentResponse)
-> Generic UpdateContainerAgentResponse
forall x.
Rep UpdateContainerAgentResponse x -> UpdateContainerAgentResponse
forall x.
UpdateContainerAgentResponse -> Rep UpdateContainerAgentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateContainerAgentResponse x -> UpdateContainerAgentResponse
$cfrom :: forall x.
UpdateContainerAgentResponse -> Rep UpdateContainerAgentResponse x
Prelude.Generic)
newUpdateContainerAgentResponse ::
Prelude.Int ->
UpdateContainerAgentResponse
newUpdateContainerAgentResponse :: Int -> UpdateContainerAgentResponse
newUpdateContainerAgentResponse Int
pHttpStatus_ =
UpdateContainerAgentResponse' :: Maybe ContainerInstance -> Int -> UpdateContainerAgentResponse
UpdateContainerAgentResponse'
{ $sel:containerInstance:UpdateContainerAgentResponse' :: Maybe ContainerInstance
containerInstance =
Maybe ContainerInstance
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateContainerAgentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateContainerAgentResponse_containerInstance :: Lens.Lens' UpdateContainerAgentResponse (Prelude.Maybe ContainerInstance)
updateContainerAgentResponse_containerInstance :: (Maybe ContainerInstance -> f (Maybe ContainerInstance))
-> UpdateContainerAgentResponse -> f UpdateContainerAgentResponse
updateContainerAgentResponse_containerInstance = (UpdateContainerAgentResponse -> Maybe ContainerInstance)
-> (UpdateContainerAgentResponse
-> Maybe ContainerInstance -> UpdateContainerAgentResponse)
-> Lens
UpdateContainerAgentResponse
UpdateContainerAgentResponse
(Maybe ContainerInstance)
(Maybe ContainerInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerAgentResponse' {Maybe ContainerInstance
containerInstance :: Maybe ContainerInstance
$sel:containerInstance:UpdateContainerAgentResponse' :: UpdateContainerAgentResponse -> Maybe ContainerInstance
containerInstance} -> Maybe ContainerInstance
containerInstance) (\s :: UpdateContainerAgentResponse
s@UpdateContainerAgentResponse' {} Maybe ContainerInstance
a -> UpdateContainerAgentResponse
s {$sel:containerInstance:UpdateContainerAgentResponse' :: Maybe ContainerInstance
containerInstance = Maybe ContainerInstance
a} :: UpdateContainerAgentResponse)
updateContainerAgentResponse_httpStatus :: Lens.Lens' UpdateContainerAgentResponse Prelude.Int
updateContainerAgentResponse_httpStatus :: (Int -> f Int)
-> UpdateContainerAgentResponse -> f UpdateContainerAgentResponse
updateContainerAgentResponse_httpStatus = (UpdateContainerAgentResponse -> Int)
-> (UpdateContainerAgentResponse
-> Int -> UpdateContainerAgentResponse)
-> Lens
UpdateContainerAgentResponse UpdateContainerAgentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContainerAgentResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateContainerAgentResponse' :: UpdateContainerAgentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateContainerAgentResponse
s@UpdateContainerAgentResponse' {} Int
a -> UpdateContainerAgentResponse
s {$sel:httpStatus:UpdateContainerAgentResponse' :: Int
httpStatus = Int
a} :: UpdateContainerAgentResponse)
instance Prelude.NFData UpdateContainerAgentResponse