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