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