module Network.AWS.CodeCommit.GetCommit
(
getCommit
, GetCommit
, gcRepositoryName
, gcCommitId
, getCommitResponse
, GetCommitResponse
, gcrsResponseStatus
, gcrsCommit
) 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 GetCommit = GetCommit'
{ _gcRepositoryName :: !Text
, _gcCommitId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getCommit
:: Text
-> Text
-> GetCommit
getCommit pRepositoryName_ pCommitId_ =
GetCommit'
{ _gcRepositoryName = pRepositoryName_
, _gcCommitId = pCommitId_
}
gcRepositoryName :: Lens' GetCommit Text
gcRepositoryName = lens _gcRepositoryName (\ s a -> s{_gcRepositoryName = a});
gcCommitId :: Lens' GetCommit Text
gcCommitId = lens _gcCommitId (\ s a -> s{_gcCommitId = a});
instance AWSRequest GetCommit where
type Rs GetCommit = GetCommitResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
GetCommitResponse' <$>
(pure (fromEnum s)) <*> (x .:> "commit"))
instance Hashable GetCommit
instance NFData GetCommit
instance ToHeaders GetCommit where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.GetCommit" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetCommit where
toJSON GetCommit'{..}
= object
(catMaybes
[Just ("repositoryName" .= _gcRepositoryName),
Just ("commitId" .= _gcCommitId)])
instance ToPath GetCommit where
toPath = const "/"
instance ToQuery GetCommit where
toQuery = const mempty
data GetCommitResponse = GetCommitResponse'
{ _gcrsResponseStatus :: !Int
, _gcrsCommit :: !Commit
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getCommitResponse
:: Int
-> Commit
-> GetCommitResponse
getCommitResponse pResponseStatus_ pCommit_ =
GetCommitResponse'
{ _gcrsResponseStatus = pResponseStatus_
, _gcrsCommit = pCommit_
}
gcrsResponseStatus :: Lens' GetCommitResponse Int
gcrsResponseStatus = lens _gcrsResponseStatus (\ s a -> s{_gcrsResponseStatus = a});
gcrsCommit :: Lens' GetCommitResponse Commit
gcrsCommit = lens _gcrsCommit (\ s a -> s{_gcrsCommit = a});
instance NFData GetCommitResponse