{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.ECS.PutAttributes
(
putAttributes
, PutAttributes
, paCluster
, paAttributes
, putAttributesResponse
, PutAttributesResponse
, parsAttributes
, parsResponseStatus
) where
import Network.AWS.ECS.Types
import Network.AWS.ECS.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PutAttributes = PutAttributes'
{ _paCluster :: !(Maybe Text)
, _paAttributes :: ![Attribute]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putAttributes
:: PutAttributes
putAttributes = PutAttributes' {_paCluster = Nothing, _paAttributes = mempty}
paCluster :: Lens' PutAttributes (Maybe Text)
paCluster = lens _paCluster (\ s a -> s{_paCluster = a})
paAttributes :: Lens' PutAttributes [Attribute]
paAttributes = lens _paAttributes (\ s a -> s{_paAttributes = a}) . _Coerce
instance AWSRequest PutAttributes where
type Rs PutAttributes = PutAttributesResponse
request = postJSON ecs
response
= receiveJSON
(\ s h x ->
PutAttributesResponse' <$>
(x .?> "attributes" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable PutAttributes where
instance NFData PutAttributes where
instance ToHeaders PutAttributes where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerServiceV20141113.PutAttributes"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutAttributes where
toJSON PutAttributes'{..}
= object
(catMaybes
[("cluster" .=) <$> _paCluster,
Just ("attributes" .= _paAttributes)])
instance ToPath PutAttributes where
toPath = const "/"
instance ToQuery PutAttributes where
toQuery = const mempty
data PutAttributesResponse = PutAttributesResponse'
{ _parsAttributes :: !(Maybe [Attribute])
, _parsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putAttributesResponse
:: Int
-> PutAttributesResponse
putAttributesResponse pResponseStatus_ =
PutAttributesResponse'
{_parsAttributes = Nothing, _parsResponseStatus = pResponseStatus_}
parsAttributes :: Lens' PutAttributesResponse [Attribute]
parsAttributes = lens _parsAttributes (\ s a -> s{_parsAttributes = a}) . _Default . _Coerce
parsResponseStatus :: Lens' PutAttributesResponse Int
parsResponseStatus = lens _parsResponseStatus (\ s a -> s{_parsResponseStatus = a})
instance NFData PutAttributesResponse where