{-# 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.SourceConfiguration where
import Amazonka.AppRunner.Types.AuthenticationConfiguration
import Amazonka.AppRunner.Types.CodeRepository
import Amazonka.AppRunner.Types.ImageRepository
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SourceConfiguration = SourceConfiguration'
{
SourceConfiguration -> Maybe ImageRepository
imageRepository :: Prelude.Maybe ImageRepository,
SourceConfiguration -> Maybe CodeRepository
codeRepository :: Prelude.Maybe CodeRepository,
SourceConfiguration -> Maybe Bool
autoDeploymentsEnabled :: Prelude.Maybe Prelude.Bool,
SourceConfiguration -> Maybe AuthenticationConfiguration
authenticationConfiguration :: Prelude.Maybe AuthenticationConfiguration
}
deriving (SourceConfiguration -> SourceConfiguration -> Bool
(SourceConfiguration -> SourceConfiguration -> Bool)
-> (SourceConfiguration -> SourceConfiguration -> Bool)
-> Eq SourceConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceConfiguration -> SourceConfiguration -> Bool
$c/= :: SourceConfiguration -> SourceConfiguration -> Bool
== :: SourceConfiguration -> SourceConfiguration -> Bool
$c== :: SourceConfiguration -> SourceConfiguration -> Bool
Prelude.Eq, Int -> SourceConfiguration -> ShowS
[SourceConfiguration] -> ShowS
SourceConfiguration -> String
(Int -> SourceConfiguration -> ShowS)
-> (SourceConfiguration -> String)
-> ([SourceConfiguration] -> ShowS)
-> Show SourceConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceConfiguration] -> ShowS
$cshowList :: [SourceConfiguration] -> ShowS
show :: SourceConfiguration -> String
$cshow :: SourceConfiguration -> String
showsPrec :: Int -> SourceConfiguration -> ShowS
$cshowsPrec :: Int -> SourceConfiguration -> ShowS
Prelude.Show, (forall x. SourceConfiguration -> Rep SourceConfiguration x)
-> (forall x. Rep SourceConfiguration x -> SourceConfiguration)
-> Generic SourceConfiguration
forall x. Rep SourceConfiguration x -> SourceConfiguration
forall x. SourceConfiguration -> Rep SourceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceConfiguration x -> SourceConfiguration
$cfrom :: forall x. SourceConfiguration -> Rep SourceConfiguration x
Prelude.Generic)
newSourceConfiguration ::
SourceConfiguration
newSourceConfiguration :: SourceConfiguration
newSourceConfiguration =
SourceConfiguration' :: Maybe ImageRepository
-> Maybe CodeRepository
-> Maybe Bool
-> Maybe AuthenticationConfiguration
-> SourceConfiguration
SourceConfiguration'
{ $sel:imageRepository:SourceConfiguration' :: Maybe ImageRepository
imageRepository =
Maybe ImageRepository
forall a. Maybe a
Prelude.Nothing,
$sel:codeRepository:SourceConfiguration' :: Maybe CodeRepository
codeRepository = Maybe CodeRepository
forall a. Maybe a
Prelude.Nothing,
$sel:autoDeploymentsEnabled:SourceConfiguration' :: Maybe Bool
autoDeploymentsEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:authenticationConfiguration:SourceConfiguration' :: Maybe AuthenticationConfiguration
authenticationConfiguration = Maybe AuthenticationConfiguration
forall a. Maybe a
Prelude.Nothing
}
sourceConfiguration_imageRepository :: Lens.Lens' SourceConfiguration (Prelude.Maybe ImageRepository)
sourceConfiguration_imageRepository :: (Maybe ImageRepository -> f (Maybe ImageRepository))
-> SourceConfiguration -> f SourceConfiguration
sourceConfiguration_imageRepository = (SourceConfiguration -> Maybe ImageRepository)
-> (SourceConfiguration
-> Maybe ImageRepository -> SourceConfiguration)
-> Lens
SourceConfiguration
SourceConfiguration
(Maybe ImageRepository)
(Maybe ImageRepository)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfiguration' {Maybe ImageRepository
imageRepository :: Maybe ImageRepository
$sel:imageRepository:SourceConfiguration' :: SourceConfiguration -> Maybe ImageRepository
imageRepository} -> Maybe ImageRepository
imageRepository) (\s :: SourceConfiguration
s@SourceConfiguration' {} Maybe ImageRepository
a -> SourceConfiguration
s {$sel:imageRepository:SourceConfiguration' :: Maybe ImageRepository
imageRepository = Maybe ImageRepository
a} :: SourceConfiguration)
sourceConfiguration_codeRepository :: Lens.Lens' SourceConfiguration (Prelude.Maybe CodeRepository)
sourceConfiguration_codeRepository :: (Maybe CodeRepository -> f (Maybe CodeRepository))
-> SourceConfiguration -> f SourceConfiguration
sourceConfiguration_codeRepository = (SourceConfiguration -> Maybe CodeRepository)
-> (SourceConfiguration
-> Maybe CodeRepository -> SourceConfiguration)
-> Lens
SourceConfiguration
SourceConfiguration
(Maybe CodeRepository)
(Maybe CodeRepository)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfiguration' {Maybe CodeRepository
codeRepository :: Maybe CodeRepository
$sel:codeRepository:SourceConfiguration' :: SourceConfiguration -> Maybe CodeRepository
codeRepository} -> Maybe CodeRepository
codeRepository) (\s :: SourceConfiguration
s@SourceConfiguration' {} Maybe CodeRepository
a -> SourceConfiguration
s {$sel:codeRepository:SourceConfiguration' :: Maybe CodeRepository
codeRepository = Maybe CodeRepository
a} :: SourceConfiguration)
sourceConfiguration_autoDeploymentsEnabled :: Lens.Lens' SourceConfiguration (Prelude.Maybe Prelude.Bool)
sourceConfiguration_autoDeploymentsEnabled :: (Maybe Bool -> f (Maybe Bool))
-> SourceConfiguration -> f SourceConfiguration
sourceConfiguration_autoDeploymentsEnabled = (SourceConfiguration -> Maybe Bool)
-> (SourceConfiguration -> Maybe Bool -> SourceConfiguration)
-> Lens
SourceConfiguration SourceConfiguration (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfiguration' {Maybe Bool
autoDeploymentsEnabled :: Maybe Bool
$sel:autoDeploymentsEnabled:SourceConfiguration' :: SourceConfiguration -> Maybe Bool
autoDeploymentsEnabled} -> Maybe Bool
autoDeploymentsEnabled) (\s :: SourceConfiguration
s@SourceConfiguration' {} Maybe Bool
a -> SourceConfiguration
s {$sel:autoDeploymentsEnabled:SourceConfiguration' :: Maybe Bool
autoDeploymentsEnabled = Maybe Bool
a} :: SourceConfiguration)
sourceConfiguration_authenticationConfiguration :: Lens.Lens' SourceConfiguration (Prelude.Maybe AuthenticationConfiguration)
sourceConfiguration_authenticationConfiguration :: (Maybe AuthenticationConfiguration
-> f (Maybe AuthenticationConfiguration))
-> SourceConfiguration -> f SourceConfiguration
sourceConfiguration_authenticationConfiguration = (SourceConfiguration -> Maybe AuthenticationConfiguration)
-> (SourceConfiguration
-> Maybe AuthenticationConfiguration -> SourceConfiguration)
-> Lens
SourceConfiguration
SourceConfiguration
(Maybe AuthenticationConfiguration)
(Maybe AuthenticationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfiguration' {Maybe AuthenticationConfiguration
authenticationConfiguration :: Maybe AuthenticationConfiguration
$sel:authenticationConfiguration:SourceConfiguration' :: SourceConfiguration -> Maybe AuthenticationConfiguration
authenticationConfiguration} -> Maybe AuthenticationConfiguration
authenticationConfiguration) (\s :: SourceConfiguration
s@SourceConfiguration' {} Maybe AuthenticationConfiguration
a -> SourceConfiguration
s {$sel:authenticationConfiguration:SourceConfiguration' :: Maybe AuthenticationConfiguration
authenticationConfiguration = Maybe AuthenticationConfiguration
a} :: SourceConfiguration)
instance Core.FromJSON SourceConfiguration where
parseJSON :: Value -> Parser SourceConfiguration
parseJSON =
String
-> (Object -> Parser SourceConfiguration)
-> Value
-> Parser SourceConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SourceConfiguration"
( \Object
x ->
Maybe ImageRepository
-> Maybe CodeRepository
-> Maybe Bool
-> Maybe AuthenticationConfiguration
-> SourceConfiguration
SourceConfiguration'
(Maybe ImageRepository
-> Maybe CodeRepository
-> Maybe Bool
-> Maybe AuthenticationConfiguration
-> SourceConfiguration)
-> Parser (Maybe ImageRepository)
-> Parser
(Maybe CodeRepository
-> Maybe Bool
-> Maybe AuthenticationConfiguration
-> SourceConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ImageRepository)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ImageRepository")
Parser
(Maybe CodeRepository
-> Maybe Bool
-> Maybe AuthenticationConfiguration
-> SourceConfiguration)
-> Parser (Maybe CodeRepository)
-> Parser
(Maybe Bool
-> Maybe AuthenticationConfiguration -> SourceConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CodeRepository)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CodeRepository")
Parser
(Maybe Bool
-> Maybe AuthenticationConfiguration -> SourceConfiguration)
-> Parser (Maybe Bool)
-> Parser
(Maybe AuthenticationConfiguration -> SourceConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AutoDeploymentsEnabled")
Parser (Maybe AuthenticationConfiguration -> SourceConfiguration)
-> Parser (Maybe AuthenticationConfiguration)
-> Parser SourceConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AuthenticationConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AuthenticationConfiguration")
)
instance Prelude.Hashable SourceConfiguration
instance Prelude.NFData SourceConfiguration
instance Core.ToJSON SourceConfiguration where
toJSON :: SourceConfiguration -> Value
toJSON SourceConfiguration' {Maybe Bool
Maybe AuthenticationConfiguration
Maybe ImageRepository
Maybe CodeRepository
authenticationConfiguration :: Maybe AuthenticationConfiguration
autoDeploymentsEnabled :: Maybe Bool
codeRepository :: Maybe CodeRepository
imageRepository :: Maybe ImageRepository
$sel:authenticationConfiguration:SourceConfiguration' :: SourceConfiguration -> Maybe AuthenticationConfiguration
$sel:autoDeploymentsEnabled:SourceConfiguration' :: SourceConfiguration -> Maybe Bool
$sel:codeRepository:SourceConfiguration' :: SourceConfiguration -> Maybe CodeRepository
$sel:imageRepository:SourceConfiguration' :: SourceConfiguration -> Maybe ImageRepository
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ImageRepository" Text -> ImageRepository -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ImageRepository -> Pair) -> Maybe ImageRepository -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageRepository
imageRepository,
(Text
"CodeRepository" Text -> CodeRepository -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CodeRepository -> Pair) -> Maybe CodeRepository -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CodeRepository
codeRepository,
(Text
"AutoDeploymentsEnabled" 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
autoDeploymentsEnabled,
(Text
"AuthenticationConfiguration" Text -> AuthenticationConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AuthenticationConfiguration -> Pair)
-> Maybe AuthenticationConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthenticationConfiguration
authenticationConfiguration
]
)