{-# 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.CloudFormation.Types.PhysicalResourceIdContextKeyValuePair
-- 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.CloudFormation.Types.PhysicalResourceIdContextKeyValuePair where

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

-- | Context information that enables CloudFormation to uniquely identify a
-- resource. CloudFormation uses context key-value pairs in cases where a
-- resource\'s logical and physical IDs are not enough to uniquely identify
-- that resource. Each context key-value pair specifies a resource that
-- contains the targeted resource.
--
-- /See:/ 'newPhysicalResourceIdContextKeyValuePair' smart constructor.
data PhysicalResourceIdContextKeyValuePair = PhysicalResourceIdContextKeyValuePair'
  { -- | The resource context key.
    PhysicalResourceIdContextKeyValuePair -> Text
key :: Prelude.Text,
    -- | The resource context value.
    PhysicalResourceIdContextKeyValuePair -> Text
value :: Prelude.Text
  }
  deriving (PhysicalResourceIdContextKeyValuePair
-> PhysicalResourceIdContextKeyValuePair -> Bool
(PhysicalResourceIdContextKeyValuePair
 -> PhysicalResourceIdContextKeyValuePair -> Bool)
-> (PhysicalResourceIdContextKeyValuePair
    -> PhysicalResourceIdContextKeyValuePair -> Bool)
-> Eq PhysicalResourceIdContextKeyValuePair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalResourceIdContextKeyValuePair
-> PhysicalResourceIdContextKeyValuePair -> Bool
$c/= :: PhysicalResourceIdContextKeyValuePair
-> PhysicalResourceIdContextKeyValuePair -> Bool
== :: PhysicalResourceIdContextKeyValuePair
-> PhysicalResourceIdContextKeyValuePair -> Bool
$c== :: PhysicalResourceIdContextKeyValuePair
-> PhysicalResourceIdContextKeyValuePair -> Bool
Prelude.Eq, ReadPrec [PhysicalResourceIdContextKeyValuePair]
ReadPrec PhysicalResourceIdContextKeyValuePair
Int -> ReadS PhysicalResourceIdContextKeyValuePair
ReadS [PhysicalResourceIdContextKeyValuePair]
(Int -> ReadS PhysicalResourceIdContextKeyValuePair)
-> ReadS [PhysicalResourceIdContextKeyValuePair]
-> ReadPrec PhysicalResourceIdContextKeyValuePair
-> ReadPrec [PhysicalResourceIdContextKeyValuePair]
-> Read PhysicalResourceIdContextKeyValuePair
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhysicalResourceIdContextKeyValuePair]
$creadListPrec :: ReadPrec [PhysicalResourceIdContextKeyValuePair]
readPrec :: ReadPrec PhysicalResourceIdContextKeyValuePair
$creadPrec :: ReadPrec PhysicalResourceIdContextKeyValuePair
readList :: ReadS [PhysicalResourceIdContextKeyValuePair]
$creadList :: ReadS [PhysicalResourceIdContextKeyValuePair]
readsPrec :: Int -> ReadS PhysicalResourceIdContextKeyValuePair
$creadsPrec :: Int -> ReadS PhysicalResourceIdContextKeyValuePair
Prelude.Read, Int -> PhysicalResourceIdContextKeyValuePair -> ShowS
[PhysicalResourceIdContextKeyValuePair] -> ShowS
PhysicalResourceIdContextKeyValuePair -> String
(Int -> PhysicalResourceIdContextKeyValuePair -> ShowS)
-> (PhysicalResourceIdContextKeyValuePair -> String)
-> ([PhysicalResourceIdContextKeyValuePair] -> ShowS)
-> Show PhysicalResourceIdContextKeyValuePair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhysicalResourceIdContextKeyValuePair] -> ShowS
$cshowList :: [PhysicalResourceIdContextKeyValuePair] -> ShowS
show :: PhysicalResourceIdContextKeyValuePair -> String
$cshow :: PhysicalResourceIdContextKeyValuePair -> String
showsPrec :: Int -> PhysicalResourceIdContextKeyValuePair -> ShowS
$cshowsPrec :: Int -> PhysicalResourceIdContextKeyValuePair -> ShowS
Prelude.Show, (forall x.
 PhysicalResourceIdContextKeyValuePair
 -> Rep PhysicalResourceIdContextKeyValuePair x)
-> (forall x.
    Rep PhysicalResourceIdContextKeyValuePair x
    -> PhysicalResourceIdContextKeyValuePair)
-> Generic PhysicalResourceIdContextKeyValuePair
forall x.
Rep PhysicalResourceIdContextKeyValuePair x
-> PhysicalResourceIdContextKeyValuePair
forall x.
PhysicalResourceIdContextKeyValuePair
-> Rep PhysicalResourceIdContextKeyValuePair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PhysicalResourceIdContextKeyValuePair x
-> PhysicalResourceIdContextKeyValuePair
$cfrom :: forall x.
PhysicalResourceIdContextKeyValuePair
-> Rep PhysicalResourceIdContextKeyValuePair x
Prelude.Generic)

-- |
-- Create a value of 'PhysicalResourceIdContextKeyValuePair' 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', 'physicalResourceIdContextKeyValuePair_key' - The resource context key.
--
-- 'value', 'physicalResourceIdContextKeyValuePair_value' - The resource context value.
newPhysicalResourceIdContextKeyValuePair ::
  -- | 'key'
  Prelude.Text ->
  -- | 'value'
  Prelude.Text ->
  PhysicalResourceIdContextKeyValuePair
newPhysicalResourceIdContextKeyValuePair :: Text -> Text -> PhysicalResourceIdContextKeyValuePair
newPhysicalResourceIdContextKeyValuePair
  Text
pKey_
  Text
pValue_ =
    PhysicalResourceIdContextKeyValuePair' :: Text -> Text -> PhysicalResourceIdContextKeyValuePair
PhysicalResourceIdContextKeyValuePair'
      { $sel:key:PhysicalResourceIdContextKeyValuePair' :: Text
key = Text
pKey_,
        $sel:value:PhysicalResourceIdContextKeyValuePair' :: Text
value = Text
pValue_
      }

-- | The resource context key.
physicalResourceIdContextKeyValuePair_key :: Lens.Lens' PhysicalResourceIdContextKeyValuePair Prelude.Text
physicalResourceIdContextKeyValuePair_key :: (Text -> f Text)
-> PhysicalResourceIdContextKeyValuePair
-> f PhysicalResourceIdContextKeyValuePair
physicalResourceIdContextKeyValuePair_key = (PhysicalResourceIdContextKeyValuePair -> Text)
-> (PhysicalResourceIdContextKeyValuePair
    -> Text -> PhysicalResourceIdContextKeyValuePair)
-> Lens
     PhysicalResourceIdContextKeyValuePair
     PhysicalResourceIdContextKeyValuePair
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalResourceIdContextKeyValuePair' {Text
key :: Text
$sel:key:PhysicalResourceIdContextKeyValuePair' :: PhysicalResourceIdContextKeyValuePair -> Text
key} -> Text
key) (\s :: PhysicalResourceIdContextKeyValuePair
s@PhysicalResourceIdContextKeyValuePair' {} Text
a -> PhysicalResourceIdContextKeyValuePair
s {$sel:key:PhysicalResourceIdContextKeyValuePair' :: Text
key = Text
a} :: PhysicalResourceIdContextKeyValuePair)

-- | The resource context value.
physicalResourceIdContextKeyValuePair_value :: Lens.Lens' PhysicalResourceIdContextKeyValuePair Prelude.Text
physicalResourceIdContextKeyValuePair_value :: (Text -> f Text)
-> PhysicalResourceIdContextKeyValuePair
-> f PhysicalResourceIdContextKeyValuePair
physicalResourceIdContextKeyValuePair_value = (PhysicalResourceIdContextKeyValuePair -> Text)
-> (PhysicalResourceIdContextKeyValuePair
    -> Text -> PhysicalResourceIdContextKeyValuePair)
-> Lens
     PhysicalResourceIdContextKeyValuePair
     PhysicalResourceIdContextKeyValuePair
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalResourceIdContextKeyValuePair' {Text
value :: Text
$sel:value:PhysicalResourceIdContextKeyValuePair' :: PhysicalResourceIdContextKeyValuePair -> Text
value} -> Text
value) (\s :: PhysicalResourceIdContextKeyValuePair
s@PhysicalResourceIdContextKeyValuePair' {} Text
a -> PhysicalResourceIdContextKeyValuePair
s {$sel:value:PhysicalResourceIdContextKeyValuePair' :: Text
value = Text
a} :: PhysicalResourceIdContextKeyValuePair)

instance
  Core.FromXML
    PhysicalResourceIdContextKeyValuePair
  where
  parseXML :: [Node] -> Either String PhysicalResourceIdContextKeyValuePair
parseXML [Node]
x =
    Text -> Text -> PhysicalResourceIdContextKeyValuePair
PhysicalResourceIdContextKeyValuePair'
      (Text -> Text -> PhysicalResourceIdContextKeyValuePair)
-> Either String Text
-> Either String (Text -> PhysicalResourceIdContextKeyValuePair)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Key") Either String (Text -> PhysicalResourceIdContextKeyValuePair)
-> Either String Text
-> Either String PhysicalResourceIdContextKeyValuePair
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Value")

instance
  Prelude.Hashable
    PhysicalResourceIdContextKeyValuePair

instance
  Prelude.NFData
    PhysicalResourceIdContextKeyValuePair