{-# 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.MachineLearning.AddTags
(
addTags
, AddTags
, atTags
, atResourceId
, atResourceType
, addTagsResponse
, AddTagsResponse
, atrsResourceId
, atrsResourceType
, atrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.MachineLearning.Types
import Network.AWS.MachineLearning.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data AddTags = AddTags'
{ _atTags :: ![Tag]
, _atResourceId :: !Text
, _atResourceType :: !TaggableResourceType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
addTags
:: Text
-> TaggableResourceType
-> AddTags
addTags pResourceId_ pResourceType_ =
AddTags'
{ _atTags = mempty
, _atResourceId = pResourceId_
, _atResourceType = pResourceType_
}
atTags :: Lens' AddTags [Tag]
atTags = lens _atTags (\ s a -> s{_atTags = a}) . _Coerce
atResourceId :: Lens' AddTags Text
atResourceId = lens _atResourceId (\ s a -> s{_atResourceId = a})
atResourceType :: Lens' AddTags TaggableResourceType
atResourceType = lens _atResourceType (\ s a -> s{_atResourceType = a})
instance AWSRequest AddTags where
type Rs AddTags = AddTagsResponse
request = postJSON machineLearning
response
= receiveJSON
(\ s h x ->
AddTagsResponse' <$>
(x .?> "ResourceId") <*> (x .?> "ResourceType") <*>
(pure (fromEnum s)))
instance Hashable AddTags where
instance NFData AddTags where
instance ToHeaders AddTags where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonML_20141212.AddTags" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AddTags where
toJSON AddTags'{..}
= object
(catMaybes
[Just ("Tags" .= _atTags),
Just ("ResourceId" .= _atResourceId),
Just ("ResourceType" .= _atResourceType)])
instance ToPath AddTags where
toPath = const "/"
instance ToQuery AddTags where
toQuery = const mempty
data AddTagsResponse = AddTagsResponse'
{ _atrsResourceId :: !(Maybe Text)
, _atrsResourceType :: !(Maybe TaggableResourceType)
, _atrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
addTagsResponse
:: Int
-> AddTagsResponse
addTagsResponse pResponseStatus_ =
AddTagsResponse'
{ _atrsResourceId = Nothing
, _atrsResourceType = Nothing
, _atrsResponseStatus = pResponseStatus_
}
atrsResourceId :: Lens' AddTagsResponse (Maybe Text)
atrsResourceId = lens _atrsResourceId (\ s a -> s{_atrsResourceId = a})
atrsResourceType :: Lens' AddTagsResponse (Maybe TaggableResourceType)
atrsResourceType = lens _atrsResourceType (\ s a -> s{_atrsResourceType = a})
atrsResponseStatus :: Lens' AddTagsResponse Int
atrsResponseStatus = lens _atrsResponseStatus (\ s a -> s{_atrsResponseStatus = a})
instance NFData AddTagsResponse where