{-# 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.AppMesh.Types.AwsCloudMapInstanceAttribute
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppMesh.Types.AwsCloudMapInstanceAttribute where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents the Cloud Map attribute information for your
-- virtual node.
--
-- AWS Cloud Map is not available in the eu-south-1 Region.
--
-- /See:/ 'newAwsCloudMapInstanceAttribute' smart constructor.
data AwsCloudMapInstanceAttribute = AwsCloudMapInstanceAttribute'
  { -- | The name of an Cloud Map service instance attribute key. Any Cloud Map
    -- service instance that contains the specified key and value is returned.
    AwsCloudMapInstanceAttribute -> Text
key :: Prelude.Text,
    -- | The value of an Cloud Map service instance attribute key. Any Cloud Map
    -- service instance that contains the specified key and value is returned.
    AwsCloudMapInstanceAttribute -> Text
value :: Prelude.Text
  }
  deriving (AwsCloudMapInstanceAttribute
-> AwsCloudMapInstanceAttribute -> Bool
(AwsCloudMapInstanceAttribute
 -> AwsCloudMapInstanceAttribute -> Bool)
-> (AwsCloudMapInstanceAttribute
    -> AwsCloudMapInstanceAttribute -> Bool)
-> Eq AwsCloudMapInstanceAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCloudMapInstanceAttribute
-> AwsCloudMapInstanceAttribute -> Bool
$c/= :: AwsCloudMapInstanceAttribute
-> AwsCloudMapInstanceAttribute -> Bool
== :: AwsCloudMapInstanceAttribute
-> AwsCloudMapInstanceAttribute -> Bool
$c== :: AwsCloudMapInstanceAttribute
-> AwsCloudMapInstanceAttribute -> Bool
Prelude.Eq, ReadPrec [AwsCloudMapInstanceAttribute]
ReadPrec AwsCloudMapInstanceAttribute
Int -> ReadS AwsCloudMapInstanceAttribute
ReadS [AwsCloudMapInstanceAttribute]
(Int -> ReadS AwsCloudMapInstanceAttribute)
-> ReadS [AwsCloudMapInstanceAttribute]
-> ReadPrec AwsCloudMapInstanceAttribute
-> ReadPrec [AwsCloudMapInstanceAttribute]
-> Read AwsCloudMapInstanceAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCloudMapInstanceAttribute]
$creadListPrec :: ReadPrec [AwsCloudMapInstanceAttribute]
readPrec :: ReadPrec AwsCloudMapInstanceAttribute
$creadPrec :: ReadPrec AwsCloudMapInstanceAttribute
readList :: ReadS [AwsCloudMapInstanceAttribute]
$creadList :: ReadS [AwsCloudMapInstanceAttribute]
readsPrec :: Int -> ReadS AwsCloudMapInstanceAttribute
$creadsPrec :: Int -> ReadS AwsCloudMapInstanceAttribute
Prelude.Read, Int -> AwsCloudMapInstanceAttribute -> ShowS
[AwsCloudMapInstanceAttribute] -> ShowS
AwsCloudMapInstanceAttribute -> String
(Int -> AwsCloudMapInstanceAttribute -> ShowS)
-> (AwsCloudMapInstanceAttribute -> String)
-> ([AwsCloudMapInstanceAttribute] -> ShowS)
-> Show AwsCloudMapInstanceAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCloudMapInstanceAttribute] -> ShowS
$cshowList :: [AwsCloudMapInstanceAttribute] -> ShowS
show :: AwsCloudMapInstanceAttribute -> String
$cshow :: AwsCloudMapInstanceAttribute -> String
showsPrec :: Int -> AwsCloudMapInstanceAttribute -> ShowS
$cshowsPrec :: Int -> AwsCloudMapInstanceAttribute -> ShowS
Prelude.Show, (forall x.
 AwsCloudMapInstanceAttribute -> Rep AwsCloudMapInstanceAttribute x)
-> (forall x.
    Rep AwsCloudMapInstanceAttribute x -> AwsCloudMapInstanceAttribute)
-> Generic AwsCloudMapInstanceAttribute
forall x.
Rep AwsCloudMapInstanceAttribute x -> AwsCloudMapInstanceAttribute
forall x.
AwsCloudMapInstanceAttribute -> Rep AwsCloudMapInstanceAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCloudMapInstanceAttribute x -> AwsCloudMapInstanceAttribute
$cfrom :: forall x.
AwsCloudMapInstanceAttribute -> Rep AwsCloudMapInstanceAttribute x
Prelude.Generic)

-- |
-- Create a value of 'AwsCloudMapInstanceAttribute' 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:
--
-- 'key', 'awsCloudMapInstanceAttribute_key' - The name of an Cloud Map service instance attribute key. Any Cloud Map
-- service instance that contains the specified key and value is returned.
--
-- 'value', 'awsCloudMapInstanceAttribute_value' - The value of an Cloud Map service instance attribute key. Any Cloud Map
-- service instance that contains the specified key and value is returned.
newAwsCloudMapInstanceAttribute ::
  -- | 'key'
  Prelude.Text ->
  -- | 'value'
  Prelude.Text ->
  AwsCloudMapInstanceAttribute
newAwsCloudMapInstanceAttribute :: Text -> Text -> AwsCloudMapInstanceAttribute
newAwsCloudMapInstanceAttribute Text
pKey_ Text
pValue_ =
  AwsCloudMapInstanceAttribute' :: Text -> Text -> AwsCloudMapInstanceAttribute
AwsCloudMapInstanceAttribute'
    { $sel:key:AwsCloudMapInstanceAttribute' :: Text
key = Text
pKey_,
      $sel:value:AwsCloudMapInstanceAttribute' :: Text
value = Text
pValue_
    }

-- | The name of an Cloud Map service instance attribute key. Any Cloud Map
-- service instance that contains the specified key and value is returned.
awsCloudMapInstanceAttribute_key :: Lens.Lens' AwsCloudMapInstanceAttribute Prelude.Text
awsCloudMapInstanceAttribute_key :: (Text -> f Text)
-> AwsCloudMapInstanceAttribute -> f AwsCloudMapInstanceAttribute
awsCloudMapInstanceAttribute_key = (AwsCloudMapInstanceAttribute -> Text)
-> (AwsCloudMapInstanceAttribute
    -> Text -> AwsCloudMapInstanceAttribute)
-> Lens
     AwsCloudMapInstanceAttribute AwsCloudMapInstanceAttribute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudMapInstanceAttribute' {Text
key :: Text
$sel:key:AwsCloudMapInstanceAttribute' :: AwsCloudMapInstanceAttribute -> Text
key} -> Text
key) (\s :: AwsCloudMapInstanceAttribute
s@AwsCloudMapInstanceAttribute' {} Text
a -> AwsCloudMapInstanceAttribute
s {$sel:key:AwsCloudMapInstanceAttribute' :: Text
key = Text
a} :: AwsCloudMapInstanceAttribute)

-- | The value of an Cloud Map service instance attribute key. Any Cloud Map
-- service instance that contains the specified key and value is returned.
awsCloudMapInstanceAttribute_value :: Lens.Lens' AwsCloudMapInstanceAttribute Prelude.Text
awsCloudMapInstanceAttribute_value :: (Text -> f Text)
-> AwsCloudMapInstanceAttribute -> f AwsCloudMapInstanceAttribute
awsCloudMapInstanceAttribute_value = (AwsCloudMapInstanceAttribute -> Text)
-> (AwsCloudMapInstanceAttribute
    -> Text -> AwsCloudMapInstanceAttribute)
-> Lens
     AwsCloudMapInstanceAttribute AwsCloudMapInstanceAttribute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudMapInstanceAttribute' {Text
value :: Text
$sel:value:AwsCloudMapInstanceAttribute' :: AwsCloudMapInstanceAttribute -> Text
value} -> Text
value) (\s :: AwsCloudMapInstanceAttribute
s@AwsCloudMapInstanceAttribute' {} Text
a -> AwsCloudMapInstanceAttribute
s {$sel:value:AwsCloudMapInstanceAttribute' :: Text
value = Text
a} :: AwsCloudMapInstanceAttribute)

instance Core.FromJSON AwsCloudMapInstanceAttribute where
  parseJSON :: Value -> Parser AwsCloudMapInstanceAttribute
parseJSON =
    String
-> (Object -> Parser AwsCloudMapInstanceAttribute)
-> Value
-> Parser AwsCloudMapInstanceAttribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCloudMapInstanceAttribute"
      ( \Object
x ->
          Text -> Text -> AwsCloudMapInstanceAttribute
AwsCloudMapInstanceAttribute'
            (Text -> Text -> AwsCloudMapInstanceAttribute)
-> Parser Text -> Parser (Text -> AwsCloudMapInstanceAttribute)
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
"key") Parser (Text -> AwsCloudMapInstanceAttribute)
-> Parser Text -> Parser AwsCloudMapInstanceAttribute
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
    AwsCloudMapInstanceAttribute

instance Prelude.NFData AwsCloudMapInstanceAttribute

instance Core.ToJSON AwsCloudMapInstanceAttribute where
  toJSON :: AwsCloudMapInstanceAttribute -> Value
toJSON AwsCloudMapInstanceAttribute' {Text
value :: Text
key :: Text
$sel:value:AwsCloudMapInstanceAttribute' :: AwsCloudMapInstanceAttribute -> Text
$sel:key:AwsCloudMapInstanceAttribute' :: AwsCloudMapInstanceAttribute -> 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
"key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key),
            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)
          ]
      )