{-# 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.CodeGuruReviewer.Types.SourceCodeType where
import Amazonka.CodeGuruReviewer.Types.BranchDiffSourceCodeType
import Amazonka.CodeGuruReviewer.Types.CommitDiffSourceCodeType
import Amazonka.CodeGuruReviewer.Types.RepositoryHeadSourceCodeType
import Amazonka.CodeGuruReviewer.Types.RequestMetadata
import Amazonka.CodeGuruReviewer.Types.S3BucketRepository
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SourceCodeType = SourceCodeType'
{
SourceCodeType -> Maybe S3BucketRepository
s3BucketRepository :: Prelude.Maybe S3BucketRepository,
SourceCodeType -> Maybe RequestMetadata
requestMetadata :: Prelude.Maybe RequestMetadata,
SourceCodeType -> Maybe RepositoryHeadSourceCodeType
repositoryHead :: Prelude.Maybe RepositoryHeadSourceCodeType,
SourceCodeType -> Maybe CommitDiffSourceCodeType
commitDiff :: Prelude.Maybe CommitDiffSourceCodeType,
SourceCodeType -> Maybe BranchDiffSourceCodeType
branchDiff :: Prelude.Maybe BranchDiffSourceCodeType
}
deriving (SourceCodeType -> SourceCodeType -> Bool
(SourceCodeType -> SourceCodeType -> Bool)
-> (SourceCodeType -> SourceCodeType -> Bool) -> Eq SourceCodeType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceCodeType -> SourceCodeType -> Bool
$c/= :: SourceCodeType -> SourceCodeType -> Bool
== :: SourceCodeType -> SourceCodeType -> Bool
$c== :: SourceCodeType -> SourceCodeType -> Bool
Prelude.Eq, ReadPrec [SourceCodeType]
ReadPrec SourceCodeType
Int -> ReadS SourceCodeType
ReadS [SourceCodeType]
(Int -> ReadS SourceCodeType)
-> ReadS [SourceCodeType]
-> ReadPrec SourceCodeType
-> ReadPrec [SourceCodeType]
-> Read SourceCodeType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceCodeType]
$creadListPrec :: ReadPrec [SourceCodeType]
readPrec :: ReadPrec SourceCodeType
$creadPrec :: ReadPrec SourceCodeType
readList :: ReadS [SourceCodeType]
$creadList :: ReadS [SourceCodeType]
readsPrec :: Int -> ReadS SourceCodeType
$creadsPrec :: Int -> ReadS SourceCodeType
Prelude.Read, Int -> SourceCodeType -> ShowS
[SourceCodeType] -> ShowS
SourceCodeType -> String
(Int -> SourceCodeType -> ShowS)
-> (SourceCodeType -> String)
-> ([SourceCodeType] -> ShowS)
-> Show SourceCodeType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceCodeType] -> ShowS
$cshowList :: [SourceCodeType] -> ShowS
show :: SourceCodeType -> String
$cshow :: SourceCodeType -> String
showsPrec :: Int -> SourceCodeType -> ShowS
$cshowsPrec :: Int -> SourceCodeType -> ShowS
Prelude.Show, (forall x. SourceCodeType -> Rep SourceCodeType x)
-> (forall x. Rep SourceCodeType x -> SourceCodeType)
-> Generic SourceCodeType
forall x. Rep SourceCodeType x -> SourceCodeType
forall x. SourceCodeType -> Rep SourceCodeType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceCodeType x -> SourceCodeType
$cfrom :: forall x. SourceCodeType -> Rep SourceCodeType x
Prelude.Generic)
newSourceCodeType ::
SourceCodeType
newSourceCodeType :: SourceCodeType
newSourceCodeType =
SourceCodeType' :: Maybe S3BucketRepository
-> Maybe RequestMetadata
-> Maybe RepositoryHeadSourceCodeType
-> Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType
-> SourceCodeType
SourceCodeType'
{ $sel:s3BucketRepository:SourceCodeType' :: Maybe S3BucketRepository
s3BucketRepository =
Maybe S3BucketRepository
forall a. Maybe a
Prelude.Nothing,
$sel:requestMetadata:SourceCodeType' :: Maybe RequestMetadata
requestMetadata = Maybe RequestMetadata
forall a. Maybe a
Prelude.Nothing,
$sel:repositoryHead:SourceCodeType' :: Maybe RepositoryHeadSourceCodeType
repositoryHead = Maybe RepositoryHeadSourceCodeType
forall a. Maybe a
Prelude.Nothing,
$sel:commitDiff:SourceCodeType' :: Maybe CommitDiffSourceCodeType
commitDiff = Maybe CommitDiffSourceCodeType
forall a. Maybe a
Prelude.Nothing,
$sel:branchDiff:SourceCodeType' :: Maybe BranchDiffSourceCodeType
branchDiff = Maybe BranchDiffSourceCodeType
forall a. Maybe a
Prelude.Nothing
}
sourceCodeType_s3BucketRepository :: Lens.Lens' SourceCodeType (Prelude.Maybe S3BucketRepository)
sourceCodeType_s3BucketRepository :: (Maybe S3BucketRepository -> f (Maybe S3BucketRepository))
-> SourceCodeType -> f SourceCodeType
sourceCodeType_s3BucketRepository = (SourceCodeType -> Maybe S3BucketRepository)
-> (SourceCodeType -> Maybe S3BucketRepository -> SourceCodeType)
-> Lens
SourceCodeType
SourceCodeType
(Maybe S3BucketRepository)
(Maybe S3BucketRepository)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceCodeType' {Maybe S3BucketRepository
s3BucketRepository :: Maybe S3BucketRepository
$sel:s3BucketRepository:SourceCodeType' :: SourceCodeType -> Maybe S3BucketRepository
s3BucketRepository} -> Maybe S3BucketRepository
s3BucketRepository) (\s :: SourceCodeType
s@SourceCodeType' {} Maybe S3BucketRepository
a -> SourceCodeType
s {$sel:s3BucketRepository:SourceCodeType' :: Maybe S3BucketRepository
s3BucketRepository = Maybe S3BucketRepository
a} :: SourceCodeType)
sourceCodeType_requestMetadata :: Lens.Lens' SourceCodeType (Prelude.Maybe RequestMetadata)
sourceCodeType_requestMetadata :: (Maybe RequestMetadata -> f (Maybe RequestMetadata))
-> SourceCodeType -> f SourceCodeType
sourceCodeType_requestMetadata = (SourceCodeType -> Maybe RequestMetadata)
-> (SourceCodeType -> Maybe RequestMetadata -> SourceCodeType)
-> Lens
SourceCodeType
SourceCodeType
(Maybe RequestMetadata)
(Maybe RequestMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceCodeType' {Maybe RequestMetadata
requestMetadata :: Maybe RequestMetadata
$sel:requestMetadata:SourceCodeType' :: SourceCodeType -> Maybe RequestMetadata
requestMetadata} -> Maybe RequestMetadata
requestMetadata) (\s :: SourceCodeType
s@SourceCodeType' {} Maybe RequestMetadata
a -> SourceCodeType
s {$sel:requestMetadata:SourceCodeType' :: Maybe RequestMetadata
requestMetadata = Maybe RequestMetadata
a} :: SourceCodeType)
sourceCodeType_repositoryHead :: Lens.Lens' SourceCodeType (Prelude.Maybe RepositoryHeadSourceCodeType)
sourceCodeType_repositoryHead :: (Maybe RepositoryHeadSourceCodeType
-> f (Maybe RepositoryHeadSourceCodeType))
-> SourceCodeType -> f SourceCodeType
sourceCodeType_repositoryHead = (SourceCodeType -> Maybe RepositoryHeadSourceCodeType)
-> (SourceCodeType
-> Maybe RepositoryHeadSourceCodeType -> SourceCodeType)
-> Lens
SourceCodeType
SourceCodeType
(Maybe RepositoryHeadSourceCodeType)
(Maybe RepositoryHeadSourceCodeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceCodeType' {Maybe RepositoryHeadSourceCodeType
repositoryHead :: Maybe RepositoryHeadSourceCodeType
$sel:repositoryHead:SourceCodeType' :: SourceCodeType -> Maybe RepositoryHeadSourceCodeType
repositoryHead} -> Maybe RepositoryHeadSourceCodeType
repositoryHead) (\s :: SourceCodeType
s@SourceCodeType' {} Maybe RepositoryHeadSourceCodeType
a -> SourceCodeType
s {$sel:repositoryHead:SourceCodeType' :: Maybe RepositoryHeadSourceCodeType
repositoryHead = Maybe RepositoryHeadSourceCodeType
a} :: SourceCodeType)
sourceCodeType_commitDiff :: Lens.Lens' SourceCodeType (Prelude.Maybe CommitDiffSourceCodeType)
sourceCodeType_commitDiff :: (Maybe CommitDiffSourceCodeType
-> f (Maybe CommitDiffSourceCodeType))
-> SourceCodeType -> f SourceCodeType
sourceCodeType_commitDiff = (SourceCodeType -> Maybe CommitDiffSourceCodeType)
-> (SourceCodeType
-> Maybe CommitDiffSourceCodeType -> SourceCodeType)
-> Lens
SourceCodeType
SourceCodeType
(Maybe CommitDiffSourceCodeType)
(Maybe CommitDiffSourceCodeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceCodeType' {Maybe CommitDiffSourceCodeType
commitDiff :: Maybe CommitDiffSourceCodeType
$sel:commitDiff:SourceCodeType' :: SourceCodeType -> Maybe CommitDiffSourceCodeType
commitDiff} -> Maybe CommitDiffSourceCodeType
commitDiff) (\s :: SourceCodeType
s@SourceCodeType' {} Maybe CommitDiffSourceCodeType
a -> SourceCodeType
s {$sel:commitDiff:SourceCodeType' :: Maybe CommitDiffSourceCodeType
commitDiff = Maybe CommitDiffSourceCodeType
a} :: SourceCodeType)
sourceCodeType_branchDiff :: Lens.Lens' SourceCodeType (Prelude.Maybe BranchDiffSourceCodeType)
sourceCodeType_branchDiff :: (Maybe BranchDiffSourceCodeType
-> f (Maybe BranchDiffSourceCodeType))
-> SourceCodeType -> f SourceCodeType
sourceCodeType_branchDiff = (SourceCodeType -> Maybe BranchDiffSourceCodeType)
-> (SourceCodeType
-> Maybe BranchDiffSourceCodeType -> SourceCodeType)
-> Lens
SourceCodeType
SourceCodeType
(Maybe BranchDiffSourceCodeType)
(Maybe BranchDiffSourceCodeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceCodeType' {Maybe BranchDiffSourceCodeType
branchDiff :: Maybe BranchDiffSourceCodeType
$sel:branchDiff:SourceCodeType' :: SourceCodeType -> Maybe BranchDiffSourceCodeType
branchDiff} -> Maybe BranchDiffSourceCodeType
branchDiff) (\s :: SourceCodeType
s@SourceCodeType' {} Maybe BranchDiffSourceCodeType
a -> SourceCodeType
s {$sel:branchDiff:SourceCodeType' :: Maybe BranchDiffSourceCodeType
branchDiff = Maybe BranchDiffSourceCodeType
a} :: SourceCodeType)
instance Core.FromJSON SourceCodeType where
parseJSON :: Value -> Parser SourceCodeType
parseJSON =
String
-> (Object -> Parser SourceCodeType)
-> Value
-> Parser SourceCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SourceCodeType"
( \Object
x ->
Maybe S3BucketRepository
-> Maybe RequestMetadata
-> Maybe RepositoryHeadSourceCodeType
-> Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType
-> SourceCodeType
SourceCodeType'
(Maybe S3BucketRepository
-> Maybe RequestMetadata
-> Maybe RepositoryHeadSourceCodeType
-> Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType
-> SourceCodeType)
-> Parser (Maybe S3BucketRepository)
-> Parser
(Maybe RequestMetadata
-> Maybe RepositoryHeadSourceCodeType
-> Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType
-> SourceCodeType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3BucketRepository)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3BucketRepository")
Parser
(Maybe RequestMetadata
-> Maybe RepositoryHeadSourceCodeType
-> Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType
-> SourceCodeType)
-> Parser (Maybe RequestMetadata)
-> Parser
(Maybe RepositoryHeadSourceCodeType
-> Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType
-> SourceCodeType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RequestMetadata)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RequestMetadata")
Parser
(Maybe RepositoryHeadSourceCodeType
-> Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType
-> SourceCodeType)
-> Parser (Maybe RepositoryHeadSourceCodeType)
-> Parser
(Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType -> SourceCodeType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RepositoryHeadSourceCodeType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RepositoryHead")
Parser
(Maybe CommitDiffSourceCodeType
-> Maybe BranchDiffSourceCodeType -> SourceCodeType)
-> Parser (Maybe CommitDiffSourceCodeType)
-> Parser (Maybe BranchDiffSourceCodeType -> SourceCodeType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CommitDiffSourceCodeType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CommitDiff")
Parser (Maybe BranchDiffSourceCodeType -> SourceCodeType)
-> Parser (Maybe BranchDiffSourceCodeType) -> Parser SourceCodeType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BranchDiffSourceCodeType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BranchDiff")
)
instance Prelude.Hashable SourceCodeType
instance Prelude.NFData SourceCodeType
instance Core.ToJSON SourceCodeType where
toJSON :: SourceCodeType -> Value
toJSON SourceCodeType' {Maybe BranchDiffSourceCodeType
Maybe CommitDiffSourceCodeType
Maybe RepositoryHeadSourceCodeType
Maybe S3BucketRepository
Maybe RequestMetadata
branchDiff :: Maybe BranchDiffSourceCodeType
commitDiff :: Maybe CommitDiffSourceCodeType
repositoryHead :: Maybe RepositoryHeadSourceCodeType
requestMetadata :: Maybe RequestMetadata
s3BucketRepository :: Maybe S3BucketRepository
$sel:branchDiff:SourceCodeType' :: SourceCodeType -> Maybe BranchDiffSourceCodeType
$sel:commitDiff:SourceCodeType' :: SourceCodeType -> Maybe CommitDiffSourceCodeType
$sel:repositoryHead:SourceCodeType' :: SourceCodeType -> Maybe RepositoryHeadSourceCodeType
$sel:requestMetadata:SourceCodeType' :: SourceCodeType -> Maybe RequestMetadata
$sel:s3BucketRepository:SourceCodeType' :: SourceCodeType -> Maybe S3BucketRepository
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"S3BucketRepository" Text -> S3BucketRepository -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(S3BucketRepository -> Pair)
-> Maybe S3BucketRepository -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3BucketRepository
s3BucketRepository,
(Text
"RequestMetadata" Text -> RequestMetadata -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RequestMetadata -> Pair) -> Maybe RequestMetadata -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RequestMetadata
requestMetadata,
(Text
"RepositoryHead" Text -> RepositoryHeadSourceCodeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RepositoryHeadSourceCodeType -> Pair)
-> Maybe RepositoryHeadSourceCodeType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RepositoryHeadSourceCodeType
repositoryHead,
(Text
"CommitDiff" Text -> CommitDiffSourceCodeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CommitDiffSourceCodeType -> Pair)
-> Maybe CommitDiffSourceCodeType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CommitDiffSourceCodeType
commitDiff,
(Text
"BranchDiff" Text -> BranchDiffSourceCodeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (BranchDiffSourceCodeType -> Pair)
-> Maybe BranchDiffSourceCodeType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BranchDiffSourceCodeType
branchDiff
]
)