{-# 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.PutAttributes
(
PutAttributes (..),
newPutAttributes,
putAttributes_cluster,
putAttributes_attributes,
PutAttributesResponse (..),
newPutAttributesResponse,
putAttributesResponse_attributes,
putAttributesResponse_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 PutAttributes = PutAttributes'
{
PutAttributes -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
PutAttributes -> [Attribute]
attributes :: [Attribute]
}
deriving (PutAttributes -> PutAttributes -> Bool
(PutAttributes -> PutAttributes -> Bool)
-> (PutAttributes -> PutAttributes -> Bool) -> Eq PutAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAttributes -> PutAttributes -> Bool
$c/= :: PutAttributes -> PutAttributes -> Bool
== :: PutAttributes -> PutAttributes -> Bool
$c== :: PutAttributes -> PutAttributes -> Bool
Prelude.Eq, ReadPrec [PutAttributes]
ReadPrec PutAttributes
Int -> ReadS PutAttributes
ReadS [PutAttributes]
(Int -> ReadS PutAttributes)
-> ReadS [PutAttributes]
-> ReadPrec PutAttributes
-> ReadPrec [PutAttributes]
-> Read PutAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAttributes]
$creadListPrec :: ReadPrec [PutAttributes]
readPrec :: ReadPrec PutAttributes
$creadPrec :: ReadPrec PutAttributes
readList :: ReadS [PutAttributes]
$creadList :: ReadS [PutAttributes]
readsPrec :: Int -> ReadS PutAttributes
$creadsPrec :: Int -> ReadS PutAttributes
Prelude.Read, Int -> PutAttributes -> ShowS
[PutAttributes] -> ShowS
PutAttributes -> String
(Int -> PutAttributes -> ShowS)
-> (PutAttributes -> String)
-> ([PutAttributes] -> ShowS)
-> Show PutAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAttributes] -> ShowS
$cshowList :: [PutAttributes] -> ShowS
show :: PutAttributes -> String
$cshow :: PutAttributes -> String
showsPrec :: Int -> PutAttributes -> ShowS
$cshowsPrec :: Int -> PutAttributes -> ShowS
Prelude.Show, (forall x. PutAttributes -> Rep PutAttributes x)
-> (forall x. Rep PutAttributes x -> PutAttributes)
-> Generic PutAttributes
forall x. Rep PutAttributes x -> PutAttributes
forall x. PutAttributes -> Rep PutAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutAttributes x -> PutAttributes
$cfrom :: forall x. PutAttributes -> Rep PutAttributes x
Prelude.Generic)
newPutAttributes ::
PutAttributes
newPutAttributes :: PutAttributes
newPutAttributes =
PutAttributes' :: Maybe Text -> [Attribute] -> PutAttributes
PutAttributes'
{ $sel:cluster:PutAttributes' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:attributes:PutAttributes' :: [Attribute]
attributes = [Attribute]
forall a. Monoid a => a
Prelude.mempty
}
putAttributes_cluster :: Lens.Lens' PutAttributes (Prelude.Maybe Prelude.Text)
putAttributes_cluster :: (Maybe Text -> f (Maybe Text)) -> PutAttributes -> f PutAttributes
putAttributes_cluster = (PutAttributes -> Maybe Text)
-> (PutAttributes -> Maybe Text -> PutAttributes)
-> Lens PutAttributes PutAttributes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAttributes' {Maybe Text
cluster :: Maybe Text
$sel:cluster:PutAttributes' :: PutAttributes -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: PutAttributes
s@PutAttributes' {} Maybe Text
a -> PutAttributes
s {$sel:cluster:PutAttributes' :: Maybe Text
cluster = Maybe Text
a} :: PutAttributes)
putAttributes_attributes :: Lens.Lens' PutAttributes [Attribute]
putAttributes_attributes :: ([Attribute] -> f [Attribute]) -> PutAttributes -> f PutAttributes
putAttributes_attributes = (PutAttributes -> [Attribute])
-> (PutAttributes -> [Attribute] -> PutAttributes)
-> Lens PutAttributes PutAttributes [Attribute] [Attribute]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAttributes' {[Attribute]
attributes :: [Attribute]
$sel:attributes:PutAttributes' :: PutAttributes -> [Attribute]
attributes} -> [Attribute]
attributes) (\s :: PutAttributes
s@PutAttributes' {} [Attribute]
a -> PutAttributes
s {$sel:attributes:PutAttributes' :: [Attribute]
attributes = [Attribute]
a} :: PutAttributes) (([Attribute] -> f [Attribute])
-> PutAttributes -> f PutAttributes)
-> (([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute])
-> ([Attribute] -> f [Attribute])
-> PutAttributes
-> f PutAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest PutAttributes where
type
AWSResponse PutAttributes =
PutAttributesResponse
request :: PutAttributes -> Request PutAttributes
request = Service -> PutAttributes -> Request PutAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutAttributes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutAttributes)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutAttributes))
-> Logger
-> Service
-> Proxy PutAttributes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutAttributes)))
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 [Attribute] -> Int -> PutAttributesResponse
PutAttributesResponse'
(Maybe [Attribute] -> Int -> PutAttributesResponse)
-> Either String (Maybe [Attribute])
-> Either String (Int -> PutAttributesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Attribute]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"attributes" Either String (Maybe (Maybe [Attribute]))
-> Maybe [Attribute] -> Either String (Maybe [Attribute])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Attribute]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> PutAttributesResponse)
-> Either String Int -> Either String PutAttributesResponse
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 PutAttributes
instance Prelude.NFData PutAttributes
instance Core.ToHeaders PutAttributes where
toHeaders :: PutAttributes -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutAttributes -> 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.PutAttributes" ::
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 PutAttributes where
toJSON :: PutAttributes -> Value
toJSON PutAttributes' {[Attribute]
Maybe Text
attributes :: [Attribute]
cluster :: Maybe Text
$sel:attributes:PutAttributes' :: PutAttributes -> [Attribute]
$sel:cluster:PutAttributes' :: PutAttributes -> 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
"attributes" Text -> [Attribute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Attribute]
attributes)
]
)
instance Core.ToPath PutAttributes where
toPath :: PutAttributes -> ByteString
toPath = ByteString -> PutAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutAttributes where
toQuery :: PutAttributes -> QueryString
toQuery = QueryString -> PutAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutAttributesResponse = PutAttributesResponse'
{
PutAttributesResponse -> Maybe [Attribute]
attributes :: Prelude.Maybe [Attribute],
PutAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutAttributesResponse -> PutAttributesResponse -> Bool
(PutAttributesResponse -> PutAttributesResponse -> Bool)
-> (PutAttributesResponse -> PutAttributesResponse -> Bool)
-> Eq PutAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAttributesResponse -> PutAttributesResponse -> Bool
$c/= :: PutAttributesResponse -> PutAttributesResponse -> Bool
== :: PutAttributesResponse -> PutAttributesResponse -> Bool
$c== :: PutAttributesResponse -> PutAttributesResponse -> Bool
Prelude.Eq, ReadPrec [PutAttributesResponse]
ReadPrec PutAttributesResponse
Int -> ReadS PutAttributesResponse
ReadS [PutAttributesResponse]
(Int -> ReadS PutAttributesResponse)
-> ReadS [PutAttributesResponse]
-> ReadPrec PutAttributesResponse
-> ReadPrec [PutAttributesResponse]
-> Read PutAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAttributesResponse]
$creadListPrec :: ReadPrec [PutAttributesResponse]
readPrec :: ReadPrec PutAttributesResponse
$creadPrec :: ReadPrec PutAttributesResponse
readList :: ReadS [PutAttributesResponse]
$creadList :: ReadS [PutAttributesResponse]
readsPrec :: Int -> ReadS PutAttributesResponse
$creadsPrec :: Int -> ReadS PutAttributesResponse
Prelude.Read, Int -> PutAttributesResponse -> ShowS
[PutAttributesResponse] -> ShowS
PutAttributesResponse -> String
(Int -> PutAttributesResponse -> ShowS)
-> (PutAttributesResponse -> String)
-> ([PutAttributesResponse] -> ShowS)
-> Show PutAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAttributesResponse] -> ShowS
$cshowList :: [PutAttributesResponse] -> ShowS
show :: PutAttributesResponse -> String
$cshow :: PutAttributesResponse -> String
showsPrec :: Int -> PutAttributesResponse -> ShowS
$cshowsPrec :: Int -> PutAttributesResponse -> ShowS
Prelude.Show, (forall x. PutAttributesResponse -> Rep PutAttributesResponse x)
-> (forall x. Rep PutAttributesResponse x -> PutAttributesResponse)
-> Generic PutAttributesResponse
forall x. Rep PutAttributesResponse x -> PutAttributesResponse
forall x. PutAttributesResponse -> Rep PutAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutAttributesResponse x -> PutAttributesResponse
$cfrom :: forall x. PutAttributesResponse -> Rep PutAttributesResponse x
Prelude.Generic)
newPutAttributesResponse ::
Prelude.Int ->
PutAttributesResponse
newPutAttributesResponse :: Int -> PutAttributesResponse
newPutAttributesResponse Int
pHttpStatus_ =
PutAttributesResponse' :: Maybe [Attribute] -> Int -> PutAttributesResponse
PutAttributesResponse'
{ $sel:attributes:PutAttributesResponse' :: Maybe [Attribute]
attributes =
Maybe [Attribute]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putAttributesResponse_attributes :: Lens.Lens' PutAttributesResponse (Prelude.Maybe [Attribute])
putAttributesResponse_attributes :: (Maybe [Attribute] -> f (Maybe [Attribute]))
-> PutAttributesResponse -> f PutAttributesResponse
putAttributesResponse_attributes = (PutAttributesResponse -> Maybe [Attribute])
-> (PutAttributesResponse
-> Maybe [Attribute] -> PutAttributesResponse)
-> Lens
PutAttributesResponse
PutAttributesResponse
(Maybe [Attribute])
(Maybe [Attribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAttributesResponse' {Maybe [Attribute]
attributes :: Maybe [Attribute]
$sel:attributes:PutAttributesResponse' :: PutAttributesResponse -> Maybe [Attribute]
attributes} -> Maybe [Attribute]
attributes) (\s :: PutAttributesResponse
s@PutAttributesResponse' {} Maybe [Attribute]
a -> PutAttributesResponse
s {$sel:attributes:PutAttributesResponse' :: Maybe [Attribute]
attributes = Maybe [Attribute]
a} :: PutAttributesResponse) ((Maybe [Attribute] -> f (Maybe [Attribute]))
-> PutAttributesResponse -> f PutAttributesResponse)
-> ((Maybe [Attribute] -> f (Maybe [Attribute]))
-> Maybe [Attribute] -> f (Maybe [Attribute]))
-> (Maybe [Attribute] -> f (Maybe [Attribute]))
-> PutAttributesResponse
-> f PutAttributesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Attribute] [Attribute] [Attribute] [Attribute]
-> Iso
(Maybe [Attribute])
(Maybe [Attribute])
(Maybe [Attribute])
(Maybe [Attribute])
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 [Attribute] [Attribute] [Attribute] [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putAttributesResponse_httpStatus :: Lens.Lens' PutAttributesResponse Prelude.Int
putAttributesResponse_httpStatus :: (Int -> f Int) -> PutAttributesResponse -> f PutAttributesResponse
putAttributesResponse_httpStatus = (PutAttributesResponse -> Int)
-> (PutAttributesResponse -> Int -> PutAttributesResponse)
-> Lens PutAttributesResponse PutAttributesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAttributesResponse' :: PutAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutAttributesResponse
s@PutAttributesResponse' {} Int
a -> PutAttributesResponse
s {$sel:httpStatus:PutAttributesResponse' :: Int
httpStatus = Int
a} :: PutAttributesResponse)
instance Prelude.NFData PutAttributesResponse