{-# 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.DeleteBranch
(
DeleteBranch (..),
newDeleteBranch,
deleteBranch_repositoryName,
deleteBranch_branchName,
DeleteBranchResponse (..),
newDeleteBranchResponse,
deleteBranchResponse_deletedBranch,
deleteBranchResponse_httpStatus,
)
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 DeleteBranch = DeleteBranch'
{
DeleteBranch -> Text
repositoryName :: Prelude.Text,
DeleteBranch -> Text
branchName :: Prelude.Text
}
deriving (DeleteBranch -> DeleteBranch -> Bool
(DeleteBranch -> DeleteBranch -> Bool)
-> (DeleteBranch -> DeleteBranch -> Bool) -> Eq DeleteBranch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBranch -> DeleteBranch -> Bool
$c/= :: DeleteBranch -> DeleteBranch -> Bool
== :: DeleteBranch -> DeleteBranch -> Bool
$c== :: DeleteBranch -> DeleteBranch -> Bool
Prelude.Eq, ReadPrec [DeleteBranch]
ReadPrec DeleteBranch
Int -> ReadS DeleteBranch
ReadS [DeleteBranch]
(Int -> ReadS DeleteBranch)
-> ReadS [DeleteBranch]
-> ReadPrec DeleteBranch
-> ReadPrec [DeleteBranch]
-> Read DeleteBranch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBranch]
$creadListPrec :: ReadPrec [DeleteBranch]
readPrec :: ReadPrec DeleteBranch
$creadPrec :: ReadPrec DeleteBranch
readList :: ReadS [DeleteBranch]
$creadList :: ReadS [DeleteBranch]
readsPrec :: Int -> ReadS DeleteBranch
$creadsPrec :: Int -> ReadS DeleteBranch
Prelude.Read, Int -> DeleteBranch -> ShowS
[DeleteBranch] -> ShowS
DeleteBranch -> String
(Int -> DeleteBranch -> ShowS)
-> (DeleteBranch -> String)
-> ([DeleteBranch] -> ShowS)
-> Show DeleteBranch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBranch] -> ShowS
$cshowList :: [DeleteBranch] -> ShowS
show :: DeleteBranch -> String
$cshow :: DeleteBranch -> String
showsPrec :: Int -> DeleteBranch -> ShowS
$cshowsPrec :: Int -> DeleteBranch -> ShowS
Prelude.Show, (forall x. DeleteBranch -> Rep DeleteBranch x)
-> (forall x. Rep DeleteBranch x -> DeleteBranch)
-> Generic DeleteBranch
forall x. Rep DeleteBranch x -> DeleteBranch
forall x. DeleteBranch -> Rep DeleteBranch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBranch x -> DeleteBranch
$cfrom :: forall x. DeleteBranch -> Rep DeleteBranch x
Prelude.Generic)
newDeleteBranch ::
Prelude.Text ->
Prelude.Text ->
DeleteBranch
newDeleteBranch :: Text -> Text -> DeleteBranch
newDeleteBranch Text
pRepositoryName_ Text
pBranchName_ =
DeleteBranch' :: Text -> Text -> DeleteBranch
DeleteBranch'
{ $sel:repositoryName:DeleteBranch' :: Text
repositoryName = Text
pRepositoryName_,
$sel:branchName:DeleteBranch' :: Text
branchName = Text
pBranchName_
}
deleteBranch_repositoryName :: Lens.Lens' DeleteBranch Prelude.Text
deleteBranch_repositoryName :: (Text -> f Text) -> DeleteBranch -> f DeleteBranch
deleteBranch_repositoryName = (DeleteBranch -> Text)
-> (DeleteBranch -> Text -> DeleteBranch)
-> Lens DeleteBranch DeleteBranch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBranch' {Text
repositoryName :: Text
$sel:repositoryName:DeleteBranch' :: DeleteBranch -> Text
repositoryName} -> Text
repositoryName) (\s :: DeleteBranch
s@DeleteBranch' {} Text
a -> DeleteBranch
s {$sel:repositoryName:DeleteBranch' :: Text
repositoryName = Text
a} :: DeleteBranch)
deleteBranch_branchName :: Lens.Lens' DeleteBranch Prelude.Text
deleteBranch_branchName :: (Text -> f Text) -> DeleteBranch -> f DeleteBranch
deleteBranch_branchName = (DeleteBranch -> Text)
-> (DeleteBranch -> Text -> DeleteBranch)
-> Lens DeleteBranch DeleteBranch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBranch' {Text
branchName :: Text
$sel:branchName:DeleteBranch' :: DeleteBranch -> Text
branchName} -> Text
branchName) (\s :: DeleteBranch
s@DeleteBranch' {} Text
a -> DeleteBranch
s {$sel:branchName:DeleteBranch' :: Text
branchName = Text
a} :: DeleteBranch)
instance Core.AWSRequest DeleteBranch where
type AWSResponse DeleteBranch = DeleteBranchResponse
request :: DeleteBranch -> Request DeleteBranch
request = Service -> DeleteBranch -> Request DeleteBranch
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteBranch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBranch)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteBranch))
-> Logger
-> Service
-> Proxy DeleteBranch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBranch)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe BranchInfo -> Int -> DeleteBranchResponse
DeleteBranchResponse'
(Maybe BranchInfo -> Int -> DeleteBranchResponse)
-> Either String (Maybe BranchInfo)
-> Either String (Int -> DeleteBranchResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe BranchInfo)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"deletedBranch")
Either String (Int -> DeleteBranchResponse)
-> Either String Int -> Either String DeleteBranchResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DeleteBranch
instance Prelude.NFData DeleteBranch
instance Core.ToHeaders DeleteBranch where
toHeaders :: DeleteBranch -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteBranch -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeCommit_20150413.DeleteBranch" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DeleteBranch where
toJSON :: DeleteBranch -> Value
toJSON DeleteBranch' {Text
branchName :: Text
repositoryName :: Text
$sel:branchName:DeleteBranch' :: DeleteBranch -> Text
$sel:repositoryName:DeleteBranch' :: DeleteBranch -> 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)
]
)
instance Core.ToPath DeleteBranch where
toPath :: DeleteBranch -> ByteString
toPath = ByteString -> DeleteBranch -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteBranch where
toQuery :: DeleteBranch -> QueryString
toQuery = QueryString -> DeleteBranch -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteBranchResponse = DeleteBranchResponse'
{
DeleteBranchResponse -> Maybe BranchInfo
deletedBranch :: Prelude.Maybe BranchInfo,
DeleteBranchResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteBranchResponse -> DeleteBranchResponse -> Bool
(DeleteBranchResponse -> DeleteBranchResponse -> Bool)
-> (DeleteBranchResponse -> DeleteBranchResponse -> Bool)
-> Eq DeleteBranchResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBranchResponse -> DeleteBranchResponse -> Bool
$c/= :: DeleteBranchResponse -> DeleteBranchResponse -> Bool
== :: DeleteBranchResponse -> DeleteBranchResponse -> Bool
$c== :: DeleteBranchResponse -> DeleteBranchResponse -> Bool
Prelude.Eq, ReadPrec [DeleteBranchResponse]
ReadPrec DeleteBranchResponse
Int -> ReadS DeleteBranchResponse
ReadS [DeleteBranchResponse]
(Int -> ReadS DeleteBranchResponse)
-> ReadS [DeleteBranchResponse]
-> ReadPrec DeleteBranchResponse
-> ReadPrec [DeleteBranchResponse]
-> Read DeleteBranchResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBranchResponse]
$creadListPrec :: ReadPrec [DeleteBranchResponse]
readPrec :: ReadPrec DeleteBranchResponse
$creadPrec :: ReadPrec DeleteBranchResponse
readList :: ReadS [DeleteBranchResponse]
$creadList :: ReadS [DeleteBranchResponse]
readsPrec :: Int -> ReadS DeleteBranchResponse
$creadsPrec :: Int -> ReadS DeleteBranchResponse
Prelude.Read, Int -> DeleteBranchResponse -> ShowS
[DeleteBranchResponse] -> ShowS
DeleteBranchResponse -> String
(Int -> DeleteBranchResponse -> ShowS)
-> (DeleteBranchResponse -> String)
-> ([DeleteBranchResponse] -> ShowS)
-> Show DeleteBranchResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBranchResponse] -> ShowS
$cshowList :: [DeleteBranchResponse] -> ShowS
show :: DeleteBranchResponse -> String
$cshow :: DeleteBranchResponse -> String
showsPrec :: Int -> DeleteBranchResponse -> ShowS
$cshowsPrec :: Int -> DeleteBranchResponse -> ShowS
Prelude.Show, (forall x. DeleteBranchResponse -> Rep DeleteBranchResponse x)
-> (forall x. Rep DeleteBranchResponse x -> DeleteBranchResponse)
-> Generic DeleteBranchResponse
forall x. Rep DeleteBranchResponse x -> DeleteBranchResponse
forall x. DeleteBranchResponse -> Rep DeleteBranchResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBranchResponse x -> DeleteBranchResponse
$cfrom :: forall x. DeleteBranchResponse -> Rep DeleteBranchResponse x
Prelude.Generic)
newDeleteBranchResponse ::
Prelude.Int ->
DeleteBranchResponse
newDeleteBranchResponse :: Int -> DeleteBranchResponse
newDeleteBranchResponse Int
pHttpStatus_ =
DeleteBranchResponse' :: Maybe BranchInfo -> Int -> DeleteBranchResponse
DeleteBranchResponse'
{ $sel:deletedBranch:DeleteBranchResponse' :: Maybe BranchInfo
deletedBranch =
Maybe BranchInfo
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteBranchResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteBranchResponse_deletedBranch :: Lens.Lens' DeleteBranchResponse (Prelude.Maybe BranchInfo)
deleteBranchResponse_deletedBranch :: (Maybe BranchInfo -> f (Maybe BranchInfo))
-> DeleteBranchResponse -> f DeleteBranchResponse
deleteBranchResponse_deletedBranch = (DeleteBranchResponse -> Maybe BranchInfo)
-> (DeleteBranchResponse
-> Maybe BranchInfo -> DeleteBranchResponse)
-> Lens
DeleteBranchResponse
DeleteBranchResponse
(Maybe BranchInfo)
(Maybe BranchInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBranchResponse' {Maybe BranchInfo
deletedBranch :: Maybe BranchInfo
$sel:deletedBranch:DeleteBranchResponse' :: DeleteBranchResponse -> Maybe BranchInfo
deletedBranch} -> Maybe BranchInfo
deletedBranch) (\s :: DeleteBranchResponse
s@DeleteBranchResponse' {} Maybe BranchInfo
a -> DeleteBranchResponse
s {$sel:deletedBranch:DeleteBranchResponse' :: Maybe BranchInfo
deletedBranch = Maybe BranchInfo
a} :: DeleteBranchResponse)
deleteBranchResponse_httpStatus :: Lens.Lens' DeleteBranchResponse Prelude.Int
deleteBranchResponse_httpStatus :: (Int -> f Int) -> DeleteBranchResponse -> f DeleteBranchResponse
deleteBranchResponse_httpStatus = (DeleteBranchResponse -> Int)
-> (DeleteBranchResponse -> Int -> DeleteBranchResponse)
-> Lens DeleteBranchResponse DeleteBranchResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBranchResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteBranchResponse' :: DeleteBranchResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteBranchResponse
s@DeleteBranchResponse' {} Int
a -> DeleteBranchResponse
s {$sel:httpStatus:DeleteBranchResponse' :: Int
httpStatus = Int
a} :: DeleteBranchResponse)
instance Prelude.NFData DeleteBranchResponse