{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CodeCommit.Types.Commit where
import Amazonka.CodeCommit.Types.UserInfo
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Commit = Commit'
{
Commit -> Maybe Text
commitId :: Prelude.Maybe Prelude.Text,
Commit -> Maybe UserInfo
committer :: Prelude.Maybe UserInfo,
Commit -> Maybe Text
treeId :: Prelude.Maybe Prelude.Text,
Commit -> Maybe Text
additionalData :: Prelude.Maybe Prelude.Text,
Commit -> Maybe [Text]
parents :: Prelude.Maybe [Prelude.Text],
Commit -> Maybe UserInfo
author :: Prelude.Maybe UserInfo,
Commit -> Maybe Text
message :: Prelude.Maybe Prelude.Text
}
deriving (Commit -> Commit -> Bool
(Commit -> Commit -> Bool)
-> (Commit -> Commit -> Bool) -> Eq Commit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Commit -> Commit -> Bool
$c/= :: Commit -> Commit -> Bool
== :: Commit -> Commit -> Bool
$c== :: Commit -> Commit -> Bool
Prelude.Eq, ReadPrec [Commit]
ReadPrec Commit
Int -> ReadS Commit
ReadS [Commit]
(Int -> ReadS Commit)
-> ReadS [Commit]
-> ReadPrec Commit
-> ReadPrec [Commit]
-> Read Commit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Commit]
$creadListPrec :: ReadPrec [Commit]
readPrec :: ReadPrec Commit
$creadPrec :: ReadPrec Commit
readList :: ReadS [Commit]
$creadList :: ReadS [Commit]
readsPrec :: Int -> ReadS Commit
$creadsPrec :: Int -> ReadS Commit
Prelude.Read, Int -> Commit -> ShowS
[Commit] -> ShowS
Commit -> String
(Int -> Commit -> ShowS)
-> (Commit -> String) -> ([Commit] -> ShowS) -> Show Commit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Commit] -> ShowS
$cshowList :: [Commit] -> ShowS
show :: Commit -> String
$cshow :: Commit -> String
showsPrec :: Int -> Commit -> ShowS
$cshowsPrec :: Int -> Commit -> ShowS
Prelude.Show, (forall x. Commit -> Rep Commit x)
-> (forall x. Rep Commit x -> Commit) -> Generic Commit
forall x. Rep Commit x -> Commit
forall x. Commit -> Rep Commit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Commit x -> Commit
$cfrom :: forall x. Commit -> Rep Commit x
Prelude.Generic)
newCommit ::
Commit
newCommit :: Commit
newCommit =
Commit' :: Maybe Text
-> Maybe UserInfo
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe UserInfo
-> Maybe Text
-> Commit
Commit'
{ $sel:commitId:Commit' :: Maybe Text
commitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:committer:Commit' :: Maybe UserInfo
committer = Maybe UserInfo
forall a. Maybe a
Prelude.Nothing,
$sel:treeId:Commit' :: Maybe Text
treeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:additionalData:Commit' :: Maybe Text
additionalData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:parents:Commit' :: Maybe [Text]
parents = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:author:Commit' :: Maybe UserInfo
author = Maybe UserInfo
forall a. Maybe a
Prelude.Nothing,
$sel:message:Commit' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
commit_commitId :: Lens.Lens' Commit (Prelude.Maybe Prelude.Text)
commit_commitId :: (Maybe Text -> f (Maybe Text)) -> Commit -> f Commit
commit_commitId = (Commit -> Maybe Text)
-> (Commit -> Maybe Text -> Commit)
-> Lens Commit Commit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Commit' {Maybe Text
commitId :: Maybe Text
$sel:commitId:Commit' :: Commit -> Maybe Text
commitId} -> Maybe Text
commitId) (\s :: Commit
s@Commit' {} Maybe Text
a -> Commit
s {$sel:commitId:Commit' :: Maybe Text
commitId = Maybe Text
a} :: Commit)
commit_committer :: Lens.Lens' Commit (Prelude.Maybe UserInfo)
commit_committer :: (Maybe UserInfo -> f (Maybe UserInfo)) -> Commit -> f Commit
commit_committer = (Commit -> Maybe UserInfo)
-> (Commit -> Maybe UserInfo -> Commit)
-> Lens Commit Commit (Maybe UserInfo) (Maybe UserInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Commit' {Maybe UserInfo
committer :: Maybe UserInfo
$sel:committer:Commit' :: Commit -> Maybe UserInfo
committer} -> Maybe UserInfo
committer) (\s :: Commit
s@Commit' {} Maybe UserInfo
a -> Commit
s {$sel:committer:Commit' :: Maybe UserInfo
committer = Maybe UserInfo
a} :: Commit)
commit_treeId :: Lens.Lens' Commit (Prelude.Maybe Prelude.Text)
commit_treeId :: (Maybe Text -> f (Maybe Text)) -> Commit -> f Commit
commit_treeId = (Commit -> Maybe Text)
-> (Commit -> Maybe Text -> Commit)
-> Lens Commit Commit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Commit' {Maybe Text
treeId :: Maybe Text
$sel:treeId:Commit' :: Commit -> Maybe Text
treeId} -> Maybe Text
treeId) (\s :: Commit
s@Commit' {} Maybe Text
a -> Commit
s {$sel:treeId:Commit' :: Maybe Text
treeId = Maybe Text
a} :: Commit)
commit_additionalData :: Lens.Lens' Commit (Prelude.Maybe Prelude.Text)
commit_additionalData :: (Maybe Text -> f (Maybe Text)) -> Commit -> f Commit
commit_additionalData = (Commit -> Maybe Text)
-> (Commit -> Maybe Text -> Commit)
-> Lens Commit Commit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Commit' {Maybe Text
additionalData :: Maybe Text
$sel:additionalData:Commit' :: Commit -> Maybe Text
additionalData} -> Maybe Text
additionalData) (\s :: Commit
s@Commit' {} Maybe Text
a -> Commit
s {$sel:additionalData:Commit' :: Maybe Text
additionalData = Maybe Text
a} :: Commit)
commit_parents :: Lens.Lens' Commit (Prelude.Maybe [Prelude.Text])
commit_parents :: (Maybe [Text] -> f (Maybe [Text])) -> Commit -> f Commit
commit_parents = (Commit -> Maybe [Text])
-> (Commit -> Maybe [Text] -> Commit)
-> Lens Commit Commit (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Commit' {Maybe [Text]
parents :: Maybe [Text]
$sel:parents:Commit' :: Commit -> Maybe [Text]
parents} -> Maybe [Text]
parents) (\s :: Commit
s@Commit' {} Maybe [Text]
a -> Commit
s {$sel:parents:Commit' :: Maybe [Text]
parents = Maybe [Text]
a} :: Commit) ((Maybe [Text] -> f (Maybe [Text])) -> Commit -> f Commit)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Commit
-> f Commit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
commit_author :: Lens.Lens' Commit (Prelude.Maybe UserInfo)
commit_author :: (Maybe UserInfo -> f (Maybe UserInfo)) -> Commit -> f Commit
commit_author = (Commit -> Maybe UserInfo)
-> (Commit -> Maybe UserInfo -> Commit)
-> Lens Commit Commit (Maybe UserInfo) (Maybe UserInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Commit' {Maybe UserInfo
author :: Maybe UserInfo
$sel:author:Commit' :: Commit -> Maybe UserInfo
author} -> Maybe UserInfo
author) (\s :: Commit
s@Commit' {} Maybe UserInfo
a -> Commit
s {$sel:author:Commit' :: Maybe UserInfo
author = Maybe UserInfo
a} :: Commit)
commit_message :: Lens.Lens' Commit (Prelude.Maybe Prelude.Text)
commit_message :: (Maybe Text -> f (Maybe Text)) -> Commit -> f Commit
commit_message = (Commit -> Maybe Text)
-> (Commit -> Maybe Text -> Commit)
-> Lens Commit Commit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Commit' {Maybe Text
message :: Maybe Text
$sel:message:Commit' :: Commit -> Maybe Text
message} -> Maybe Text
message) (\s :: Commit
s@Commit' {} Maybe Text
a -> Commit
s {$sel:message:Commit' :: Maybe Text
message = Maybe Text
a} :: Commit)
instance Core.FromJSON Commit where
parseJSON :: Value -> Parser Commit
parseJSON =
String -> (Object -> Parser Commit) -> Value -> Parser Commit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Commit"
( \Object
x ->
Maybe Text
-> Maybe UserInfo
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe UserInfo
-> Maybe Text
-> Commit
Commit'
(Maybe Text
-> Maybe UserInfo
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe UserInfo
-> Maybe Text
-> Commit)
-> Parser (Maybe Text)
-> Parser
(Maybe UserInfo
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe UserInfo
-> Maybe Text
-> Commit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"commitId")
Parser
(Maybe UserInfo
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe UserInfo
-> Maybe Text
-> Commit)
-> Parser (Maybe UserInfo)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe UserInfo
-> Maybe Text
-> Commit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UserInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"committer")
Parser
(Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe UserInfo
-> Maybe Text
-> Commit)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe [Text] -> Maybe UserInfo -> Maybe Text -> Commit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"treeId")
Parser
(Maybe Text
-> Maybe [Text] -> Maybe UserInfo -> Maybe Text -> Commit)
-> Parser (Maybe Text)
-> Parser (Maybe [Text] -> Maybe UserInfo -> Maybe Text -> Commit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"additionalData")
Parser (Maybe [Text] -> Maybe UserInfo -> Maybe Text -> Commit)
-> Parser (Maybe [Text])
-> Parser (Maybe UserInfo -> Maybe Text -> Commit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"parents" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe UserInfo -> Maybe Text -> Commit)
-> Parser (Maybe UserInfo) -> Parser (Maybe Text -> Commit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UserInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"author")
Parser (Maybe Text -> Commit)
-> Parser (Maybe Text) -> Parser Commit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"message")
)
instance Prelude.Hashable Commit
instance Prelude.NFData Commit