{-# 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.UpdateComment
(
updateComment
, UpdateComment
, ucCommentId
, ucContent
, updateCommentResponse
, UpdateCommentResponse
, ucrsComment
, ucrsResponseStatus
) 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
data UpdateComment = UpdateComment'
{ _ucCommentId :: !Text
, _ucContent :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateComment
:: Text
-> Text
-> UpdateComment
updateComment pCommentId_ pContent_ =
UpdateComment' {_ucCommentId = pCommentId_, _ucContent = pContent_}
ucCommentId :: Lens' UpdateComment Text
ucCommentId = lens _ucCommentId (\ s a -> s{_ucCommentId = a})
ucContent :: Lens' UpdateComment Text
ucContent = lens _ucContent (\ s a -> s{_ucContent = a})
instance AWSRequest UpdateComment where
type Rs UpdateComment = UpdateCommentResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
UpdateCommentResponse' <$>
(x .?> "comment") <*> (pure (fromEnum s)))
instance Hashable UpdateComment where
instance NFData UpdateComment where
instance ToHeaders UpdateComment where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.UpdateComment" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateComment where
toJSON UpdateComment'{..}
= object
(catMaybes
[Just ("commentId" .= _ucCommentId),
Just ("content" .= _ucContent)])
instance ToPath UpdateComment where
toPath = const "/"
instance ToQuery UpdateComment where
toQuery = const mempty
data UpdateCommentResponse = UpdateCommentResponse'
{ _ucrsComment :: !(Maybe Comment)
, _ucrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateCommentResponse
:: Int
-> UpdateCommentResponse
updateCommentResponse pResponseStatus_ =
UpdateCommentResponse'
{_ucrsComment = Nothing, _ucrsResponseStatus = pResponseStatus_}
ucrsComment :: Lens' UpdateCommentResponse (Maybe Comment)
ucrsComment = lens _ucrsComment (\ s a -> s{_ucrsComment = a})
ucrsResponseStatus :: Lens' UpdateCommentResponse Int
ucrsResponseStatus = lens _ucrsResponseStatus (\ s a -> s{_ucrsResponseStatus = a})
instance NFData UpdateCommentResponse where