{-# 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.OpsWorks.Types.EnvironmentVariable where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EnvironmentVariable = EnvironmentVariable'
{
EnvironmentVariable -> Maybe Bool
secure :: Prelude.Maybe Prelude.Bool,
EnvironmentVariable -> Text
key :: Prelude.Text,
EnvironmentVariable -> Text
value :: Prelude.Text
}
deriving (EnvironmentVariable -> EnvironmentVariable -> Bool
(EnvironmentVariable -> EnvironmentVariable -> Bool)
-> (EnvironmentVariable -> EnvironmentVariable -> Bool)
-> Eq EnvironmentVariable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnvironmentVariable -> EnvironmentVariable -> Bool
$c/= :: EnvironmentVariable -> EnvironmentVariable -> Bool
== :: EnvironmentVariable -> EnvironmentVariable -> Bool
$c== :: EnvironmentVariable -> EnvironmentVariable -> Bool
Prelude.Eq, ReadPrec [EnvironmentVariable]
ReadPrec EnvironmentVariable
Int -> ReadS EnvironmentVariable
ReadS [EnvironmentVariable]
(Int -> ReadS EnvironmentVariable)
-> ReadS [EnvironmentVariable]
-> ReadPrec EnvironmentVariable
-> ReadPrec [EnvironmentVariable]
-> Read EnvironmentVariable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnvironmentVariable]
$creadListPrec :: ReadPrec [EnvironmentVariable]
readPrec :: ReadPrec EnvironmentVariable
$creadPrec :: ReadPrec EnvironmentVariable
readList :: ReadS [EnvironmentVariable]
$creadList :: ReadS [EnvironmentVariable]
readsPrec :: Int -> ReadS EnvironmentVariable
$creadsPrec :: Int -> ReadS EnvironmentVariable
Prelude.Read, Int -> EnvironmentVariable -> ShowS
[EnvironmentVariable] -> ShowS
EnvironmentVariable -> String
(Int -> EnvironmentVariable -> ShowS)
-> (EnvironmentVariable -> String)
-> ([EnvironmentVariable] -> ShowS)
-> Show EnvironmentVariable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentVariable] -> ShowS
$cshowList :: [EnvironmentVariable] -> ShowS
show :: EnvironmentVariable -> String
$cshow :: EnvironmentVariable -> String
showsPrec :: Int -> EnvironmentVariable -> ShowS
$cshowsPrec :: Int -> EnvironmentVariable -> ShowS
Prelude.Show, (forall x. EnvironmentVariable -> Rep EnvironmentVariable x)
-> (forall x. Rep EnvironmentVariable x -> EnvironmentVariable)
-> Generic EnvironmentVariable
forall x. Rep EnvironmentVariable x -> EnvironmentVariable
forall x. EnvironmentVariable -> Rep EnvironmentVariable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnvironmentVariable x -> EnvironmentVariable
$cfrom :: forall x. EnvironmentVariable -> Rep EnvironmentVariable x
Prelude.Generic)
newEnvironmentVariable ::
Prelude.Text ->
Prelude.Text ->
EnvironmentVariable
newEnvironmentVariable :: Text -> Text -> EnvironmentVariable
newEnvironmentVariable Text
pKey_ Text
pValue_ =
EnvironmentVariable' :: Maybe Bool -> Text -> Text -> EnvironmentVariable
EnvironmentVariable'
{ $sel:secure:EnvironmentVariable' :: Maybe Bool
secure = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:key:EnvironmentVariable' :: Text
key = Text
pKey_,
$sel:value:EnvironmentVariable' :: Text
value = Text
pValue_
}
environmentVariable_secure :: Lens.Lens' EnvironmentVariable (Prelude.Maybe Prelude.Bool)
environmentVariable_secure :: (Maybe Bool -> f (Maybe Bool))
-> EnvironmentVariable -> f EnvironmentVariable
environmentVariable_secure = (EnvironmentVariable -> Maybe Bool)
-> (EnvironmentVariable -> Maybe Bool -> EnvironmentVariable)
-> Lens
EnvironmentVariable EnvironmentVariable (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentVariable' {Maybe Bool
secure :: Maybe Bool
$sel:secure:EnvironmentVariable' :: EnvironmentVariable -> Maybe Bool
secure} -> Maybe Bool
secure) (\s :: EnvironmentVariable
s@EnvironmentVariable' {} Maybe Bool
a -> EnvironmentVariable
s {$sel:secure:EnvironmentVariable' :: Maybe Bool
secure = Maybe Bool
a} :: EnvironmentVariable)
environmentVariable_key :: Lens.Lens' EnvironmentVariable Prelude.Text
environmentVariable_key :: (Text -> f Text) -> EnvironmentVariable -> f EnvironmentVariable
environmentVariable_key = (EnvironmentVariable -> Text)
-> (EnvironmentVariable -> Text -> EnvironmentVariable)
-> Lens EnvironmentVariable EnvironmentVariable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentVariable' {Text
key :: Text
$sel:key:EnvironmentVariable' :: EnvironmentVariable -> Text
key} -> Text
key) (\s :: EnvironmentVariable
s@EnvironmentVariable' {} Text
a -> EnvironmentVariable
s {$sel:key:EnvironmentVariable' :: Text
key = Text
a} :: EnvironmentVariable)
environmentVariable_value :: Lens.Lens' EnvironmentVariable Prelude.Text
environmentVariable_value :: (Text -> f Text) -> EnvironmentVariable -> f EnvironmentVariable
environmentVariable_value = (EnvironmentVariable -> Text)
-> (EnvironmentVariable -> Text -> EnvironmentVariable)
-> Lens EnvironmentVariable EnvironmentVariable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentVariable' {Text
value :: Text
$sel:value:EnvironmentVariable' :: EnvironmentVariable -> Text
value} -> Text
value) (\s :: EnvironmentVariable
s@EnvironmentVariable' {} Text
a -> EnvironmentVariable
s {$sel:value:EnvironmentVariable' :: Text
value = Text
a} :: EnvironmentVariable)
instance Core.FromJSON EnvironmentVariable where
parseJSON :: Value -> Parser EnvironmentVariable
parseJSON =
String
-> (Object -> Parser EnvironmentVariable)
-> Value
-> Parser EnvironmentVariable
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EnvironmentVariable"
( \Object
x ->
Maybe Bool -> Text -> Text -> EnvironmentVariable
EnvironmentVariable'
(Maybe Bool -> Text -> Text -> EnvironmentVariable)
-> Parser (Maybe Bool)
-> Parser (Text -> Text -> EnvironmentVariable)
forall (f :: * -> *) a b. Functor 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
"Secure")
Parser (Text -> Text -> EnvironmentVariable)
-> Parser Text -> Parser (Text -> EnvironmentVariable)
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
"Key")
Parser (Text -> EnvironmentVariable)
-> Parser Text -> Parser EnvironmentVariable
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
"Value")
)
instance Prelude.Hashable EnvironmentVariable
instance Prelude.NFData EnvironmentVariable
instance Core.ToJSON EnvironmentVariable where
toJSON :: EnvironmentVariable -> Value
toJSON EnvironmentVariable' {Maybe Bool
Text
value :: Text
key :: Text
secure :: Maybe Bool
$sel:value:EnvironmentVariable' :: EnvironmentVariable -> Text
$sel:key:EnvironmentVariable' :: EnvironmentVariable -> Text
$sel:secure:EnvironmentVariable' :: EnvironmentVariable -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Secure" 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
secure,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
]
)