{-# 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.AppRunner.Types.CodeRepository where
import Amazonka.AppRunner.Types.CodeConfiguration
import Amazonka.AppRunner.Types.SourceCodeVersion
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CodeRepository = CodeRepository'
{
CodeRepository -> Maybe CodeConfiguration
codeConfiguration :: Prelude.Maybe CodeConfiguration,
CodeRepository -> Text
repositoryUrl :: Prelude.Text,
CodeRepository -> SourceCodeVersion
sourceCodeVersion :: SourceCodeVersion
}
deriving (CodeRepository -> CodeRepository -> Bool
(CodeRepository -> CodeRepository -> Bool)
-> (CodeRepository -> CodeRepository -> Bool) -> Eq CodeRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeRepository -> CodeRepository -> Bool
$c/= :: CodeRepository -> CodeRepository -> Bool
== :: CodeRepository -> CodeRepository -> Bool
$c== :: CodeRepository -> CodeRepository -> Bool
Prelude.Eq, Int -> CodeRepository -> ShowS
[CodeRepository] -> ShowS
CodeRepository -> String
(Int -> CodeRepository -> ShowS)
-> (CodeRepository -> String)
-> ([CodeRepository] -> ShowS)
-> Show CodeRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeRepository] -> ShowS
$cshowList :: [CodeRepository] -> ShowS
show :: CodeRepository -> String
$cshow :: CodeRepository -> String
showsPrec :: Int -> CodeRepository -> ShowS
$cshowsPrec :: Int -> CodeRepository -> ShowS
Prelude.Show, (forall x. CodeRepository -> Rep CodeRepository x)
-> (forall x. Rep CodeRepository x -> CodeRepository)
-> Generic CodeRepository
forall x. Rep CodeRepository x -> CodeRepository
forall x. CodeRepository -> Rep CodeRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeRepository x -> CodeRepository
$cfrom :: forall x. CodeRepository -> Rep CodeRepository x
Prelude.Generic)
newCodeRepository ::
Prelude.Text ->
SourceCodeVersion ->
CodeRepository
newCodeRepository :: Text -> SourceCodeVersion -> CodeRepository
newCodeRepository Text
pRepositoryUrl_ SourceCodeVersion
pSourceCodeVersion_ =
CodeRepository' :: Maybe CodeConfiguration
-> Text -> SourceCodeVersion -> CodeRepository
CodeRepository'
{ $sel:codeConfiguration:CodeRepository' :: Maybe CodeConfiguration
codeConfiguration =
Maybe CodeConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:repositoryUrl:CodeRepository' :: Text
repositoryUrl = Text
pRepositoryUrl_,
$sel:sourceCodeVersion:CodeRepository' :: SourceCodeVersion
sourceCodeVersion = SourceCodeVersion
pSourceCodeVersion_
}
codeRepository_codeConfiguration :: Lens.Lens' CodeRepository (Prelude.Maybe CodeConfiguration)
codeRepository_codeConfiguration :: (Maybe CodeConfiguration -> f (Maybe CodeConfiguration))
-> CodeRepository -> f CodeRepository
codeRepository_codeConfiguration = (CodeRepository -> Maybe CodeConfiguration)
-> (CodeRepository -> Maybe CodeConfiguration -> CodeRepository)
-> Lens
CodeRepository
CodeRepository
(Maybe CodeConfiguration)
(Maybe CodeConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeRepository' {Maybe CodeConfiguration
codeConfiguration :: Maybe CodeConfiguration
$sel:codeConfiguration:CodeRepository' :: CodeRepository -> Maybe CodeConfiguration
codeConfiguration} -> Maybe CodeConfiguration
codeConfiguration) (\s :: CodeRepository
s@CodeRepository' {} Maybe CodeConfiguration
a -> CodeRepository
s {$sel:codeConfiguration:CodeRepository' :: Maybe CodeConfiguration
codeConfiguration = Maybe CodeConfiguration
a} :: CodeRepository)
codeRepository_repositoryUrl :: Lens.Lens' CodeRepository Prelude.Text
codeRepository_repositoryUrl :: (Text -> f Text) -> CodeRepository -> f CodeRepository
codeRepository_repositoryUrl = (CodeRepository -> Text)
-> (CodeRepository -> Text -> CodeRepository)
-> Lens CodeRepository CodeRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeRepository' {Text
repositoryUrl :: Text
$sel:repositoryUrl:CodeRepository' :: CodeRepository -> Text
repositoryUrl} -> Text
repositoryUrl) (\s :: CodeRepository
s@CodeRepository' {} Text
a -> CodeRepository
s {$sel:repositoryUrl:CodeRepository' :: Text
repositoryUrl = Text
a} :: CodeRepository)
codeRepository_sourceCodeVersion :: Lens.Lens' CodeRepository SourceCodeVersion
codeRepository_sourceCodeVersion :: (SourceCodeVersion -> f SourceCodeVersion)
-> CodeRepository -> f CodeRepository
codeRepository_sourceCodeVersion = (CodeRepository -> SourceCodeVersion)
-> (CodeRepository -> SourceCodeVersion -> CodeRepository)
-> Lens
CodeRepository CodeRepository SourceCodeVersion SourceCodeVersion
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeRepository' {SourceCodeVersion
sourceCodeVersion :: SourceCodeVersion
$sel:sourceCodeVersion:CodeRepository' :: CodeRepository -> SourceCodeVersion
sourceCodeVersion} -> SourceCodeVersion
sourceCodeVersion) (\s :: CodeRepository
s@CodeRepository' {} SourceCodeVersion
a -> CodeRepository
s {$sel:sourceCodeVersion:CodeRepository' :: SourceCodeVersion
sourceCodeVersion = SourceCodeVersion
a} :: CodeRepository)
instance Core.FromJSON CodeRepository where
parseJSON :: Value -> Parser CodeRepository
parseJSON =
String
-> (Object -> Parser CodeRepository)
-> Value
-> Parser CodeRepository
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CodeRepository"
( \Object
x ->
Maybe CodeConfiguration
-> Text -> SourceCodeVersion -> CodeRepository
CodeRepository'
(Maybe CodeConfiguration
-> Text -> SourceCodeVersion -> CodeRepository)
-> Parser (Maybe CodeConfiguration)
-> Parser (Text -> SourceCodeVersion -> CodeRepository)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CodeConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CodeConfiguration")
Parser (Text -> SourceCodeVersion -> CodeRepository)
-> Parser Text -> Parser (SourceCodeVersion -> CodeRepository)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RepositoryUrl")
Parser (SourceCodeVersion -> CodeRepository)
-> Parser SourceCodeVersion -> Parser CodeRepository
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SourceCodeVersion
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SourceCodeVersion")
)
instance Prelude.Hashable CodeRepository
instance Prelude.NFData CodeRepository
instance Core.ToJSON CodeRepository where
toJSON :: CodeRepository -> Value
toJSON CodeRepository' {Maybe CodeConfiguration
Text
SourceCodeVersion
sourceCodeVersion :: SourceCodeVersion
repositoryUrl :: Text
codeConfiguration :: Maybe CodeConfiguration
$sel:sourceCodeVersion:CodeRepository' :: CodeRepository -> SourceCodeVersion
$sel:repositoryUrl:CodeRepository' :: CodeRepository -> Text
$sel:codeConfiguration:CodeRepository' :: CodeRepository -> Maybe CodeConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CodeConfiguration" Text -> CodeConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CodeConfiguration -> Pair)
-> Maybe CodeConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CodeConfiguration
codeConfiguration,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RepositoryUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryUrl),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SourceCodeVersion" Text -> SourceCodeVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SourceCodeVersion
sourceCodeVersion)
]
)