{-# 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.GetCommentsForComparedCommit
(
getCommentsForComparedCommit
, GetCommentsForComparedCommit
, gcfccNextToken
, gcfccBeforeCommitId
, gcfccMaxResults
, gcfccRepositoryName
, gcfccAfterCommitId
, getCommentsForComparedCommitResponse
, GetCommentsForComparedCommitResponse
, gcfccrsCommentsForComparedCommitData
, gcfccrsNextToken
, gcfccrsResponseStatus
) where
import Network.AWS.CodeCommit.Types
import Network.AWS.CodeCommit.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetCommentsForComparedCommit = GetCommentsForComparedCommit'
{ _gcfccNextToken :: !(Maybe Text)
, _gcfccBeforeCommitId :: !(Maybe Text)
, _gcfccMaxResults :: !(Maybe Int)
, _gcfccRepositoryName :: !Text
, _gcfccAfterCommitId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getCommentsForComparedCommit
:: Text
-> Text
-> GetCommentsForComparedCommit
getCommentsForComparedCommit pRepositoryName_ pAfterCommitId_ =
GetCommentsForComparedCommit'
{ _gcfccNextToken = Nothing
, _gcfccBeforeCommitId = Nothing
, _gcfccMaxResults = Nothing
, _gcfccRepositoryName = pRepositoryName_
, _gcfccAfterCommitId = pAfterCommitId_
}
gcfccNextToken :: Lens' GetCommentsForComparedCommit (Maybe Text)
gcfccNextToken = lens _gcfccNextToken (\ s a -> s{_gcfccNextToken = a})
gcfccBeforeCommitId :: Lens' GetCommentsForComparedCommit (Maybe Text)
gcfccBeforeCommitId = lens _gcfccBeforeCommitId (\ s a -> s{_gcfccBeforeCommitId = a})
gcfccMaxResults :: Lens' GetCommentsForComparedCommit (Maybe Int)
gcfccMaxResults = lens _gcfccMaxResults (\ s a -> s{_gcfccMaxResults = a})
gcfccRepositoryName :: Lens' GetCommentsForComparedCommit Text
gcfccRepositoryName = lens _gcfccRepositoryName (\ s a -> s{_gcfccRepositoryName = a})
gcfccAfterCommitId :: Lens' GetCommentsForComparedCommit Text
gcfccAfterCommitId = lens _gcfccAfterCommitId (\ s a -> s{_gcfccAfterCommitId = a})
instance AWSPager GetCommentsForComparedCommit where
page rq rs
| stop (rs ^. gcfccrsNextToken) = Nothing
| stop (rs ^. gcfccrsCommentsForComparedCommitData) =
Nothing
| otherwise =
Just $ rq & gcfccNextToken .~ rs ^. gcfccrsNextToken
instance AWSRequest GetCommentsForComparedCommit
where
type Rs GetCommentsForComparedCommit =
GetCommentsForComparedCommitResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
GetCommentsForComparedCommitResponse' <$>
(x .?> "commentsForComparedCommitData" .!@ mempty)
<*> (x .?> "nextToken")
<*> (pure (fromEnum s)))
instance Hashable GetCommentsForComparedCommit where
instance NFData GetCommentsForComparedCommit where
instance ToHeaders GetCommentsForComparedCommit where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.GetCommentsForComparedCommit"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetCommentsForComparedCommit where
toJSON GetCommentsForComparedCommit'{..}
= object
(catMaybes
[("nextToken" .=) <$> _gcfccNextToken,
("beforeCommitId" .=) <$> _gcfccBeforeCommitId,
("maxResults" .=) <$> _gcfccMaxResults,
Just ("repositoryName" .= _gcfccRepositoryName),
Just ("afterCommitId" .= _gcfccAfterCommitId)])
instance ToPath GetCommentsForComparedCommit where
toPath = const "/"
instance ToQuery GetCommentsForComparedCommit where
toQuery = const mempty
data GetCommentsForComparedCommitResponse = GetCommentsForComparedCommitResponse'
{ _gcfccrsCommentsForComparedCommitData :: !(Maybe [CommentsForComparedCommit])
, _gcfccrsNextToken :: !(Maybe Text)
, _gcfccrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getCommentsForComparedCommitResponse
:: Int
-> GetCommentsForComparedCommitResponse
getCommentsForComparedCommitResponse pResponseStatus_ =
GetCommentsForComparedCommitResponse'
{ _gcfccrsCommentsForComparedCommitData = Nothing
, _gcfccrsNextToken = Nothing
, _gcfccrsResponseStatus = pResponseStatus_
}
gcfccrsCommentsForComparedCommitData :: Lens' GetCommentsForComparedCommitResponse [CommentsForComparedCommit]
gcfccrsCommentsForComparedCommitData = lens _gcfccrsCommentsForComparedCommitData (\ s a -> s{_gcfccrsCommentsForComparedCommitData = a}) . _Default . _Coerce
gcfccrsNextToken :: Lens' GetCommentsForComparedCommitResponse (Maybe Text)
gcfccrsNextToken = lens _gcfccrsNextToken (\ s a -> s{_gcfccrsNextToken = a})
gcfccrsResponseStatus :: Lens' GetCommentsForComparedCommitResponse Int
gcfccrsResponseStatus = lens _gcfccrsResponseStatus (\ s a -> s{_gcfccrsResponseStatus = a})
instance NFData GetCommentsForComparedCommitResponse
where