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