{-# 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.ResourceGroups.Tag
(
tag
, Tag
, tagARN
, tagTags
, tagResponse
, TagResponse
, tagrsARN
, tagrsTags
, tagrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.ResourceGroups.Types
import Network.AWS.ResourceGroups.Types.Product
import Network.AWS.Response
data Tag = Tag'
{ _tagARN :: !Text
, _tagTags :: !(Map Text Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
tag
:: Text
-> Tag
tag pARN_ = Tag' {_tagARN = pARN_, _tagTags = mempty}
tagARN :: Lens' Tag Text
tagARN = lens _tagARN (\ s a -> s{_tagARN = a})
tagTags :: Lens' Tag (HashMap Text Text)
tagTags = lens _tagTags (\ s a -> s{_tagTags = a}) . _Map
instance AWSRequest Tag where
type Rs Tag = TagResponse
request = putJSON resourceGroups
response
= receiveJSON
(\ s h x ->
TagResponse' <$>
(x .?> "Arn") <*> (x .?> "Tags" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable Tag where
instance NFData Tag where
instance ToHeaders Tag where
toHeaders = const mempty
instance ToJSON Tag where
toJSON Tag'{..}
= object (catMaybes [Just ("Tags" .= _tagTags)])
instance ToPath Tag where
toPath Tag'{..}
= mconcat ["/resources/", toBS _tagARN, "/tags"]
instance ToQuery Tag where
toQuery = const mempty
data TagResponse = TagResponse'
{ _tagrsARN :: !(Maybe Text)
, _tagrsTags :: !(Maybe (Map Text Text))
, _tagrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
tagResponse
:: Int
-> TagResponse
tagResponse pResponseStatus_ =
TagResponse'
{ _tagrsARN = Nothing
, _tagrsTags = Nothing
, _tagrsResponseStatus = pResponseStatus_
}
tagrsARN :: Lens' TagResponse (Maybe Text)
tagrsARN = lens _tagrsARN (\ s a -> s{_tagrsARN = a})
tagrsTags :: Lens' TagResponse (HashMap Text Text)
tagrsTags = lens _tagrsTags (\ s a -> s{_tagrsTags = a}) . _Default . _Map
tagrsResponseStatus :: Lens' TagResponse Int
tagrsResponseStatus = lens _tagrsResponseStatus (\ s a -> s{_tagrsResponseStatus = a})
instance NFData TagResponse where