{-# 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.ImageConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ImageConfiguration = ImageConfiguration'
{
ImageConfiguration -> Maybe Text
startCommand :: Prelude.Maybe Prelude.Text,
ImageConfiguration -> Maybe (HashMap Text (Sensitive Text))
runtimeEnvironmentVariables :: Prelude.Maybe (Prelude.HashMap Prelude.Text (Core.Sensitive Prelude.Text)),
ImageConfiguration -> Maybe Text
port :: Prelude.Maybe Prelude.Text
}
deriving (ImageConfiguration -> ImageConfiguration -> Bool
(ImageConfiguration -> ImageConfiguration -> Bool)
-> (ImageConfiguration -> ImageConfiguration -> Bool)
-> Eq ImageConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageConfiguration -> ImageConfiguration -> Bool
$c/= :: ImageConfiguration -> ImageConfiguration -> Bool
== :: ImageConfiguration -> ImageConfiguration -> Bool
$c== :: ImageConfiguration -> ImageConfiguration -> Bool
Prelude.Eq, Int -> ImageConfiguration -> ShowS
[ImageConfiguration] -> ShowS
ImageConfiguration -> String
(Int -> ImageConfiguration -> ShowS)
-> (ImageConfiguration -> String)
-> ([ImageConfiguration] -> ShowS)
-> Show ImageConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageConfiguration] -> ShowS
$cshowList :: [ImageConfiguration] -> ShowS
show :: ImageConfiguration -> String
$cshow :: ImageConfiguration -> String
showsPrec :: Int -> ImageConfiguration -> ShowS
$cshowsPrec :: Int -> ImageConfiguration -> ShowS
Prelude.Show, (forall x. ImageConfiguration -> Rep ImageConfiguration x)
-> (forall x. Rep ImageConfiguration x -> ImageConfiguration)
-> Generic ImageConfiguration
forall x. Rep ImageConfiguration x -> ImageConfiguration
forall x. ImageConfiguration -> Rep ImageConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageConfiguration x -> ImageConfiguration
$cfrom :: forall x. ImageConfiguration -> Rep ImageConfiguration x
Prelude.Generic)
newImageConfiguration ::
ImageConfiguration
newImageConfiguration :: ImageConfiguration
newImageConfiguration =
ImageConfiguration' :: Maybe Text
-> Maybe (HashMap Text (Sensitive Text))
-> Maybe Text
-> ImageConfiguration
ImageConfiguration'
{ $sel:startCommand:ImageConfiguration' :: Maybe Text
startCommand = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:runtimeEnvironmentVariables:ImageConfiguration' :: Maybe (HashMap Text (Sensitive Text))
runtimeEnvironmentVariables = Maybe (HashMap Text (Sensitive Text))
forall a. Maybe a
Prelude.Nothing,
$sel:port:ImageConfiguration' :: Maybe Text
port = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
imageConfiguration_startCommand :: Lens.Lens' ImageConfiguration (Prelude.Maybe Prelude.Text)
imageConfiguration_startCommand :: (Maybe Text -> f (Maybe Text))
-> ImageConfiguration -> f ImageConfiguration
imageConfiguration_startCommand = (ImageConfiguration -> Maybe Text)
-> (ImageConfiguration -> Maybe Text -> ImageConfiguration)
-> Lens
ImageConfiguration ImageConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfiguration' {Maybe Text
startCommand :: Maybe Text
$sel:startCommand:ImageConfiguration' :: ImageConfiguration -> Maybe Text
startCommand} -> Maybe Text
startCommand) (\s :: ImageConfiguration
s@ImageConfiguration' {} Maybe Text
a -> ImageConfiguration
s {$sel:startCommand:ImageConfiguration' :: Maybe Text
startCommand = Maybe Text
a} :: ImageConfiguration)
imageConfiguration_runtimeEnvironmentVariables :: Lens.Lens' ImageConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
imageConfiguration_runtimeEnvironmentVariables :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ImageConfiguration -> f ImageConfiguration
imageConfiguration_runtimeEnvironmentVariables = (ImageConfiguration -> Maybe (HashMap Text (Sensitive Text)))
-> (ImageConfiguration
-> Maybe (HashMap Text (Sensitive Text)) -> ImageConfiguration)
-> Lens
ImageConfiguration
ImageConfiguration
(Maybe (HashMap Text (Sensitive Text)))
(Maybe (HashMap Text (Sensitive Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfiguration' {Maybe (HashMap Text (Sensitive Text))
runtimeEnvironmentVariables :: Maybe (HashMap Text (Sensitive Text))
$sel:runtimeEnvironmentVariables:ImageConfiguration' :: ImageConfiguration -> Maybe (HashMap Text (Sensitive Text))
runtimeEnvironmentVariables} -> Maybe (HashMap Text (Sensitive Text))
runtimeEnvironmentVariables) (\s :: ImageConfiguration
s@ImageConfiguration' {} Maybe (HashMap Text (Sensitive Text))
a -> ImageConfiguration
s {$sel:runtimeEnvironmentVariables:ImageConfiguration' :: Maybe (HashMap Text (Sensitive Text))
runtimeEnvironmentVariables = Maybe (HashMap Text (Sensitive Text))
a} :: ImageConfiguration) ((Maybe (HashMap Text (Sensitive Text))
-> f (Maybe (HashMap Text (Sensitive Text))))
-> ImageConfiguration -> f ImageConfiguration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text (Sensitive Text))
-> f (Maybe (HashMap Text (Sensitive Text))))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ImageConfiguration
-> f ImageConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text (Sensitive Text))
(HashMap Text (Sensitive Text))
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text (Sensitive Text)))
(Maybe (HashMap Text (Sensitive Text)))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text 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
(HashMap Text (Sensitive Text))
(HashMap Text (Sensitive Text))
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
imageConfiguration_port :: Lens.Lens' ImageConfiguration (Prelude.Maybe Prelude.Text)
imageConfiguration_port :: (Maybe Text -> f (Maybe Text))
-> ImageConfiguration -> f ImageConfiguration
imageConfiguration_port = (ImageConfiguration -> Maybe Text)
-> (ImageConfiguration -> Maybe Text -> ImageConfiguration)
-> Lens
ImageConfiguration ImageConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfiguration' {Maybe Text
port :: Maybe Text
$sel:port:ImageConfiguration' :: ImageConfiguration -> Maybe Text
port} -> Maybe Text
port) (\s :: ImageConfiguration
s@ImageConfiguration' {} Maybe Text
a -> ImageConfiguration
s {$sel:port:ImageConfiguration' :: Maybe Text
port = Maybe Text
a} :: ImageConfiguration)
instance Core.FromJSON ImageConfiguration where
parseJSON :: Value -> Parser ImageConfiguration
parseJSON =
String
-> (Object -> Parser ImageConfiguration)
-> Value
-> Parser ImageConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ImageConfiguration"
( \Object
x ->
Maybe Text
-> Maybe (HashMap Text (Sensitive Text))
-> Maybe Text
-> ImageConfiguration
ImageConfiguration'
(Maybe Text
-> Maybe (HashMap Text (Sensitive Text))
-> Maybe Text
-> ImageConfiguration)
-> Parser (Maybe Text)
-> Parser
(Maybe (HashMap Text (Sensitive Text))
-> Maybe Text -> ImageConfiguration)
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
"StartCommand")
Parser
(Maybe (HashMap Text (Sensitive Text))
-> Maybe Text -> ImageConfiguration)
-> Parser (Maybe (HashMap Text (Sensitive Text)))
-> Parser (Maybe Text -> ImageConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe (HashMap Text (Sensitive Text))))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RuntimeEnvironmentVariables"
Parser (Maybe (Maybe (HashMap Text (Sensitive Text))))
-> Maybe (HashMap Text (Sensitive Text))
-> Parser (Maybe (HashMap Text (Sensitive Text)))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text (Sensitive Text))
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Text -> ImageConfiguration)
-> Parser (Maybe Text) -> Parser ImageConfiguration
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
"Port")
)
instance Prelude.Hashable ImageConfiguration
instance Prelude.NFData ImageConfiguration
instance Core.ToJSON ImageConfiguration where
toJSON :: ImageConfiguration -> Value
toJSON ImageConfiguration' {Maybe Text
Maybe (HashMap Text (Sensitive Text))
port :: Maybe Text
runtimeEnvironmentVariables :: Maybe (HashMap Text (Sensitive Text))
startCommand :: Maybe Text
$sel:port:ImageConfiguration' :: ImageConfiguration -> Maybe Text
$sel:runtimeEnvironmentVariables:ImageConfiguration' :: ImageConfiguration -> Maybe (HashMap Text (Sensitive Text))
$sel:startCommand:ImageConfiguration' :: ImageConfiguration -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"StartCommand" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
startCommand,
(Text
"RuntimeEnvironmentVariables" Text -> HashMap Text (Sensitive Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text (Sensitive Text) -> Pair)
-> Maybe (HashMap Text (Sensitive Text)) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text (Sensitive Text))
runtimeEnvironmentVariables,
(Text
"Port" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
port
]
)