{-# 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.CloudTrail.AddTags
(
addTags
, AddTags
, atTagsList
, atResourceId
, addTagsResponse
, AddTagsResponse
, atrsResponseStatus
) where
import Network.AWS.CloudTrail.Types
import Network.AWS.CloudTrail.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data AddTags = AddTags'
{ _atTagsList :: !(Maybe [Tag])
, _atResourceId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
addTags
:: Text
-> AddTags
addTags pResourceId_ =
AddTags'
{ _atTagsList = Nothing
, _atResourceId = pResourceId_
}
atTagsList :: Lens' AddTags [Tag]
atTagsList = lens _atTagsList (\ s a -> s{_atTagsList = a}) . _Default . _Coerce;
atResourceId :: Lens' AddTags Text
atResourceId = lens _atResourceId (\ s a -> s{_atResourceId = a});
instance AWSRequest AddTags where
type Rs AddTags = AddTagsResponse
request = postJSON cloudTrail
response
= receiveEmpty
(\ s h x -> AddTagsResponse' <$> (pure (fromEnum s)))
instance Hashable AddTags
instance NFData AddTags
instance ToHeaders AddTags where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.AddTags"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AddTags where
toJSON AddTags'{..}
= object
(catMaybes
[("TagsList" .=) <$> _atTagsList,
Just ("ResourceId" .= _atResourceId)])
instance ToPath AddTags where
toPath = const "/"
instance ToQuery AddTags where
toQuery = const mempty
newtype AddTagsResponse = AddTagsResponse'
{ _atrsResponseStatus :: Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
addTagsResponse
:: Int
-> AddTagsResponse
addTagsResponse pResponseStatus_ =
AddTagsResponse'
{ _atrsResponseStatus = pResponseStatus_
}
atrsResponseStatus :: Lens' AddTagsResponse Int
atrsResponseStatus = lens _atrsResponseStatus (\ s a -> s{_atrsResponseStatus = a});
instance NFData AddTagsResponse