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

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

-- | Information about a policy attribute.
--
-- /See:/ 'newPolicyAttribute' smart constructor.
data PolicyAttribute = PolicyAttribute'
  { -- | The value of the attribute.
    PolicyAttribute -> Maybe Text
attributeValue :: Prelude.Maybe Prelude.Text,
    -- | The name of the attribute.
    PolicyAttribute -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text
  }
  deriving (PolicyAttribute -> PolicyAttribute -> Bool
(PolicyAttribute -> PolicyAttribute -> Bool)
-> (PolicyAttribute -> PolicyAttribute -> Bool)
-> Eq PolicyAttribute
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]
(Int -> ReadS PolicyAttribute)
-> ReadS [PolicyAttribute]
-> ReadPrec PolicyAttribute
-> ReadPrec [PolicyAttribute]
-> Read 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
(Int -> PolicyAttribute -> ShowS)
-> (PolicyAttribute -> String)
-> ([PolicyAttribute] -> ShowS)
-> Show PolicyAttribute
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. PolicyAttribute -> Rep PolicyAttribute x)
-> (forall x. Rep PolicyAttribute x -> PolicyAttribute)
-> Generic PolicyAttribute
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:
--
-- 'attributeValue', 'policyAttribute_attributeValue' - The value of the attribute.
--
-- 'attributeName', 'policyAttribute_attributeName' - The name of the attribute.
newPolicyAttribute ::
  PolicyAttribute
newPolicyAttribute :: PolicyAttribute
newPolicyAttribute =
  PolicyAttribute' :: Maybe Text -> Maybe Text -> PolicyAttribute
PolicyAttribute'
    { $sel:attributeValue:PolicyAttribute' :: Maybe Text
attributeValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributeName:PolicyAttribute' :: Maybe Text
attributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value of the attribute.
policyAttribute_attributeValue :: Lens.Lens' PolicyAttribute (Prelude.Maybe Prelude.Text)
policyAttribute_attributeValue :: (Maybe Text -> f (Maybe Text))
-> PolicyAttribute -> f PolicyAttribute
policyAttribute_attributeValue = (PolicyAttribute -> Maybe Text)
-> (PolicyAttribute -> Maybe Text -> PolicyAttribute)
-> Lens PolicyAttribute PolicyAttribute (Maybe Text) (Maybe Text)
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)

-- | The name of the attribute.
policyAttribute_attributeName :: Lens.Lens' PolicyAttribute (Prelude.Maybe Prelude.Text)
policyAttribute_attributeName :: (Maybe Text -> f (Maybe Text))
-> PolicyAttribute -> f PolicyAttribute
policyAttribute_attributeName = (PolicyAttribute -> Maybe Text)
-> (PolicyAttribute -> Maybe Text -> PolicyAttribute)
-> Lens PolicyAttribute PolicyAttribute (Maybe Text) (Maybe Text)
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)

instance Prelude.Hashable PolicyAttribute

instance Prelude.NFData PolicyAttribute

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