{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:secure:EnvironmentVariable' :: Maybe Bool
secure = 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 :: Lens' EnvironmentVariable (Maybe Bool)
environmentVariable_secure = 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 :: Lens' EnvironmentVariable Text
environmentVariable_key = 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 :: Lens' EnvironmentVariable Text
environmentVariable_value = 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 Data.FromJSON EnvironmentVariable where
parseJSON :: Value -> Parser EnvironmentVariable
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EnvironmentVariable"
( \Object
x ->
Maybe Bool -> Text -> Text -> EnvironmentVariable
EnvironmentVariable'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Secure")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Key")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Value")
)
instance Prelude.Hashable EnvironmentVariable where
hashWithSalt :: Int -> EnvironmentVariable -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
secure
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
key
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value
instance Prelude.NFData EnvironmentVariable where
rnf :: EnvironmentVariable -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
secure
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
key
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Secure" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
secure,
forall a. a -> Maybe a
Prelude.Just (Key
"Key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
key),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)
]
)