{-# 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.EC2.Types.IpamResourceTag
-- 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.EC2.Types.IpamResourceTag where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | The key\/value combination of a tag assigned to the resource. Use the
-- tag key in the filter name and the tag value as the filter value. For
-- example, to find all resources that have a tag with the key @Owner@ and
-- the value @TeamA@, specify @tag:Owner@ for the filter name and @TeamA@
-- for the filter value.
--
-- /See:/ 'newIpamResourceTag' smart constructor.
data IpamResourceTag = IpamResourceTag'
  { -- | The key of a tag assigned to the resource. Use this filter to find all
    -- resources assigned a tag with a specific key, regardless of the tag
    -- value.
    IpamResourceTag -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | The value of the tag.
    IpamResourceTag -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (IpamResourceTag -> IpamResourceTag -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IpamResourceTag -> IpamResourceTag -> Bool
$c/= :: IpamResourceTag -> IpamResourceTag -> Bool
== :: IpamResourceTag -> IpamResourceTag -> Bool
$c== :: IpamResourceTag -> IpamResourceTag -> Bool
Prelude.Eq, ReadPrec [IpamResourceTag]
ReadPrec IpamResourceTag
Int -> ReadS IpamResourceTag
ReadS [IpamResourceTag]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IpamResourceTag]
$creadListPrec :: ReadPrec [IpamResourceTag]
readPrec :: ReadPrec IpamResourceTag
$creadPrec :: ReadPrec IpamResourceTag
readList :: ReadS [IpamResourceTag]
$creadList :: ReadS [IpamResourceTag]
readsPrec :: Int -> ReadS IpamResourceTag
$creadsPrec :: Int -> ReadS IpamResourceTag
Prelude.Read, Int -> IpamResourceTag -> ShowS
[IpamResourceTag] -> ShowS
IpamResourceTag -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IpamResourceTag] -> ShowS
$cshowList :: [IpamResourceTag] -> ShowS
show :: IpamResourceTag -> String
$cshow :: IpamResourceTag -> String
showsPrec :: Int -> IpamResourceTag -> ShowS
$cshowsPrec :: Int -> IpamResourceTag -> ShowS
Prelude.Show, forall x. Rep IpamResourceTag x -> IpamResourceTag
forall x. IpamResourceTag -> Rep IpamResourceTag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IpamResourceTag x -> IpamResourceTag
$cfrom :: forall x. IpamResourceTag -> Rep IpamResourceTag x
Prelude.Generic)

-- |
-- Create a value of 'IpamResourceTag' 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', 'ipamResourceTag_key' - The key of a tag assigned to the resource. Use this filter to find all
-- resources assigned a tag with a specific key, regardless of the tag
-- value.
--
-- 'value', 'ipamResourceTag_value' - The value of the tag.
newIpamResourceTag ::
  IpamResourceTag
newIpamResourceTag :: IpamResourceTag
newIpamResourceTag =
  IpamResourceTag'
    { $sel:key:IpamResourceTag' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:value:IpamResourceTag' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The key of a tag assigned to the resource. Use this filter to find all
-- resources assigned a tag with a specific key, regardless of the tag
-- value.
ipamResourceTag_key :: Lens.Lens' IpamResourceTag (Prelude.Maybe Prelude.Text)
ipamResourceTag_key :: Lens' IpamResourceTag (Maybe Text)
ipamResourceTag_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpamResourceTag' {Maybe Text
key :: Maybe Text
$sel:key:IpamResourceTag' :: IpamResourceTag -> Maybe Text
key} -> Maybe Text
key) (\s :: IpamResourceTag
s@IpamResourceTag' {} Maybe Text
a -> IpamResourceTag
s {$sel:key:IpamResourceTag' :: Maybe Text
key = Maybe Text
a} :: IpamResourceTag)

-- | The value of the tag.
ipamResourceTag_value :: Lens.Lens' IpamResourceTag (Prelude.Maybe Prelude.Text)
ipamResourceTag_value :: Lens' IpamResourceTag (Maybe Text)
ipamResourceTag_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpamResourceTag' {Maybe Text
value :: Maybe Text
$sel:value:IpamResourceTag' :: IpamResourceTag -> Maybe Text
value} -> Maybe Text
value) (\s :: IpamResourceTag
s@IpamResourceTag' {} Maybe Text
a -> IpamResourceTag
s {$sel:value:IpamResourceTag' :: Maybe Text
value = Maybe Text
a} :: IpamResourceTag)

instance Data.FromXML IpamResourceTag where
  parseXML :: [Node] -> Either String IpamResourceTag
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> IpamResourceTag
IpamResourceTag'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe 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 (Maybe a)
Data..@? Text
"value")

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

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