{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types
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
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]
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
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. 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'
{ $sel:cluster:PutAttributes' :: Maybe Text
cluster = forall a. Maybe a
Prelude.Nothing,
$sel:attributes:PutAttributes' :: [Attribute]
attributes = forall a. Monoid a => a
Prelude.mempty
}
putAttributes_cluster :: Lens.Lens' PutAttributes (Prelude.Maybe Prelude.Text)
putAttributes_cluster :: Lens' PutAttributes (Maybe Text)
putAttributes_cluster = 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 :: Lens' PutAttributes [Attribute]
putAttributes_attributes = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: (Service -> Service) -> PutAttributes -> Request PutAttributes
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutAttributes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutAttributes)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Attribute] -> Int -> PutAttributesResponse
PutAttributesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"attributes" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutAttributes where
hashWithSalt :: Int -> PutAttributes -> Int
hashWithSalt Int
_salt PutAttributes' {[Attribute]
Maybe Text
attributes :: [Attribute]
cluster :: Maybe Text
$sel:attributes:PutAttributes' :: PutAttributes -> [Attribute]
$sel:cluster:PutAttributes' :: PutAttributes -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cluster
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Attribute]
attributes
instance Prelude.NFData PutAttributes where
rnf :: PutAttributes -> ()
rnf PutAttributes' {[Attribute]
Maybe Text
attributes :: [Attribute]
cluster :: Maybe Text
$sel:attributes:PutAttributes' :: PutAttributes -> [Attribute]
$sel:cluster:PutAttributes' :: PutAttributes -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cluster
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Attribute]
attributes
instance Data.ToHeaders PutAttributes where
toHeaders :: PutAttributes -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonEC2ContainerServiceV20141113.PutAttributes" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"cluster" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cluster,
forall a. a -> Maybe a
Prelude.Just (Key
"attributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Attribute]
attributes)
]
)
instance Data.ToPath PutAttributes where
toPath :: PutAttributes -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutAttributes where
toQuery :: PutAttributes -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:attributes:PutAttributesResponse' :: Maybe [Attribute]
attributes =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putAttributesResponse_attributes :: Lens.Lens' PutAttributesResponse (Prelude.Maybe [Attribute])
putAttributesResponse_attributes :: Lens' PutAttributesResponse (Maybe [Attribute])
putAttributesResponse_attributes = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' PutAttributesResponse Int
putAttributesResponse_httpStatus = 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 where
rnf :: PutAttributesResponse -> ()
rnf PutAttributesResponse' {Int
Maybe [Attribute]
httpStatus :: Int
attributes :: Maybe [Attribute]
$sel:httpStatus:PutAttributesResponse' :: PutAttributesResponse -> Int
$sel:attributes:PutAttributesResponse' :: PutAttributesResponse -> Maybe [Attribute]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Attribute]
attributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus