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

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

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

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

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

instance Prelude.Hashable PolicyAttributeDescription

instance Prelude.NFData PolicyAttributeDescription