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