{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SSM.Types.MetadataValue
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SSM.Types.MetadataValue 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

-- | Metadata to assign to an Application Manager application.
--
-- /See:/ 'newMetadataValue' smart constructor.
data MetadataValue = MetadataValue'
  { -- | Metadata value to assign to an Application Manager application.
    MetadataValue -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (MetadataValue -> MetadataValue -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'MetadataValue' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'value', 'metadataValue_value' - Metadata value to assign to an Application Manager application.
newMetadataValue ::
  MetadataValue
newMetadataValue :: MetadataValue
newMetadataValue =
  MetadataValue' {$sel:value:MetadataValue' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing}

-- | Metadata value to assign to an Application Manager application.
metadataValue_value :: Lens.Lens' MetadataValue (Prelude.Maybe Prelude.Text)
metadataValue_value :: Lens' MetadataValue (Maybe Text)
metadataValue_value = 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 Data.FromJSON MetadataValue where
  parseJSON :: Value -> Parser MetadataValue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MetadataValue"
      ( \Object
x ->
          Maybe Text -> MetadataValue
MetadataValue' 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
"Value")
      )

instance Prelude.Hashable MetadataValue where
  hashWithSalt :: Int -> MetadataValue -> Int
hashWithSalt Int
_salt MetadataValue' {Maybe Text
value :: Maybe Text
$sel:value:MetadataValue' :: MetadataValue -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData MetadataValue where
  rnf :: MetadataValue -> ()
rnf MetadataValue' {Maybe Text
value :: Maybe Text
$sel:value:MetadataValue' :: MetadataValue -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value

instance Data.ToJSON MetadataValue where
  toJSON :: MetadataValue -> Value
toJSON MetadataValue' {Maybe Text
value :: Maybe Text
$sel:value:MetadataValue' :: MetadataValue -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Value" 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 Text
value]
      )