{-# 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.CodeCommit.GetComment
(
getComment
, GetComment
, gcCommentId
, getCommentResponse
, GetCommentResponse
, getrsComment
, getrsResponseStatus
) where
import Network.AWS.CodeCommit.Types
import Network.AWS.CodeCommit.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetComment = GetComment'
{ _gcCommentId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getComment
:: Text
-> GetComment
getComment pCommentId_ = GetComment' {_gcCommentId = pCommentId_}
gcCommentId :: Lens' GetComment Text
gcCommentId = lens _gcCommentId (\ s a -> s{_gcCommentId = a})
instance AWSRequest GetComment where
type Rs GetComment = GetCommentResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
GetCommentResponse' <$>
(x .?> "comment") <*> (pure (fromEnum s)))
instance Hashable GetComment where
instance NFData GetComment where
instance ToHeaders GetComment where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.GetComment" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetComment where
toJSON GetComment'{..}
= object
(catMaybes [Just ("commentId" .= _gcCommentId)])
instance ToPath GetComment where
toPath = const "/"
instance ToQuery GetComment where
toQuery = const mempty
data GetCommentResponse = GetCommentResponse'
{ _getrsComment :: !(Maybe Comment)
, _getrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getCommentResponse
:: Int
-> GetCommentResponse
getCommentResponse pResponseStatus_ =
GetCommentResponse'
{_getrsComment = Nothing, _getrsResponseStatus = pResponseStatus_}
getrsComment :: Lens' GetCommentResponse (Maybe Comment)
getrsComment = lens _getrsComment (\ s a -> s{_getrsComment = a})
getrsResponseStatus :: Lens' GetCommentResponse Int
getrsResponseStatus = lens _getrsResponseStatus (\ s a -> s{_getrsResponseStatus = a})
instance NFData GetCommentResponse where