{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CodeCommit.CreateBranch
(
CreateBranch (..),
newCreateBranch,
createBranch_repositoryName,
createBranch_branchName,
createBranch_commitId,
CreateBranchResponse (..),
newCreateBranchResponse,
)
where
import Amazonka.CodeCommit.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateBranch = CreateBranch'
{
CreateBranch -> Text
repositoryName :: Prelude.Text,
CreateBranch -> Text
branchName :: Prelude.Text,
CreateBranch -> Text
commitId :: Prelude.Text
}
deriving (CreateBranch -> CreateBranch -> Bool
(CreateBranch -> CreateBranch -> Bool)
-> (CreateBranch -> CreateBranch -> Bool) -> Eq CreateBranch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBranch -> CreateBranch -> Bool
$c/= :: CreateBranch -> CreateBranch -> Bool
== :: CreateBranch -> CreateBranch -> Bool
$c== :: CreateBranch -> CreateBranch -> Bool
Prelude.Eq, ReadPrec [CreateBranch]
ReadPrec CreateBranch
Int -> ReadS CreateBranch
ReadS [CreateBranch]
(Int -> ReadS CreateBranch)
-> ReadS [CreateBranch]
-> ReadPrec CreateBranch
-> ReadPrec [CreateBranch]
-> Read CreateBranch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBranch]
$creadListPrec :: ReadPrec [CreateBranch]
readPrec :: ReadPrec CreateBranch
$creadPrec :: ReadPrec CreateBranch
readList :: ReadS [CreateBranch]
$creadList :: ReadS [CreateBranch]
readsPrec :: Int -> ReadS CreateBranch
$creadsPrec :: Int -> ReadS CreateBranch
Prelude.Read, Int -> CreateBranch -> ShowS
[CreateBranch] -> ShowS
CreateBranch -> String
(Int -> CreateBranch -> ShowS)
-> (CreateBranch -> String)
-> ([CreateBranch] -> ShowS)
-> Show CreateBranch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBranch] -> ShowS
$cshowList :: [CreateBranch] -> ShowS
show :: CreateBranch -> String
$cshow :: CreateBranch -> String
showsPrec :: Int -> CreateBranch -> ShowS
$cshowsPrec :: Int -> CreateBranch -> ShowS
Prelude.Show, (forall x. CreateBranch -> Rep CreateBranch x)
-> (forall x. Rep CreateBranch x -> CreateBranch)
-> Generic CreateBranch
forall x. Rep CreateBranch x -> CreateBranch
forall x. CreateBranch -> Rep CreateBranch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBranch x -> CreateBranch
$cfrom :: forall x. CreateBranch -> Rep CreateBranch x
Prelude.Generic)
newCreateBranch ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateBranch
newCreateBranch :: Text -> Text -> Text -> CreateBranch
newCreateBranch
Text
pRepositoryName_
Text
pBranchName_
Text
pCommitId_ =
CreateBranch' :: Text -> Text -> Text -> CreateBranch
CreateBranch'
{ $sel:repositoryName:CreateBranch' :: Text
repositoryName = Text
pRepositoryName_,
$sel:branchName:CreateBranch' :: Text
branchName = Text
pBranchName_,
$sel:commitId:CreateBranch' :: Text
commitId = Text
pCommitId_
}
createBranch_repositoryName :: Lens.Lens' CreateBranch Prelude.Text
createBranch_repositoryName :: (Text -> f Text) -> CreateBranch -> f CreateBranch
createBranch_repositoryName = (CreateBranch -> Text)
-> (CreateBranch -> Text -> CreateBranch)
-> Lens CreateBranch CreateBranch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBranch' {Text
repositoryName :: Text
$sel:repositoryName:CreateBranch' :: CreateBranch -> Text
repositoryName} -> Text
repositoryName) (\s :: CreateBranch
s@CreateBranch' {} Text
a -> CreateBranch
s {$sel:repositoryName:CreateBranch' :: Text
repositoryName = Text
a} :: CreateBranch)
createBranch_branchName :: Lens.Lens' CreateBranch Prelude.Text
createBranch_branchName :: (Text -> f Text) -> CreateBranch -> f CreateBranch
createBranch_branchName = (CreateBranch -> Text)
-> (CreateBranch -> Text -> CreateBranch)
-> Lens CreateBranch CreateBranch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBranch' {Text
branchName :: Text
$sel:branchName:CreateBranch' :: CreateBranch -> Text
branchName} -> Text
branchName) (\s :: CreateBranch
s@CreateBranch' {} Text
a -> CreateBranch
s {$sel:branchName:CreateBranch' :: Text
branchName = Text
a} :: CreateBranch)
createBranch_commitId :: Lens.Lens' CreateBranch Prelude.Text
createBranch_commitId :: (Text -> f Text) -> CreateBranch -> f CreateBranch
createBranch_commitId = (CreateBranch -> Text)
-> (CreateBranch -> Text -> CreateBranch)
-> Lens CreateBranch CreateBranch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBranch' {Text
commitId :: Text
$sel:commitId:CreateBranch' :: CreateBranch -> Text
commitId} -> Text
commitId) (\s :: CreateBranch
s@CreateBranch' {} Text
a -> CreateBranch
s {$sel:commitId:CreateBranch' :: Text
commitId = Text
a} :: CreateBranch)
instance Core.AWSRequest CreateBranch where
type AWSResponse CreateBranch = CreateBranchResponse
request :: CreateBranch -> Request CreateBranch
request = Service -> CreateBranch -> Request CreateBranch
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateBranch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBranch)))
response = AWSResponse CreateBranch
-> Logger
-> Service
-> Proxy CreateBranch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBranch)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse CreateBranch
CreateBranchResponse
CreateBranchResponse'
instance Prelude.Hashable CreateBranch
instance Prelude.NFData CreateBranch
instance Core.ToHeaders CreateBranch where
toHeaders :: CreateBranch -> [Header]
toHeaders =
[Header] -> CreateBranch -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"CodeCommit_20150413.CreateBranch" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateBranch where
toJSON :: CreateBranch -> Value
toJSON CreateBranch' {Text
commitId :: Text
branchName :: Text
repositoryName :: Text
$sel:commitId:CreateBranch' :: CreateBranch -> Text
$sel:branchName:CreateBranch' :: CreateBranch -> Text
$sel:repositoryName:CreateBranch' :: CreateBranch -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"branchName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
branchName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"commitId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
commitId)
]
)
instance Core.ToPath CreateBranch where
toPath :: CreateBranch -> ByteString
toPath = ByteString -> CreateBranch -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateBranch where
toQuery :: CreateBranch -> QueryString
toQuery = QueryString -> CreateBranch -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateBranchResponse = CreateBranchResponse'
{
}
deriving (CreateBranchResponse -> CreateBranchResponse -> Bool
(CreateBranchResponse -> CreateBranchResponse -> Bool)
-> (CreateBranchResponse -> CreateBranchResponse -> Bool)
-> Eq CreateBranchResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBranchResponse -> CreateBranchResponse -> Bool
$c/= :: CreateBranchResponse -> CreateBranchResponse -> Bool
== :: CreateBranchResponse -> CreateBranchResponse -> Bool
$c== :: CreateBranchResponse -> CreateBranchResponse -> Bool
Prelude.Eq, ReadPrec [CreateBranchResponse]
ReadPrec CreateBranchResponse
Int -> ReadS CreateBranchResponse
ReadS [CreateBranchResponse]
(Int -> ReadS CreateBranchResponse)
-> ReadS [CreateBranchResponse]
-> ReadPrec CreateBranchResponse
-> ReadPrec [CreateBranchResponse]
-> Read CreateBranchResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBranchResponse]
$creadListPrec :: ReadPrec [CreateBranchResponse]
readPrec :: ReadPrec CreateBranchResponse
$creadPrec :: ReadPrec CreateBranchResponse
readList :: ReadS [CreateBranchResponse]
$creadList :: ReadS [CreateBranchResponse]
readsPrec :: Int -> ReadS CreateBranchResponse
$creadsPrec :: Int -> ReadS CreateBranchResponse
Prelude.Read, Int -> CreateBranchResponse -> ShowS
[CreateBranchResponse] -> ShowS
CreateBranchResponse -> String
(Int -> CreateBranchResponse -> ShowS)
-> (CreateBranchResponse -> String)
-> ([CreateBranchResponse] -> ShowS)
-> Show CreateBranchResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBranchResponse] -> ShowS
$cshowList :: [CreateBranchResponse] -> ShowS
show :: CreateBranchResponse -> String
$cshow :: CreateBranchResponse -> String
showsPrec :: Int -> CreateBranchResponse -> ShowS
$cshowsPrec :: Int -> CreateBranchResponse -> ShowS
Prelude.Show, (forall x. CreateBranchResponse -> Rep CreateBranchResponse x)
-> (forall x. Rep CreateBranchResponse x -> CreateBranchResponse)
-> Generic CreateBranchResponse
forall x. Rep CreateBranchResponse x -> CreateBranchResponse
forall x. CreateBranchResponse -> Rep CreateBranchResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBranchResponse x -> CreateBranchResponse
$cfrom :: forall x. CreateBranchResponse -> Rep CreateBranchResponse x
Prelude.Generic)
newCreateBranchResponse ::
CreateBranchResponse
newCreateBranchResponse :: CreateBranchResponse
newCreateBranchResponse = CreateBranchResponse
CreateBranchResponse'
instance Prelude.NFData CreateBranchResponse