{-# 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.PutAccountSetting
(
PutAccountSetting (..),
newPutAccountSetting,
putAccountSetting_principalArn,
putAccountSetting_name,
putAccountSetting_value,
PutAccountSettingResponse (..),
newPutAccountSettingResponse,
putAccountSettingResponse_setting,
putAccountSettingResponse_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 PutAccountSetting = PutAccountSetting'
{
PutAccountSetting -> Maybe Text
principalArn :: Prelude.Maybe Prelude.Text,
PutAccountSetting -> SettingName
name :: SettingName,
PutAccountSetting -> Text
value :: Prelude.Text
}
deriving (PutAccountSetting -> PutAccountSetting -> Bool
(PutAccountSetting -> PutAccountSetting -> Bool)
-> (PutAccountSetting -> PutAccountSetting -> Bool)
-> Eq PutAccountSetting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAccountSetting -> PutAccountSetting -> Bool
$c/= :: PutAccountSetting -> PutAccountSetting -> Bool
== :: PutAccountSetting -> PutAccountSetting -> Bool
$c== :: PutAccountSetting -> PutAccountSetting -> Bool
Prelude.Eq, ReadPrec [PutAccountSetting]
ReadPrec PutAccountSetting
Int -> ReadS PutAccountSetting
ReadS [PutAccountSetting]
(Int -> ReadS PutAccountSetting)
-> ReadS [PutAccountSetting]
-> ReadPrec PutAccountSetting
-> ReadPrec [PutAccountSetting]
-> Read PutAccountSetting
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAccountSetting]
$creadListPrec :: ReadPrec [PutAccountSetting]
readPrec :: ReadPrec PutAccountSetting
$creadPrec :: ReadPrec PutAccountSetting
readList :: ReadS [PutAccountSetting]
$creadList :: ReadS [PutAccountSetting]
readsPrec :: Int -> ReadS PutAccountSetting
$creadsPrec :: Int -> ReadS PutAccountSetting
Prelude.Read, Int -> PutAccountSetting -> ShowS
[PutAccountSetting] -> ShowS
PutAccountSetting -> String
(Int -> PutAccountSetting -> ShowS)
-> (PutAccountSetting -> String)
-> ([PutAccountSetting] -> ShowS)
-> Show PutAccountSetting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAccountSetting] -> ShowS
$cshowList :: [PutAccountSetting] -> ShowS
show :: PutAccountSetting -> String
$cshow :: PutAccountSetting -> String
showsPrec :: Int -> PutAccountSetting -> ShowS
$cshowsPrec :: Int -> PutAccountSetting -> ShowS
Prelude.Show, (forall x. PutAccountSetting -> Rep PutAccountSetting x)
-> (forall x. Rep PutAccountSetting x -> PutAccountSetting)
-> Generic PutAccountSetting
forall x. Rep PutAccountSetting x -> PutAccountSetting
forall x. PutAccountSetting -> Rep PutAccountSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutAccountSetting x -> PutAccountSetting
$cfrom :: forall x. PutAccountSetting -> Rep PutAccountSetting x
Prelude.Generic)
newPutAccountSetting ::
SettingName ->
Prelude.Text ->
PutAccountSetting
newPutAccountSetting :: SettingName -> Text -> PutAccountSetting
newPutAccountSetting SettingName
pName_ Text
pValue_ =
PutAccountSetting' :: Maybe Text -> SettingName -> Text -> PutAccountSetting
PutAccountSetting'
{ $sel:principalArn:PutAccountSetting' :: Maybe Text
principalArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:PutAccountSetting' :: SettingName
name = SettingName
pName_,
$sel:value:PutAccountSetting' :: Text
value = Text
pValue_
}
putAccountSetting_principalArn :: Lens.Lens' PutAccountSetting (Prelude.Maybe Prelude.Text)
putAccountSetting_principalArn :: (Maybe Text -> f (Maybe Text))
-> PutAccountSetting -> f PutAccountSetting
putAccountSetting_principalArn = (PutAccountSetting -> Maybe Text)
-> (PutAccountSetting -> Maybe Text -> PutAccountSetting)
-> Lens
PutAccountSetting PutAccountSetting (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAccountSetting' {Maybe Text
principalArn :: Maybe Text
$sel:principalArn:PutAccountSetting' :: PutAccountSetting -> Maybe Text
principalArn} -> Maybe Text
principalArn) (\s :: PutAccountSetting
s@PutAccountSetting' {} Maybe Text
a -> PutAccountSetting
s {$sel:principalArn:PutAccountSetting' :: Maybe Text
principalArn = Maybe Text
a} :: PutAccountSetting)
putAccountSetting_name :: Lens.Lens' PutAccountSetting SettingName
putAccountSetting_name :: (SettingName -> f SettingName)
-> PutAccountSetting -> f PutAccountSetting
putAccountSetting_name = (PutAccountSetting -> SettingName)
-> (PutAccountSetting -> SettingName -> PutAccountSetting)
-> Lens PutAccountSetting PutAccountSetting SettingName SettingName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAccountSetting' {SettingName
name :: SettingName
$sel:name:PutAccountSetting' :: PutAccountSetting -> SettingName
name} -> SettingName
name) (\s :: PutAccountSetting
s@PutAccountSetting' {} SettingName
a -> PutAccountSetting
s {$sel:name:PutAccountSetting' :: SettingName
name = SettingName
a} :: PutAccountSetting)
putAccountSetting_value :: Lens.Lens' PutAccountSetting Prelude.Text
putAccountSetting_value :: (Text -> f Text) -> PutAccountSetting -> f PutAccountSetting
putAccountSetting_value = (PutAccountSetting -> Text)
-> (PutAccountSetting -> Text -> PutAccountSetting)
-> Lens PutAccountSetting PutAccountSetting Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAccountSetting' {Text
value :: Text
$sel:value:PutAccountSetting' :: PutAccountSetting -> Text
value} -> Text
value) (\s :: PutAccountSetting
s@PutAccountSetting' {} Text
a -> PutAccountSetting
s {$sel:value:PutAccountSetting' :: Text
value = Text
a} :: PutAccountSetting)
instance Core.AWSRequest PutAccountSetting where
type
AWSResponse PutAccountSetting =
PutAccountSettingResponse
request :: PutAccountSetting -> Request PutAccountSetting
request = Service -> PutAccountSetting -> Request PutAccountSetting
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutAccountSetting
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAccountSetting)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutAccountSetting))
-> Logger
-> Service
-> Proxy PutAccountSetting
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAccountSetting)))
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 Setting -> Int -> PutAccountSettingResponse
PutAccountSettingResponse'
(Maybe Setting -> Int -> PutAccountSettingResponse)
-> Either String (Maybe Setting)
-> Either String (Int -> PutAccountSettingResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Setting)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"setting")
Either String (Int -> PutAccountSettingResponse)
-> Either String Int -> Either String PutAccountSettingResponse
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 PutAccountSetting
instance Prelude.NFData PutAccountSetting
instance Core.ToHeaders PutAccountSetting where
toHeaders :: PutAccountSetting -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutAccountSetting -> 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.PutAccountSetting" ::
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 PutAccountSetting where
toJSON :: PutAccountSetting -> Value
toJSON PutAccountSetting' {Maybe Text
Text
SettingName
value :: Text
name :: SettingName
principalArn :: Maybe Text
$sel:value:PutAccountSetting' :: PutAccountSetting -> Text
$sel:name:PutAccountSetting' :: PutAccountSetting -> SettingName
$sel:principalArn:PutAccountSetting' :: PutAccountSetting -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"principalArn" 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
principalArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> SettingName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SettingName
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
]
)
instance Core.ToPath PutAccountSetting where
toPath :: PutAccountSetting -> ByteString
toPath = ByteString -> PutAccountSetting -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutAccountSetting where
toQuery :: PutAccountSetting -> QueryString
toQuery = QueryString -> PutAccountSetting -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutAccountSettingResponse = PutAccountSettingResponse'
{
PutAccountSettingResponse -> Maybe Setting
setting :: Prelude.Maybe Setting,
PutAccountSettingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutAccountSettingResponse -> PutAccountSettingResponse -> Bool
(PutAccountSettingResponse -> PutAccountSettingResponse -> Bool)
-> (PutAccountSettingResponse -> PutAccountSettingResponse -> Bool)
-> Eq PutAccountSettingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAccountSettingResponse -> PutAccountSettingResponse -> Bool
$c/= :: PutAccountSettingResponse -> PutAccountSettingResponse -> Bool
== :: PutAccountSettingResponse -> PutAccountSettingResponse -> Bool
$c== :: PutAccountSettingResponse -> PutAccountSettingResponse -> Bool
Prelude.Eq, ReadPrec [PutAccountSettingResponse]
ReadPrec PutAccountSettingResponse
Int -> ReadS PutAccountSettingResponse
ReadS [PutAccountSettingResponse]
(Int -> ReadS PutAccountSettingResponse)
-> ReadS [PutAccountSettingResponse]
-> ReadPrec PutAccountSettingResponse
-> ReadPrec [PutAccountSettingResponse]
-> Read PutAccountSettingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAccountSettingResponse]
$creadListPrec :: ReadPrec [PutAccountSettingResponse]
readPrec :: ReadPrec PutAccountSettingResponse
$creadPrec :: ReadPrec PutAccountSettingResponse
readList :: ReadS [PutAccountSettingResponse]
$creadList :: ReadS [PutAccountSettingResponse]
readsPrec :: Int -> ReadS PutAccountSettingResponse
$creadsPrec :: Int -> ReadS PutAccountSettingResponse
Prelude.Read, Int -> PutAccountSettingResponse -> ShowS
[PutAccountSettingResponse] -> ShowS
PutAccountSettingResponse -> String
(Int -> PutAccountSettingResponse -> ShowS)
-> (PutAccountSettingResponse -> String)
-> ([PutAccountSettingResponse] -> ShowS)
-> Show PutAccountSettingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAccountSettingResponse] -> ShowS
$cshowList :: [PutAccountSettingResponse] -> ShowS
show :: PutAccountSettingResponse -> String
$cshow :: PutAccountSettingResponse -> String
showsPrec :: Int -> PutAccountSettingResponse -> ShowS
$cshowsPrec :: Int -> PutAccountSettingResponse -> ShowS
Prelude.Show, (forall x.
PutAccountSettingResponse -> Rep PutAccountSettingResponse x)
-> (forall x.
Rep PutAccountSettingResponse x -> PutAccountSettingResponse)
-> Generic PutAccountSettingResponse
forall x.
Rep PutAccountSettingResponse x -> PutAccountSettingResponse
forall x.
PutAccountSettingResponse -> Rep PutAccountSettingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAccountSettingResponse x -> PutAccountSettingResponse
$cfrom :: forall x.
PutAccountSettingResponse -> Rep PutAccountSettingResponse x
Prelude.Generic)
newPutAccountSettingResponse ::
Prelude.Int ->
PutAccountSettingResponse
newPutAccountSettingResponse :: Int -> PutAccountSettingResponse
newPutAccountSettingResponse Int
pHttpStatus_ =
PutAccountSettingResponse' :: Maybe Setting -> Int -> PutAccountSettingResponse
PutAccountSettingResponse'
{ $sel:setting:PutAccountSettingResponse' :: Maybe Setting
setting =
Maybe Setting
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutAccountSettingResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putAccountSettingResponse_setting :: Lens.Lens' PutAccountSettingResponse (Prelude.Maybe Setting)
putAccountSettingResponse_setting :: (Maybe Setting -> f (Maybe Setting))
-> PutAccountSettingResponse -> f PutAccountSettingResponse
putAccountSettingResponse_setting = (PutAccountSettingResponse -> Maybe Setting)
-> (PutAccountSettingResponse
-> Maybe Setting -> PutAccountSettingResponse)
-> Lens
PutAccountSettingResponse
PutAccountSettingResponse
(Maybe Setting)
(Maybe Setting)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAccountSettingResponse' {Maybe Setting
setting :: Maybe Setting
$sel:setting:PutAccountSettingResponse' :: PutAccountSettingResponse -> Maybe Setting
setting} -> Maybe Setting
setting) (\s :: PutAccountSettingResponse
s@PutAccountSettingResponse' {} Maybe Setting
a -> PutAccountSettingResponse
s {$sel:setting:PutAccountSettingResponse' :: Maybe Setting
setting = Maybe Setting
a} :: PutAccountSettingResponse)
putAccountSettingResponse_httpStatus :: Lens.Lens' PutAccountSettingResponse Prelude.Int
putAccountSettingResponse_httpStatus :: (Int -> f Int)
-> PutAccountSettingResponse -> f PutAccountSettingResponse
putAccountSettingResponse_httpStatus = (PutAccountSettingResponse -> Int)
-> (PutAccountSettingResponse -> Int -> PutAccountSettingResponse)
-> Lens PutAccountSettingResponse PutAccountSettingResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAccountSettingResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAccountSettingResponse' :: PutAccountSettingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutAccountSettingResponse
s@PutAccountSettingResponse' {} Int
a -> PutAccountSettingResponse
s {$sel:httpStatus:PutAccountSettingResponse' :: Int
httpStatus = Int
a} :: PutAccountSettingResponse)
instance Prelude.NFData PutAccountSettingResponse