module Network.AWS.CodeCommit.GetBranch
(
getBranch
, GetBranch
, gbBranchName
, gbRepositoryName
, getBranchResponse
, GetBranchResponse
, gbrsBranch
, gbrsStatus
) where
import Network.AWS.CodeCommit.Types
import Network.AWS.CodeCommit.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetBranch = GetBranch'
{ _gbBranchName :: !(Maybe Text)
, _gbRepositoryName :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getBranch
:: GetBranch
getBranch =
GetBranch'
{ _gbBranchName = Nothing
, _gbRepositoryName = Nothing
}
gbBranchName :: Lens' GetBranch (Maybe Text)
gbBranchName = lens _gbBranchName (\ s a -> s{_gbBranchName = a});
gbRepositoryName :: Lens' GetBranch (Maybe Text)
gbRepositoryName = lens _gbRepositoryName (\ s a -> s{_gbRepositoryName = a});
instance AWSRequest GetBranch where
type Rs GetBranch = GetBranchResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
GetBranchResponse' <$>
(x .?> "branch") <*> (pure (fromEnum s)))
instance ToHeaders GetBranch where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.GetBranch" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetBranch where
toJSON GetBranch'{..}
= object
(catMaybes
[("branchName" .=) <$> _gbBranchName,
("repositoryName" .=) <$> _gbRepositoryName])
instance ToPath GetBranch where
toPath = const "/"
instance ToQuery GetBranch where
toQuery = const mempty
data GetBranchResponse = GetBranchResponse'
{ _gbrsBranch :: !(Maybe BranchInfo)
, _gbrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getBranchResponse
:: Int
-> GetBranchResponse
getBranchResponse pStatus_ =
GetBranchResponse'
{ _gbrsBranch = Nothing
, _gbrsStatus = pStatus_
}
gbrsBranch :: Lens' GetBranchResponse (Maybe BranchInfo)
gbrsBranch = lens _gbrsBranch (\ s a -> s{_gbrsBranch = a});
gbrsStatus :: Lens' GetBranchResponse Int
gbrsStatus = lens _gbrsStatus (\ s a -> s{_gbrsStatus = a});