{-# 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.ELB.Types.PolicyAttribute
-- 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.ELB.Types.PolicyAttribute where

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

-- | Information about a policy attribute.
--
-- /See:/ 'newPolicyAttribute' smart constructor.
data PolicyAttribute = PolicyAttribute'
  { -- | The name of the attribute.
    PolicyAttribute -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
    -- | The value of the attribute.
    PolicyAttribute -> Maybe Text
attributeValue :: Prelude.Maybe Prelude.Text
  }
  deriving (PolicyAttribute -> PolicyAttribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyAttribute -> PolicyAttribute -> Bool
$c/= :: PolicyAttribute -> PolicyAttribute -> Bool
== :: PolicyAttribute -> PolicyAttribute -> Bool
$c== :: PolicyAttribute -> PolicyAttribute -> Bool
Prelude.Eq, ReadPrec [PolicyAttribute]
ReadPrec PolicyAttribute
Int -> ReadS PolicyAttribute
ReadS [PolicyAttribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyAttribute]
$creadListPrec :: ReadPrec [PolicyAttribute]
readPrec :: ReadPrec PolicyAttribute
$creadPrec :: ReadPrec PolicyAttribute
readList :: ReadS [PolicyAttribute]
$creadList :: ReadS [PolicyAttribute]
readsPrec :: Int -> ReadS PolicyAttribute
$creadsPrec :: Int -> ReadS PolicyAttribute
Prelude.Read, Int -> PolicyAttribute -> ShowS
[PolicyAttribute] -> ShowS
PolicyAttribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyAttribute] -> ShowS
$cshowList :: [PolicyAttribute] -> ShowS
show :: PolicyAttribute -> String
$cshow :: PolicyAttribute -> String
showsPrec :: Int -> PolicyAttribute -> ShowS
$cshowsPrec :: Int -> PolicyAttribute -> ShowS
Prelude.Show, forall x. Rep PolicyAttribute x -> PolicyAttribute
forall x. PolicyAttribute -> Rep PolicyAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyAttribute x -> PolicyAttribute
$cfrom :: forall x. PolicyAttribute -> Rep PolicyAttribute x
Prelude.Generic)

-- |
-- Create a value of 'PolicyAttribute' 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:
--
-- 'attributeName', 'policyAttribute_attributeName' - The name of the attribute.
--
-- 'attributeValue', 'policyAttribute_attributeValue' - The value of the attribute.
newPolicyAttribute ::
  PolicyAttribute
newPolicyAttribute :: PolicyAttribute
newPolicyAttribute =
  PolicyAttribute'
    { $sel:attributeName:PolicyAttribute' :: Maybe Text
attributeName = forall a. Maybe a
Prelude.Nothing,
      $sel:attributeValue:PolicyAttribute' :: Maybe Text
attributeValue = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the attribute.
policyAttribute_attributeName :: Lens.Lens' PolicyAttribute (Prelude.Maybe Prelude.Text)
policyAttribute_attributeName :: Lens' PolicyAttribute (Maybe Text)
policyAttribute_attributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyAttribute' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:PolicyAttribute' :: PolicyAttribute -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: PolicyAttribute
s@PolicyAttribute' {} Maybe Text
a -> PolicyAttribute
s {$sel:attributeName:PolicyAttribute' :: Maybe Text
attributeName = Maybe Text
a} :: PolicyAttribute)

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

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

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

instance Data.ToQuery PolicyAttribute where
  toQuery :: PolicyAttribute -> QueryString
toQuery PolicyAttribute' {Maybe Text
attributeValue :: Maybe Text
attributeName :: Maybe Text
$sel:attributeValue:PolicyAttribute' :: PolicyAttribute -> Maybe Text
$sel:attributeName:PolicyAttribute' :: PolicyAttribute -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"AttributeName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
attributeName,
        ByteString
"AttributeValue" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
attributeValue
      ]