{-# 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.CreateBranch
(
createBranch
, CreateBranch
, cbRepositoryName
, cbBranchName
, cbCommitId
, createBranchResponse
, CreateBranchResponse
) 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 CreateBranch = CreateBranch'
{ _cbRepositoryName :: !Text
, _cbBranchName :: !Text
, _cbCommitId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createBranch
:: Text
-> Text
-> Text
-> CreateBranch
createBranch pRepositoryName_ pBranchName_ pCommitId_ =
CreateBranch'
{ _cbRepositoryName = pRepositoryName_
, _cbBranchName = pBranchName_
, _cbCommitId = pCommitId_
}
cbRepositoryName :: Lens' CreateBranch Text
cbRepositoryName = lens _cbRepositoryName (\ s a -> s{_cbRepositoryName = a});
cbBranchName :: Lens' CreateBranch Text
cbBranchName = lens _cbBranchName (\ s a -> s{_cbBranchName = a});
cbCommitId :: Lens' CreateBranch Text
cbCommitId = lens _cbCommitId (\ s a -> s{_cbCommitId = a});
instance AWSRequest CreateBranch where
type Rs CreateBranch = CreateBranchResponse
request = postJSON codeCommit
response = receiveNull CreateBranchResponse'
instance Hashable CreateBranch
instance NFData CreateBranch
instance ToHeaders CreateBranch where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.CreateBranch" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateBranch where
toJSON CreateBranch'{..}
= object
(catMaybes
[Just ("repositoryName" .= _cbRepositoryName),
Just ("branchName" .= _cbBranchName),
Just ("commitId" .= _cbCommitId)])
instance ToPath CreateBranch where
toPath = const "/"
instance ToQuery CreateBranch where
toQuery = const mempty
data CreateBranchResponse =
CreateBranchResponse'
deriving (Eq,Read,Show,Data,Typeable,Generic)
createBranchResponse
:: CreateBranchResponse
createBranchResponse = CreateBranchResponse'
instance NFData CreateBranchResponse