{-# 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.GetBranch
(
getBranch
, GetBranch
, gbBranchName
, gbRepositoryName
, getBranchResponse
, GetBranchResponse
, grsBranch
, grsResponseStatus
) 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 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 Hashable GetBranch where
instance NFData GetBranch where
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'
{ _grsBranch :: !(Maybe BranchInfo)
, _grsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBranchResponse
:: Int
-> GetBranchResponse
getBranchResponse pResponseStatus_ =
GetBranchResponse'
{_grsBranch = Nothing, _grsResponseStatus = pResponseStatus_}
grsBranch :: Lens' GetBranchResponse (Maybe BranchInfo)
grsBranch = lens _grsBranch (\ s a -> s{_grsBranch = a})
grsResponseStatus :: Lens' GetBranchResponse Int
grsResponseStatus = lens _grsResponseStatus (\ s a -> s{_grsResponseStatus = a})
instance NFData GetBranchResponse where