{-# 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.SageMaker.AddTags
(
addTags
, AddTags
, atResourceARN
, atTags
, addTagsResponse
, AddTagsResponse
, atrsTags
, atrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SageMaker.Types
import Network.AWS.SageMaker.Types.Product
data AddTags = AddTags'
{ _atResourceARN :: !Text
, _atTags :: ![Tag]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
addTags
:: Text
-> AddTags
addTags pResourceARN_ =
AddTags' {_atResourceARN = pResourceARN_, _atTags = mempty}
atResourceARN :: Lens' AddTags Text
atResourceARN = lens _atResourceARN (\ s a -> s{_atResourceARN = a})
atTags :: Lens' AddTags [Tag]
atTags = lens _atTags (\ s a -> s{_atTags = a}) . _Coerce
instance AWSRequest AddTags where
type Rs AddTags = AddTagsResponse
request = postJSON sageMaker
response
= receiveJSON
(\ s h x ->
AddTagsResponse' <$>
(x .?> "Tags" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable AddTags where
instance NFData AddTags where
instance ToHeaders AddTags where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("SageMaker.AddTags" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AddTags where
toJSON AddTags'{..}
= object
(catMaybes
[Just ("ResourceArn" .= _atResourceARN),
Just ("Tags" .= _atTags)])
instance ToPath AddTags where
toPath = const "/"
instance ToQuery AddTags where
toQuery = const mempty
data AddTagsResponse = AddTagsResponse'
{ _atrsTags :: !(Maybe [Tag])
, _atrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
addTagsResponse
:: Int
-> AddTagsResponse
addTagsResponse pResponseStatus_ =
AddTagsResponse' {_atrsTags = Nothing, _atrsResponseStatus = pResponseStatus_}
atrsTags :: Lens' AddTagsResponse [Tag]
atrsTags = lens _atrsTags (\ s a -> s{_atrsTags = a}) . _Default . _Coerce
atrsResponseStatus :: Lens' AddTagsResponse Int
atrsResponseStatus = lens _atrsResponseStatus (\ s a -> s{_atrsResponseStatus = a})
instance NFData AddTagsResponse where