{-# 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.DirectConnect.TagResource
(
tagResource
, TagResource
, trResourceARN
, trTags
, tagResourceResponse
, TagResourceResponse
, trrsResponseStatus
) where
import Network.AWS.DirectConnect.Types
import Network.AWS.DirectConnect.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data TagResource = TagResource'
{ _trResourceARN :: !Text
, _trTags :: !(List1 Tag)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
tagResource
:: Text
-> NonEmpty Tag
-> TagResource
tagResource pResourceARN_ pTags_ =
TagResource' {_trResourceARN = pResourceARN_, _trTags = _List1 # pTags_}
trResourceARN :: Lens' TagResource Text
trResourceARN = lens _trResourceARN (\ s a -> s{_trResourceARN = a})
trTags :: Lens' TagResource (NonEmpty Tag)
trTags = lens _trTags (\ s a -> s{_trTags = a}) . _List1
instance AWSRequest TagResource where
type Rs TagResource = TagResourceResponse
request = postJSON directConnect
response
= receiveEmpty
(\ s h x ->
TagResourceResponse' <$> (pure (fromEnum s)))
instance Hashable TagResource where
instance NFData TagResource where
instance ToHeaders TagResource where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OvertureService.TagResource" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON TagResource where
toJSON TagResource'{..}
= object
(catMaybes
[Just ("resourceArn" .= _trResourceARN),
Just ("tags" .= _trTags)])
instance ToPath TagResource where
toPath = const "/"
instance ToQuery TagResource where
toQuery = const mempty
newtype TagResourceResponse = TagResourceResponse'
{ _trrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
tagResourceResponse
:: Int
-> TagResourceResponse
tagResourceResponse pResponseStatus_ =
TagResourceResponse' {_trrsResponseStatus = pResponseStatus_}
trrsResponseStatus :: Lens' TagResourceResponse Int
trrsResponseStatus = lens _trrsResponseStatus (\ s a -> s{_trrsResponseStatus = a})
instance NFData TagResourceResponse where