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