{-# 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.UpdateCluster
(
UpdateCluster (..),
newUpdateCluster,
updateCluster_settings,
updateCluster_configuration,
updateCluster_cluster,
UpdateClusterResponse (..),
newUpdateClusterResponse,
updateClusterResponse_cluster,
updateClusterResponse_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 UpdateCluster = UpdateCluster'
{
UpdateCluster -> Maybe [ClusterSetting]
settings :: Prelude.Maybe [ClusterSetting],
UpdateCluster -> Maybe ClusterConfiguration
configuration :: Prelude.Maybe ClusterConfiguration,
UpdateCluster -> Text
cluster :: Prelude.Text
}
deriving (UpdateCluster -> UpdateCluster -> Bool
(UpdateCluster -> UpdateCluster -> Bool)
-> (UpdateCluster -> UpdateCluster -> Bool) -> Eq UpdateCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCluster -> UpdateCluster -> Bool
$c/= :: UpdateCluster -> UpdateCluster -> Bool
== :: UpdateCluster -> UpdateCluster -> Bool
$c== :: UpdateCluster -> UpdateCluster -> Bool
Prelude.Eq, ReadPrec [UpdateCluster]
ReadPrec UpdateCluster
Int -> ReadS UpdateCluster
ReadS [UpdateCluster]
(Int -> ReadS UpdateCluster)
-> ReadS [UpdateCluster]
-> ReadPrec UpdateCluster
-> ReadPrec [UpdateCluster]
-> Read UpdateCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCluster]
$creadListPrec :: ReadPrec [UpdateCluster]
readPrec :: ReadPrec UpdateCluster
$creadPrec :: ReadPrec UpdateCluster
readList :: ReadS [UpdateCluster]
$creadList :: ReadS [UpdateCluster]
readsPrec :: Int -> ReadS UpdateCluster
$creadsPrec :: Int -> ReadS UpdateCluster
Prelude.Read, Int -> UpdateCluster -> ShowS
[UpdateCluster] -> ShowS
UpdateCluster -> String
(Int -> UpdateCluster -> ShowS)
-> (UpdateCluster -> String)
-> ([UpdateCluster] -> ShowS)
-> Show UpdateCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCluster] -> ShowS
$cshowList :: [UpdateCluster] -> ShowS
show :: UpdateCluster -> String
$cshow :: UpdateCluster -> String
showsPrec :: Int -> UpdateCluster -> ShowS
$cshowsPrec :: Int -> UpdateCluster -> ShowS
Prelude.Show, (forall x. UpdateCluster -> Rep UpdateCluster x)
-> (forall x. Rep UpdateCluster x -> UpdateCluster)
-> Generic UpdateCluster
forall x. Rep UpdateCluster x -> UpdateCluster
forall x. UpdateCluster -> Rep UpdateCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCluster x -> UpdateCluster
$cfrom :: forall x. UpdateCluster -> Rep UpdateCluster x
Prelude.Generic)
newUpdateCluster ::
Prelude.Text ->
UpdateCluster
newUpdateCluster :: Text -> UpdateCluster
newUpdateCluster Text
pCluster_ =
UpdateCluster' :: Maybe [ClusterSetting]
-> Maybe ClusterConfiguration -> Text -> UpdateCluster
UpdateCluster'
{ $sel:settings:UpdateCluster' :: Maybe [ClusterSetting]
settings = Maybe [ClusterSetting]
forall a. Maybe a
Prelude.Nothing,
$sel:configuration:UpdateCluster' :: Maybe ClusterConfiguration
configuration = Maybe ClusterConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:cluster:UpdateCluster' :: Text
cluster = Text
pCluster_
}
updateCluster_settings :: Lens.Lens' UpdateCluster (Prelude.Maybe [ClusterSetting])
updateCluster_settings :: (Maybe [ClusterSetting] -> f (Maybe [ClusterSetting]))
-> UpdateCluster -> f UpdateCluster
updateCluster_settings = (UpdateCluster -> Maybe [ClusterSetting])
-> (UpdateCluster -> Maybe [ClusterSetting] -> UpdateCluster)
-> Lens
UpdateCluster
UpdateCluster
(Maybe [ClusterSetting])
(Maybe [ClusterSetting])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe [ClusterSetting]
settings :: Maybe [ClusterSetting]
$sel:settings:UpdateCluster' :: UpdateCluster -> Maybe [ClusterSetting]
settings} -> Maybe [ClusterSetting]
settings) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe [ClusterSetting]
a -> UpdateCluster
s {$sel:settings:UpdateCluster' :: Maybe [ClusterSetting]
settings = Maybe [ClusterSetting]
a} :: UpdateCluster) ((Maybe [ClusterSetting] -> f (Maybe [ClusterSetting]))
-> UpdateCluster -> f UpdateCluster)
-> ((Maybe [ClusterSetting] -> f (Maybe [ClusterSetting]))
-> Maybe [ClusterSetting] -> f (Maybe [ClusterSetting]))
-> (Maybe [ClusterSetting] -> f (Maybe [ClusterSetting]))
-> UpdateCluster
-> f UpdateCluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ClusterSetting] [ClusterSetting] [ClusterSetting] [ClusterSetting]
-> Iso
(Maybe [ClusterSetting])
(Maybe [ClusterSetting])
(Maybe [ClusterSetting])
(Maybe [ClusterSetting])
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
[ClusterSetting] [ClusterSetting] [ClusterSetting] [ClusterSetting]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateCluster_configuration :: Lens.Lens' UpdateCluster (Prelude.Maybe ClusterConfiguration)
updateCluster_configuration :: (Maybe ClusterConfiguration -> f (Maybe ClusterConfiguration))
-> UpdateCluster -> f UpdateCluster
updateCluster_configuration = (UpdateCluster -> Maybe ClusterConfiguration)
-> (UpdateCluster -> Maybe ClusterConfiguration -> UpdateCluster)
-> Lens
UpdateCluster
UpdateCluster
(Maybe ClusterConfiguration)
(Maybe ClusterConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe ClusterConfiguration
configuration :: Maybe ClusterConfiguration
$sel:configuration:UpdateCluster' :: UpdateCluster -> Maybe ClusterConfiguration
configuration} -> Maybe ClusterConfiguration
configuration) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe ClusterConfiguration
a -> UpdateCluster
s {$sel:configuration:UpdateCluster' :: Maybe ClusterConfiguration
configuration = Maybe ClusterConfiguration
a} :: UpdateCluster)
updateCluster_cluster :: Lens.Lens' UpdateCluster Prelude.Text
updateCluster_cluster :: (Text -> f Text) -> UpdateCluster -> f UpdateCluster
updateCluster_cluster = (UpdateCluster -> Text)
-> (UpdateCluster -> Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Text
cluster :: Text
$sel:cluster:UpdateCluster' :: UpdateCluster -> Text
cluster} -> Text
cluster) (\s :: UpdateCluster
s@UpdateCluster' {} Text
a -> UpdateCluster
s {$sel:cluster:UpdateCluster' :: Text
cluster = Text
a} :: UpdateCluster)
instance Core.AWSRequest UpdateCluster where
type
AWSResponse UpdateCluster =
UpdateClusterResponse
request :: UpdateCluster -> Request UpdateCluster
request = Service -> UpdateCluster -> Request UpdateCluster
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateCluster)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateCluster))
-> Logger
-> Service
-> Proxy UpdateCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateCluster)))
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 Cluster -> Int -> UpdateClusterResponse
UpdateClusterResponse'
(Maybe Cluster -> Int -> UpdateClusterResponse)
-> Either String (Maybe Cluster)
-> Either String (Int -> UpdateClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Cluster)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"cluster")
Either String (Int -> UpdateClusterResponse)
-> Either String Int -> Either String UpdateClusterResponse
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 UpdateCluster
instance Prelude.NFData UpdateCluster
instance Core.ToHeaders UpdateCluster where
toHeaders :: UpdateCluster -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateCluster -> 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.UpdateCluster" ::
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 UpdateCluster where
toJSON :: UpdateCluster -> Value
toJSON UpdateCluster' {Maybe [ClusterSetting]
Maybe ClusterConfiguration
Text
cluster :: Text
configuration :: Maybe ClusterConfiguration
settings :: Maybe [ClusterSetting]
$sel:cluster:UpdateCluster' :: UpdateCluster -> Text
$sel:configuration:UpdateCluster' :: UpdateCluster -> Maybe ClusterConfiguration
$sel:settings:UpdateCluster' :: UpdateCluster -> Maybe [ClusterSetting]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"settings" Text -> [ClusterSetting] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ClusterSetting] -> Pair) -> Maybe [ClusterSetting] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ClusterSetting]
settings,
(Text
"configuration" Text -> ClusterConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ClusterConfiguration -> Pair)
-> Maybe ClusterConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ClusterConfiguration
configuration,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"cluster" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
cluster)
]
)
instance Core.ToPath UpdateCluster where
toPath :: UpdateCluster -> ByteString
toPath = ByteString -> UpdateCluster -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateCluster where
toQuery :: UpdateCluster -> QueryString
toQuery = QueryString -> UpdateCluster -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateClusterResponse = UpdateClusterResponse'
{
UpdateClusterResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
UpdateClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateClusterResponse -> UpdateClusterResponse -> Bool
(UpdateClusterResponse -> UpdateClusterResponse -> Bool)
-> (UpdateClusterResponse -> UpdateClusterResponse -> Bool)
-> Eq UpdateClusterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateClusterResponse -> UpdateClusterResponse -> Bool
$c/= :: UpdateClusterResponse -> UpdateClusterResponse -> Bool
== :: UpdateClusterResponse -> UpdateClusterResponse -> Bool
$c== :: UpdateClusterResponse -> UpdateClusterResponse -> Bool
Prelude.Eq, ReadPrec [UpdateClusterResponse]
ReadPrec UpdateClusterResponse
Int -> ReadS UpdateClusterResponse
ReadS [UpdateClusterResponse]
(Int -> ReadS UpdateClusterResponse)
-> ReadS [UpdateClusterResponse]
-> ReadPrec UpdateClusterResponse
-> ReadPrec [UpdateClusterResponse]
-> Read UpdateClusterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateClusterResponse]
$creadListPrec :: ReadPrec [UpdateClusterResponse]
readPrec :: ReadPrec UpdateClusterResponse
$creadPrec :: ReadPrec UpdateClusterResponse
readList :: ReadS [UpdateClusterResponse]
$creadList :: ReadS [UpdateClusterResponse]
readsPrec :: Int -> ReadS UpdateClusterResponse
$creadsPrec :: Int -> ReadS UpdateClusterResponse
Prelude.Read, Int -> UpdateClusterResponse -> ShowS
[UpdateClusterResponse] -> ShowS
UpdateClusterResponse -> String
(Int -> UpdateClusterResponse -> ShowS)
-> (UpdateClusterResponse -> String)
-> ([UpdateClusterResponse] -> ShowS)
-> Show UpdateClusterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateClusterResponse] -> ShowS
$cshowList :: [UpdateClusterResponse] -> ShowS
show :: UpdateClusterResponse -> String
$cshow :: UpdateClusterResponse -> String
showsPrec :: Int -> UpdateClusterResponse -> ShowS
$cshowsPrec :: Int -> UpdateClusterResponse -> ShowS
Prelude.Show, (forall x. UpdateClusterResponse -> Rep UpdateClusterResponse x)
-> (forall x. Rep UpdateClusterResponse x -> UpdateClusterResponse)
-> Generic UpdateClusterResponse
forall x. Rep UpdateClusterResponse x -> UpdateClusterResponse
forall x. UpdateClusterResponse -> Rep UpdateClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateClusterResponse x -> UpdateClusterResponse
$cfrom :: forall x. UpdateClusterResponse -> Rep UpdateClusterResponse x
Prelude.Generic)
newUpdateClusterResponse ::
Prelude.Int ->
UpdateClusterResponse
newUpdateClusterResponse :: Int -> UpdateClusterResponse
newUpdateClusterResponse Int
pHttpStatus_ =
UpdateClusterResponse' :: Maybe Cluster -> Int -> UpdateClusterResponse
UpdateClusterResponse'
{ $sel:cluster:UpdateClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateClusterResponse_cluster :: Lens.Lens' UpdateClusterResponse (Prelude.Maybe Cluster)
updateClusterResponse_cluster :: (Maybe Cluster -> f (Maybe Cluster))
-> UpdateClusterResponse -> f UpdateClusterResponse
updateClusterResponse_cluster = (UpdateClusterResponse -> Maybe Cluster)
-> (UpdateClusterResponse
-> Maybe Cluster -> UpdateClusterResponse)
-> Lens
UpdateClusterResponse
UpdateClusterResponse
(Maybe Cluster)
(Maybe Cluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:UpdateClusterResponse' :: UpdateClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: UpdateClusterResponse
s@UpdateClusterResponse' {} Maybe Cluster
a -> UpdateClusterResponse
s {$sel:cluster:UpdateClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: UpdateClusterResponse)
updateClusterResponse_httpStatus :: Lens.Lens' UpdateClusterResponse Prelude.Int
updateClusterResponse_httpStatus :: (Int -> f Int) -> UpdateClusterResponse -> f UpdateClusterResponse
updateClusterResponse_httpStatus = (UpdateClusterResponse -> Int)
-> (UpdateClusterResponse -> Int -> UpdateClusterResponse)
-> Lens UpdateClusterResponse UpdateClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateClusterResponse' :: UpdateClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateClusterResponse
s@UpdateClusterResponse' {} Int
a -> UpdateClusterResponse
s {$sel:httpStatus:UpdateClusterResponse' :: Int
httpStatus = Int
a} :: UpdateClusterResponse)
instance Prelude.NFData UpdateClusterResponse