{-# 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.CodeStar.TagProject
(
tagProject
, TagProject
, tpId
, tpTags
, tagProjectResponse
, TagProjectResponse
, tprsTags
, tprsResponseStatus
) where
import Network.AWS.CodeStar.Types
import Network.AWS.CodeStar.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data TagProject = TagProject'
{ _tpId :: !Text
, _tpTags :: !(Map Text Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
tagProject
:: Text
-> TagProject
tagProject pId_ = TagProject' {_tpId = pId_, _tpTags = mempty}
tpId :: Lens' TagProject Text
tpId = lens _tpId (\ s a -> s{_tpId = a})
tpTags :: Lens' TagProject (HashMap Text Text)
tpTags = lens _tpTags (\ s a -> s{_tpTags = a}) . _Map
instance AWSRequest TagProject where
type Rs TagProject = TagProjectResponse
request = postJSON codeStar
response
= receiveJSON
(\ s h x ->
TagProjectResponse' <$>
(x .?> "tags" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable TagProject where
instance NFData TagProject where
instance ToHeaders TagProject where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeStar_20170419.TagProject" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON TagProject where
toJSON TagProject'{..}
= object
(catMaybes
[Just ("id" .= _tpId), Just ("tags" .= _tpTags)])
instance ToPath TagProject where
toPath = const "/"
instance ToQuery TagProject where
toQuery = const mempty
data TagProjectResponse = TagProjectResponse'
{ _tprsTags :: !(Maybe (Map Text Text))
, _tprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
tagProjectResponse
:: Int
-> TagProjectResponse
tagProjectResponse pResponseStatus_ =
TagProjectResponse'
{_tprsTags = Nothing, _tprsResponseStatus = pResponseStatus_}
tprsTags :: Lens' TagProjectResponse (HashMap Text Text)
tprsTags = lens _tprsTags (\ s a -> s{_tprsTags = a}) . _Default . _Map
tprsResponseStatus :: Lens' TagProjectResponse Int
tprsResponseStatus = lens _tprsResponseStatus (\ s a -> s{_tprsResponseStatus = a})
instance NFData TagProjectResponse where