{-# 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.CreateCommit
(
CreateCommit (..),
newCreateCommit,
createCommit_setFileModes,
createCommit_email,
createCommit_authorName,
createCommit_parentCommitId,
createCommit_deleteFiles,
createCommit_putFiles,
createCommit_commitMessage,
createCommit_keepEmptyFolders,
createCommit_repositoryName,
createCommit_branchName,
CreateCommitResponse (..),
newCreateCommitResponse,
createCommitResponse_commitId,
createCommitResponse_treeId,
createCommitResponse_filesAdded,
createCommitResponse_filesUpdated,
createCommitResponse_filesDeleted,
createCommitResponse_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 CreateCommit = CreateCommit'
{
CreateCommit -> Maybe [SetFileModeEntry]
setFileModes :: Prelude.Maybe [SetFileModeEntry],
CreateCommit -> Maybe Text
email :: Prelude.Maybe Prelude.Text,
CreateCommit -> Maybe Text
authorName :: Prelude.Maybe Prelude.Text,
CreateCommit -> Maybe Text
parentCommitId :: Prelude.Maybe Prelude.Text,
CreateCommit -> Maybe [DeleteFileEntry]
deleteFiles :: Prelude.Maybe [DeleteFileEntry],
CreateCommit -> Maybe [PutFileEntry]
putFiles :: Prelude.Maybe [PutFileEntry],
CreateCommit -> Maybe Text
commitMessage :: Prelude.Maybe Prelude.Text,
CreateCommit -> Maybe Bool
keepEmptyFolders :: Prelude.Maybe Prelude.Bool,
CreateCommit -> Text
repositoryName :: Prelude.Text,
CreateCommit -> Text
branchName :: Prelude.Text
}
deriving (CreateCommit -> CreateCommit -> Bool
(CreateCommit -> CreateCommit -> Bool)
-> (CreateCommit -> CreateCommit -> Bool) -> Eq CreateCommit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCommit -> CreateCommit -> Bool
$c/= :: CreateCommit -> CreateCommit -> Bool
== :: CreateCommit -> CreateCommit -> Bool
$c== :: CreateCommit -> CreateCommit -> Bool
Prelude.Eq, ReadPrec [CreateCommit]
ReadPrec CreateCommit
Int -> ReadS CreateCommit
ReadS [CreateCommit]
(Int -> ReadS CreateCommit)
-> ReadS [CreateCommit]
-> ReadPrec CreateCommit
-> ReadPrec [CreateCommit]
-> Read CreateCommit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCommit]
$creadListPrec :: ReadPrec [CreateCommit]
readPrec :: ReadPrec CreateCommit
$creadPrec :: ReadPrec CreateCommit
readList :: ReadS [CreateCommit]
$creadList :: ReadS [CreateCommit]
readsPrec :: Int -> ReadS CreateCommit
$creadsPrec :: Int -> ReadS CreateCommit
Prelude.Read, Int -> CreateCommit -> ShowS
[CreateCommit] -> ShowS
CreateCommit -> String
(Int -> CreateCommit -> ShowS)
-> (CreateCommit -> String)
-> ([CreateCommit] -> ShowS)
-> Show CreateCommit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCommit] -> ShowS
$cshowList :: [CreateCommit] -> ShowS
show :: CreateCommit -> String
$cshow :: CreateCommit -> String
showsPrec :: Int -> CreateCommit -> ShowS
$cshowsPrec :: Int -> CreateCommit -> ShowS
Prelude.Show, (forall x. CreateCommit -> Rep CreateCommit x)
-> (forall x. Rep CreateCommit x -> CreateCommit)
-> Generic CreateCommit
forall x. Rep CreateCommit x -> CreateCommit
forall x. CreateCommit -> Rep CreateCommit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCommit x -> CreateCommit
$cfrom :: forall x. CreateCommit -> Rep CreateCommit x
Prelude.Generic)
newCreateCommit ::
Prelude.Text ->
Prelude.Text ->
CreateCommit
newCreateCommit :: Text -> Text -> CreateCommit
newCreateCommit Text
pRepositoryName_ Text
pBranchName_ =
CreateCommit' :: Maybe [SetFileModeEntry]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [DeleteFileEntry]
-> Maybe [PutFileEntry]
-> Maybe Text
-> Maybe Bool
-> Text
-> Text
-> CreateCommit
CreateCommit'
{ $sel:setFileModes:CreateCommit' :: Maybe [SetFileModeEntry]
setFileModes = Maybe [SetFileModeEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:email:CreateCommit' :: Maybe Text
email = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:authorName:CreateCommit' :: Maybe Text
authorName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:parentCommitId:CreateCommit' :: Maybe Text
parentCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:deleteFiles:CreateCommit' :: Maybe [DeleteFileEntry]
deleteFiles = Maybe [DeleteFileEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:putFiles:CreateCommit' :: Maybe [PutFileEntry]
putFiles = Maybe [PutFileEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:commitMessage:CreateCommit' :: Maybe Text
commitMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:keepEmptyFolders:CreateCommit' :: Maybe Bool
keepEmptyFolders = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:repositoryName:CreateCommit' :: Text
repositoryName = Text
pRepositoryName_,
$sel:branchName:CreateCommit' :: Text
branchName = Text
pBranchName_
}
createCommit_setFileModes :: Lens.Lens' CreateCommit (Prelude.Maybe [SetFileModeEntry])
createCommit_setFileModes :: (Maybe [SetFileModeEntry] -> f (Maybe [SetFileModeEntry]))
-> CreateCommit -> f CreateCommit
createCommit_setFileModes = (CreateCommit -> Maybe [SetFileModeEntry])
-> (CreateCommit -> Maybe [SetFileModeEntry] -> CreateCommit)
-> Lens
CreateCommit
CreateCommit
(Maybe [SetFileModeEntry])
(Maybe [SetFileModeEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Maybe [SetFileModeEntry]
setFileModes :: Maybe [SetFileModeEntry]
$sel:setFileModes:CreateCommit' :: CreateCommit -> Maybe [SetFileModeEntry]
setFileModes} -> Maybe [SetFileModeEntry]
setFileModes) (\s :: CreateCommit
s@CreateCommit' {} Maybe [SetFileModeEntry]
a -> CreateCommit
s {$sel:setFileModes:CreateCommit' :: Maybe [SetFileModeEntry]
setFileModes = Maybe [SetFileModeEntry]
a} :: CreateCommit) ((Maybe [SetFileModeEntry] -> f (Maybe [SetFileModeEntry]))
-> CreateCommit -> f CreateCommit)
-> ((Maybe [SetFileModeEntry] -> f (Maybe [SetFileModeEntry]))
-> Maybe [SetFileModeEntry] -> f (Maybe [SetFileModeEntry]))
-> (Maybe [SetFileModeEntry] -> f (Maybe [SetFileModeEntry]))
-> CreateCommit
-> f CreateCommit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[SetFileModeEntry]
[SetFileModeEntry]
[SetFileModeEntry]
[SetFileModeEntry]
-> Iso
(Maybe [SetFileModeEntry])
(Maybe [SetFileModeEntry])
(Maybe [SetFileModeEntry])
(Maybe [SetFileModeEntry])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[SetFileModeEntry]
[SetFileModeEntry]
[SetFileModeEntry]
[SetFileModeEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCommit_email :: Lens.Lens' CreateCommit (Prelude.Maybe Prelude.Text)
createCommit_email :: (Maybe Text -> f (Maybe Text)) -> CreateCommit -> f CreateCommit
createCommit_email = (CreateCommit -> Maybe Text)
-> (CreateCommit -> Maybe Text -> CreateCommit)
-> Lens CreateCommit CreateCommit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Maybe Text
email :: Maybe Text
$sel:email:CreateCommit' :: CreateCommit -> Maybe Text
email} -> Maybe Text
email) (\s :: CreateCommit
s@CreateCommit' {} Maybe Text
a -> CreateCommit
s {$sel:email:CreateCommit' :: Maybe Text
email = Maybe Text
a} :: CreateCommit)
createCommit_authorName :: Lens.Lens' CreateCommit (Prelude.Maybe Prelude.Text)
createCommit_authorName :: (Maybe Text -> f (Maybe Text)) -> CreateCommit -> f CreateCommit
createCommit_authorName = (CreateCommit -> Maybe Text)
-> (CreateCommit -> Maybe Text -> CreateCommit)
-> Lens CreateCommit CreateCommit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Maybe Text
authorName :: Maybe Text
$sel:authorName:CreateCommit' :: CreateCommit -> Maybe Text
authorName} -> Maybe Text
authorName) (\s :: CreateCommit
s@CreateCommit' {} Maybe Text
a -> CreateCommit
s {$sel:authorName:CreateCommit' :: Maybe Text
authorName = Maybe Text
a} :: CreateCommit)
createCommit_parentCommitId :: Lens.Lens' CreateCommit (Prelude.Maybe Prelude.Text)
createCommit_parentCommitId :: (Maybe Text -> f (Maybe Text)) -> CreateCommit -> f CreateCommit
createCommit_parentCommitId = (CreateCommit -> Maybe Text)
-> (CreateCommit -> Maybe Text -> CreateCommit)
-> Lens CreateCommit CreateCommit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Maybe Text
parentCommitId :: Maybe Text
$sel:parentCommitId:CreateCommit' :: CreateCommit -> Maybe Text
parentCommitId} -> Maybe Text
parentCommitId) (\s :: CreateCommit
s@CreateCommit' {} Maybe Text
a -> CreateCommit
s {$sel:parentCommitId:CreateCommit' :: Maybe Text
parentCommitId = Maybe Text
a} :: CreateCommit)
createCommit_deleteFiles :: Lens.Lens' CreateCommit (Prelude.Maybe [DeleteFileEntry])
createCommit_deleteFiles :: (Maybe [DeleteFileEntry] -> f (Maybe [DeleteFileEntry]))
-> CreateCommit -> f CreateCommit
createCommit_deleteFiles = (CreateCommit -> Maybe [DeleteFileEntry])
-> (CreateCommit -> Maybe [DeleteFileEntry] -> CreateCommit)
-> Lens
CreateCommit
CreateCommit
(Maybe [DeleteFileEntry])
(Maybe [DeleteFileEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Maybe [DeleteFileEntry]
deleteFiles :: Maybe [DeleteFileEntry]
$sel:deleteFiles:CreateCommit' :: CreateCommit -> Maybe [DeleteFileEntry]
deleteFiles} -> Maybe [DeleteFileEntry]
deleteFiles) (\s :: CreateCommit
s@CreateCommit' {} Maybe [DeleteFileEntry]
a -> CreateCommit
s {$sel:deleteFiles:CreateCommit' :: Maybe [DeleteFileEntry]
deleteFiles = Maybe [DeleteFileEntry]
a} :: CreateCommit) ((Maybe [DeleteFileEntry] -> f (Maybe [DeleteFileEntry]))
-> CreateCommit -> f CreateCommit)
-> ((Maybe [DeleteFileEntry] -> f (Maybe [DeleteFileEntry]))
-> Maybe [DeleteFileEntry] -> f (Maybe [DeleteFileEntry]))
-> (Maybe [DeleteFileEntry] -> f (Maybe [DeleteFileEntry]))
-> CreateCommit
-> f CreateCommit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DeleteFileEntry]
[DeleteFileEntry]
[DeleteFileEntry]
[DeleteFileEntry]
-> Iso
(Maybe [DeleteFileEntry])
(Maybe [DeleteFileEntry])
(Maybe [DeleteFileEntry])
(Maybe [DeleteFileEntry])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[DeleteFileEntry]
[DeleteFileEntry]
[DeleteFileEntry]
[DeleteFileEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCommit_putFiles :: Lens.Lens' CreateCommit (Prelude.Maybe [PutFileEntry])
createCommit_putFiles :: (Maybe [PutFileEntry] -> f (Maybe [PutFileEntry]))
-> CreateCommit -> f CreateCommit
createCommit_putFiles = (CreateCommit -> Maybe [PutFileEntry])
-> (CreateCommit -> Maybe [PutFileEntry] -> CreateCommit)
-> Lens
CreateCommit
CreateCommit
(Maybe [PutFileEntry])
(Maybe [PutFileEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Maybe [PutFileEntry]
putFiles :: Maybe [PutFileEntry]
$sel:putFiles:CreateCommit' :: CreateCommit -> Maybe [PutFileEntry]
putFiles} -> Maybe [PutFileEntry]
putFiles) (\s :: CreateCommit
s@CreateCommit' {} Maybe [PutFileEntry]
a -> CreateCommit
s {$sel:putFiles:CreateCommit' :: Maybe [PutFileEntry]
putFiles = Maybe [PutFileEntry]
a} :: CreateCommit) ((Maybe [PutFileEntry] -> f (Maybe [PutFileEntry]))
-> CreateCommit -> f CreateCommit)
-> ((Maybe [PutFileEntry] -> f (Maybe [PutFileEntry]))
-> Maybe [PutFileEntry] -> f (Maybe [PutFileEntry]))
-> (Maybe [PutFileEntry] -> f (Maybe [PutFileEntry]))
-> CreateCommit
-> f CreateCommit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PutFileEntry] [PutFileEntry] [PutFileEntry] [PutFileEntry]
-> Iso
(Maybe [PutFileEntry])
(Maybe [PutFileEntry])
(Maybe [PutFileEntry])
(Maybe [PutFileEntry])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [PutFileEntry] [PutFileEntry] [PutFileEntry] [PutFileEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCommit_commitMessage :: Lens.Lens' CreateCommit (Prelude.Maybe Prelude.Text)
createCommit_commitMessage :: (Maybe Text -> f (Maybe Text)) -> CreateCommit -> f CreateCommit
createCommit_commitMessage = (CreateCommit -> Maybe Text)
-> (CreateCommit -> Maybe Text -> CreateCommit)
-> Lens CreateCommit CreateCommit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Maybe Text
commitMessage :: Maybe Text
$sel:commitMessage:CreateCommit' :: CreateCommit -> Maybe Text
commitMessage} -> Maybe Text
commitMessage) (\s :: CreateCommit
s@CreateCommit' {} Maybe Text
a -> CreateCommit
s {$sel:commitMessage:CreateCommit' :: Maybe Text
commitMessage = Maybe Text
a} :: CreateCommit)
createCommit_keepEmptyFolders :: Lens.Lens' CreateCommit (Prelude.Maybe Prelude.Bool)
createCommit_keepEmptyFolders :: (Maybe Bool -> f (Maybe Bool)) -> CreateCommit -> f CreateCommit
createCommit_keepEmptyFolders = (CreateCommit -> Maybe Bool)
-> (CreateCommit -> Maybe Bool -> CreateCommit)
-> Lens CreateCommit CreateCommit (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Maybe Bool
keepEmptyFolders :: Maybe Bool
$sel:keepEmptyFolders:CreateCommit' :: CreateCommit -> Maybe Bool
keepEmptyFolders} -> Maybe Bool
keepEmptyFolders) (\s :: CreateCommit
s@CreateCommit' {} Maybe Bool
a -> CreateCommit
s {$sel:keepEmptyFolders:CreateCommit' :: Maybe Bool
keepEmptyFolders = Maybe Bool
a} :: CreateCommit)
createCommit_repositoryName :: Lens.Lens' CreateCommit Prelude.Text
createCommit_repositoryName :: (Text -> f Text) -> CreateCommit -> f CreateCommit
createCommit_repositoryName = (CreateCommit -> Text)
-> (CreateCommit -> Text -> CreateCommit)
-> Lens CreateCommit CreateCommit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Text
repositoryName :: Text
$sel:repositoryName:CreateCommit' :: CreateCommit -> Text
repositoryName} -> Text
repositoryName) (\s :: CreateCommit
s@CreateCommit' {} Text
a -> CreateCommit
s {$sel:repositoryName:CreateCommit' :: Text
repositoryName = Text
a} :: CreateCommit)
createCommit_branchName :: Lens.Lens' CreateCommit Prelude.Text
createCommit_branchName :: (Text -> f Text) -> CreateCommit -> f CreateCommit
createCommit_branchName = (CreateCommit -> Text)
-> (CreateCommit -> Text -> CreateCommit)
-> Lens CreateCommit CreateCommit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommit' {Text
branchName :: Text
$sel:branchName:CreateCommit' :: CreateCommit -> Text
branchName} -> Text
branchName) (\s :: CreateCommit
s@CreateCommit' {} Text
a -> CreateCommit
s {$sel:branchName:CreateCommit' :: Text
branchName = Text
a} :: CreateCommit)
instance Core.AWSRequest CreateCommit where
type AWSResponse CreateCommit = CreateCommitResponse
request :: CreateCommit -> Request CreateCommit
request = Service -> CreateCommit -> Request CreateCommit
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCommit
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCommit)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateCommit))
-> Logger
-> Service
-> Proxy CreateCommit
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCommit)))
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 Text
-> Maybe Text
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Int
-> CreateCommitResponse
CreateCommitResponse'
(Maybe Text
-> Maybe Text
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Int
-> CreateCommitResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Int
-> CreateCommitResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"commitId")
Either
String
(Maybe Text
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Int
-> CreateCommitResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Int
-> CreateCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"treeId")
Either
String
(Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Int
-> CreateCommitResponse)
-> Either String (Maybe [FileMetadata])
-> Either
String
(Maybe [FileMetadata]
-> Maybe [FileMetadata] -> Int -> CreateCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [FileMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"filesAdded" Either String (Maybe (Maybe [FileMetadata]))
-> Maybe [FileMetadata] -> Either String (Maybe [FileMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [FileMetadata]
forall a. Monoid a => a
Prelude.mempty)
Either
String
(Maybe [FileMetadata]
-> Maybe [FileMetadata] -> Int -> CreateCommitResponse)
-> Either String (Maybe [FileMetadata])
-> Either
String (Maybe [FileMetadata] -> Int -> CreateCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [FileMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"filesUpdated" Either String (Maybe (Maybe [FileMetadata]))
-> Maybe [FileMetadata] -> Either String (Maybe [FileMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [FileMetadata]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe [FileMetadata] -> Int -> CreateCommitResponse)
-> Either String (Maybe [FileMetadata])
-> Either String (Int -> CreateCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [FileMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"filesDeleted" Either String (Maybe (Maybe [FileMetadata]))
-> Maybe [FileMetadata] -> Either String (Maybe [FileMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [FileMetadata]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> CreateCommitResponse)
-> Either String Int -> Either String CreateCommitResponse
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 CreateCommit
instance Prelude.NFData CreateCommit
instance Core.ToHeaders CreateCommit where
toHeaders :: CreateCommit -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateCommit -> 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.CreateCommit" ::
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 CreateCommit where
toJSON :: CreateCommit -> Value
toJSON CreateCommit' {Maybe Bool
Maybe [DeleteFileEntry]
Maybe [SetFileModeEntry]
Maybe [PutFileEntry]
Maybe Text
Text
branchName :: Text
repositoryName :: Text
keepEmptyFolders :: Maybe Bool
commitMessage :: Maybe Text
putFiles :: Maybe [PutFileEntry]
deleteFiles :: Maybe [DeleteFileEntry]
parentCommitId :: Maybe Text
authorName :: Maybe Text
email :: Maybe Text
setFileModes :: Maybe [SetFileModeEntry]
$sel:branchName:CreateCommit' :: CreateCommit -> Text
$sel:repositoryName:CreateCommit' :: CreateCommit -> Text
$sel:keepEmptyFolders:CreateCommit' :: CreateCommit -> Maybe Bool
$sel:commitMessage:CreateCommit' :: CreateCommit -> Maybe Text
$sel:putFiles:CreateCommit' :: CreateCommit -> Maybe [PutFileEntry]
$sel:deleteFiles:CreateCommit' :: CreateCommit -> Maybe [DeleteFileEntry]
$sel:parentCommitId:CreateCommit' :: CreateCommit -> Maybe Text
$sel:authorName:CreateCommit' :: CreateCommit -> Maybe Text
$sel:email:CreateCommit' :: CreateCommit -> Maybe Text
$sel:setFileModes:CreateCommit' :: CreateCommit -> Maybe [SetFileModeEntry]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"setFileModes" Text -> [SetFileModeEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([SetFileModeEntry] -> Pair)
-> Maybe [SetFileModeEntry] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SetFileModeEntry]
setFileModes,
(Text
"email" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
email,
(Text
"authorName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
authorName,
(Text
"parentCommitId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
parentCommitId,
(Text
"deleteFiles" Text -> [DeleteFileEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([DeleteFileEntry] -> Pair)
-> Maybe [DeleteFileEntry] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DeleteFileEntry]
deleteFiles,
(Text
"putFiles" Text -> [PutFileEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([PutFileEntry] -> Pair) -> Maybe [PutFileEntry] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PutFileEntry]
putFiles,
(Text
"commitMessage" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
commitMessage,
(Text
"keepEmptyFolders" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
keepEmptyFolders,
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 CreateCommit where
toPath :: CreateCommit -> ByteString
toPath = ByteString -> CreateCommit -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateCommit where
toQuery :: CreateCommit -> QueryString
toQuery = QueryString -> CreateCommit -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateCommitResponse = CreateCommitResponse'
{
CreateCommitResponse -> Maybe Text
commitId :: Prelude.Maybe Prelude.Text,
CreateCommitResponse -> Maybe Text
treeId :: Prelude.Maybe Prelude.Text,
CreateCommitResponse -> Maybe [FileMetadata]
filesAdded :: Prelude.Maybe [FileMetadata],
CreateCommitResponse -> Maybe [FileMetadata]
filesUpdated :: Prelude.Maybe [FileMetadata],
CreateCommitResponse -> Maybe [FileMetadata]
filesDeleted :: Prelude.Maybe [FileMetadata],
CreateCommitResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCommitResponse -> CreateCommitResponse -> Bool
(CreateCommitResponse -> CreateCommitResponse -> Bool)
-> (CreateCommitResponse -> CreateCommitResponse -> Bool)
-> Eq CreateCommitResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCommitResponse -> CreateCommitResponse -> Bool
$c/= :: CreateCommitResponse -> CreateCommitResponse -> Bool
== :: CreateCommitResponse -> CreateCommitResponse -> Bool
$c== :: CreateCommitResponse -> CreateCommitResponse -> Bool
Prelude.Eq, ReadPrec [CreateCommitResponse]
ReadPrec CreateCommitResponse
Int -> ReadS CreateCommitResponse
ReadS [CreateCommitResponse]
(Int -> ReadS CreateCommitResponse)
-> ReadS [CreateCommitResponse]
-> ReadPrec CreateCommitResponse
-> ReadPrec [CreateCommitResponse]
-> Read CreateCommitResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCommitResponse]
$creadListPrec :: ReadPrec [CreateCommitResponse]
readPrec :: ReadPrec CreateCommitResponse
$creadPrec :: ReadPrec CreateCommitResponse
readList :: ReadS [CreateCommitResponse]
$creadList :: ReadS [CreateCommitResponse]
readsPrec :: Int -> ReadS CreateCommitResponse
$creadsPrec :: Int -> ReadS CreateCommitResponse
Prelude.Read, Int -> CreateCommitResponse -> ShowS
[CreateCommitResponse] -> ShowS
CreateCommitResponse -> String
(Int -> CreateCommitResponse -> ShowS)
-> (CreateCommitResponse -> String)
-> ([CreateCommitResponse] -> ShowS)
-> Show CreateCommitResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCommitResponse] -> ShowS
$cshowList :: [CreateCommitResponse] -> ShowS
show :: CreateCommitResponse -> String
$cshow :: CreateCommitResponse -> String
showsPrec :: Int -> CreateCommitResponse -> ShowS
$cshowsPrec :: Int -> CreateCommitResponse -> ShowS
Prelude.Show, (forall x. CreateCommitResponse -> Rep CreateCommitResponse x)
-> (forall x. Rep CreateCommitResponse x -> CreateCommitResponse)
-> Generic CreateCommitResponse
forall x. Rep CreateCommitResponse x -> CreateCommitResponse
forall x. CreateCommitResponse -> Rep CreateCommitResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCommitResponse x -> CreateCommitResponse
$cfrom :: forall x. CreateCommitResponse -> Rep CreateCommitResponse x
Prelude.Generic)
newCreateCommitResponse ::
Prelude.Int ->
CreateCommitResponse
newCreateCommitResponse :: Int -> CreateCommitResponse
newCreateCommitResponse Int
pHttpStatus_ =
CreateCommitResponse' :: Maybe Text
-> Maybe Text
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Maybe [FileMetadata]
-> Int
-> CreateCommitResponse
CreateCommitResponse'
{ $sel:commitId:CreateCommitResponse' :: Maybe Text
commitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:treeId:CreateCommitResponse' :: Maybe Text
treeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:filesAdded:CreateCommitResponse' :: Maybe [FileMetadata]
filesAdded = Maybe [FileMetadata]
forall a. Maybe a
Prelude.Nothing,
$sel:filesUpdated:CreateCommitResponse' :: Maybe [FileMetadata]
filesUpdated = Maybe [FileMetadata]
forall a. Maybe a
Prelude.Nothing,
$sel:filesDeleted:CreateCommitResponse' :: Maybe [FileMetadata]
filesDeleted = Maybe [FileMetadata]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCommitResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCommitResponse_commitId :: Lens.Lens' CreateCommitResponse (Prelude.Maybe Prelude.Text)
createCommitResponse_commitId :: (Maybe Text -> f (Maybe Text))
-> CreateCommitResponse -> f CreateCommitResponse
createCommitResponse_commitId = (CreateCommitResponse -> Maybe Text)
-> (CreateCommitResponse -> Maybe Text -> CreateCommitResponse)
-> Lens
CreateCommitResponse CreateCommitResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommitResponse' {Maybe Text
commitId :: Maybe Text
$sel:commitId:CreateCommitResponse' :: CreateCommitResponse -> Maybe Text
commitId} -> Maybe Text
commitId) (\s :: CreateCommitResponse
s@CreateCommitResponse' {} Maybe Text
a -> CreateCommitResponse
s {$sel:commitId:CreateCommitResponse' :: Maybe Text
commitId = Maybe Text
a} :: CreateCommitResponse)
createCommitResponse_treeId :: Lens.Lens' CreateCommitResponse (Prelude.Maybe Prelude.Text)
createCommitResponse_treeId :: (Maybe Text -> f (Maybe Text))
-> CreateCommitResponse -> f CreateCommitResponse
createCommitResponse_treeId = (CreateCommitResponse -> Maybe Text)
-> (CreateCommitResponse -> Maybe Text -> CreateCommitResponse)
-> Lens
CreateCommitResponse CreateCommitResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommitResponse' {Maybe Text
treeId :: Maybe Text
$sel:treeId:CreateCommitResponse' :: CreateCommitResponse -> Maybe Text
treeId} -> Maybe Text
treeId) (\s :: CreateCommitResponse
s@CreateCommitResponse' {} Maybe Text
a -> CreateCommitResponse
s {$sel:treeId:CreateCommitResponse' :: Maybe Text
treeId = Maybe Text
a} :: CreateCommitResponse)
createCommitResponse_filesAdded :: Lens.Lens' CreateCommitResponse (Prelude.Maybe [FileMetadata])
createCommitResponse_filesAdded :: (Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse -> f CreateCommitResponse
createCommitResponse_filesAdded = (CreateCommitResponse -> Maybe [FileMetadata])
-> (CreateCommitResponse
-> Maybe [FileMetadata] -> CreateCommitResponse)
-> Lens
CreateCommitResponse
CreateCommitResponse
(Maybe [FileMetadata])
(Maybe [FileMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommitResponse' {Maybe [FileMetadata]
filesAdded :: Maybe [FileMetadata]
$sel:filesAdded:CreateCommitResponse' :: CreateCommitResponse -> Maybe [FileMetadata]
filesAdded} -> Maybe [FileMetadata]
filesAdded) (\s :: CreateCommitResponse
s@CreateCommitResponse' {} Maybe [FileMetadata]
a -> CreateCommitResponse
s {$sel:filesAdded:CreateCommitResponse' :: Maybe [FileMetadata]
filesAdded = Maybe [FileMetadata]
a} :: CreateCommitResponse) ((Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse -> f CreateCommitResponse)
-> ((Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> (Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse
-> f CreateCommitResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [FileMetadata] [FileMetadata] [FileMetadata] [FileMetadata]
-> Iso
(Maybe [FileMetadata])
(Maybe [FileMetadata])
(Maybe [FileMetadata])
(Maybe [FileMetadata])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [FileMetadata] [FileMetadata] [FileMetadata] [FileMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCommitResponse_filesUpdated :: Lens.Lens' CreateCommitResponse (Prelude.Maybe [FileMetadata])
createCommitResponse_filesUpdated :: (Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse -> f CreateCommitResponse
createCommitResponse_filesUpdated = (CreateCommitResponse -> Maybe [FileMetadata])
-> (CreateCommitResponse
-> Maybe [FileMetadata] -> CreateCommitResponse)
-> Lens
CreateCommitResponse
CreateCommitResponse
(Maybe [FileMetadata])
(Maybe [FileMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommitResponse' {Maybe [FileMetadata]
filesUpdated :: Maybe [FileMetadata]
$sel:filesUpdated:CreateCommitResponse' :: CreateCommitResponse -> Maybe [FileMetadata]
filesUpdated} -> Maybe [FileMetadata]
filesUpdated) (\s :: CreateCommitResponse
s@CreateCommitResponse' {} Maybe [FileMetadata]
a -> CreateCommitResponse
s {$sel:filesUpdated:CreateCommitResponse' :: Maybe [FileMetadata]
filesUpdated = Maybe [FileMetadata]
a} :: CreateCommitResponse) ((Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse -> f CreateCommitResponse)
-> ((Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> (Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse
-> f CreateCommitResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [FileMetadata] [FileMetadata] [FileMetadata] [FileMetadata]
-> Iso
(Maybe [FileMetadata])
(Maybe [FileMetadata])
(Maybe [FileMetadata])
(Maybe [FileMetadata])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [FileMetadata] [FileMetadata] [FileMetadata] [FileMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCommitResponse_filesDeleted :: Lens.Lens' CreateCommitResponse (Prelude.Maybe [FileMetadata])
createCommitResponse_filesDeleted :: (Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse -> f CreateCommitResponse
createCommitResponse_filesDeleted = (CreateCommitResponse -> Maybe [FileMetadata])
-> (CreateCommitResponse
-> Maybe [FileMetadata] -> CreateCommitResponse)
-> Lens
CreateCommitResponse
CreateCommitResponse
(Maybe [FileMetadata])
(Maybe [FileMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommitResponse' {Maybe [FileMetadata]
filesDeleted :: Maybe [FileMetadata]
$sel:filesDeleted:CreateCommitResponse' :: CreateCommitResponse -> Maybe [FileMetadata]
filesDeleted} -> Maybe [FileMetadata]
filesDeleted) (\s :: CreateCommitResponse
s@CreateCommitResponse' {} Maybe [FileMetadata]
a -> CreateCommitResponse
s {$sel:filesDeleted:CreateCommitResponse' :: Maybe [FileMetadata]
filesDeleted = Maybe [FileMetadata]
a} :: CreateCommitResponse) ((Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse -> f CreateCommitResponse)
-> ((Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> (Maybe [FileMetadata] -> f (Maybe [FileMetadata]))
-> CreateCommitResponse
-> f CreateCommitResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [FileMetadata] [FileMetadata] [FileMetadata] [FileMetadata]
-> Iso
(Maybe [FileMetadata])
(Maybe [FileMetadata])
(Maybe [FileMetadata])
(Maybe [FileMetadata])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [FileMetadata] [FileMetadata] [FileMetadata] [FileMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCommitResponse_httpStatus :: Lens.Lens' CreateCommitResponse Prelude.Int
createCommitResponse_httpStatus :: (Int -> f Int) -> CreateCommitResponse -> f CreateCommitResponse
createCommitResponse_httpStatus = (CreateCommitResponse -> Int)
-> (CreateCommitResponse -> Int -> CreateCommitResponse)
-> Lens CreateCommitResponse CreateCommitResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommitResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCommitResponse' :: CreateCommitResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCommitResponse
s@CreateCommitResponse' {} Int
a -> CreateCommitResponse
s {$sel:httpStatus:CreateCommitResponse' :: Int
httpStatus = Int
a} :: CreateCommitResponse)
instance Prelude.NFData CreateCommitResponse