{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudFormation.Types.PhysicalResourceIdContextKeyValuePair 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

-- | 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 aren\'t 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
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]
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
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.
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'
      { $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 :: Lens' PhysicalResourceIdContextKeyValuePair Text
physicalResourceIdContextKeyValuePair_key = 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 :: Lens' PhysicalResourceIdContextKeyValuePair Text
physicalResourceIdContextKeyValuePair_value = 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
  Data.FromXML
    PhysicalResourceIdContextKeyValuePair
  where
  parseXML :: [Node] -> Either String PhysicalResourceIdContextKeyValuePair
parseXML [Node]
x =
    Text -> Text -> PhysicalResourceIdContextKeyValuePair
PhysicalResourceIdContextKeyValuePair'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Key")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Value")

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

instance
  Prelude.NFData
    PhysicalResourceIdContextKeyValuePair
  where
  rnf :: PhysicalResourceIdContextKeyValuePair -> ()
rnf PhysicalResourceIdContextKeyValuePair' {Text
value :: Text
key :: Text
$sel:value:PhysicalResourceIdContextKeyValuePair' :: PhysicalResourceIdContextKeyValuePair -> Text
$sel:key:PhysicalResourceIdContextKeyValuePair' :: PhysicalResourceIdContextKeyValuePair -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
key seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value