{-# 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.PolicyAttributeTypeDescription
-- 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.PolicyAttributeTypeDescription 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 type.
--
-- /See:/ 'newPolicyAttributeTypeDescription' smart constructor.
data PolicyAttributeTypeDescription = PolicyAttributeTypeDescription'
  { -- | The type of the attribute. For example, @Boolean@ or @Integer@.
    PolicyAttributeTypeDescription -> Maybe Text
attributeType :: Prelude.Maybe Prelude.Text,
    -- | The cardinality of the attribute.
    --
    -- Valid values:
    --
    -- -   ONE(1) : Single value required
    --
    -- -   ZERO_OR_ONE(0..1) : Up to one value is allowed
    --
    -- -   ZERO_OR_MORE(0..*) : Optional. Multiple values are allowed
    --
    -- -   ONE_OR_MORE(1..*0) : Required. Multiple values are allowed
    PolicyAttributeTypeDescription -> Maybe Text
cardinality :: Prelude.Maybe Prelude.Text,
    -- | The default value of the attribute, if applicable.
    PolicyAttributeTypeDescription -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
    -- | The name of the attribute.
    PolicyAttributeTypeDescription -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
    -- | A description of the attribute.
    PolicyAttributeTypeDescription -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (PolicyAttributeTypeDescription
-> PolicyAttributeTypeDescription -> Bool
(PolicyAttributeTypeDescription
 -> PolicyAttributeTypeDescription -> Bool)
-> (PolicyAttributeTypeDescription
    -> PolicyAttributeTypeDescription -> Bool)
-> Eq PolicyAttributeTypeDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyAttributeTypeDescription
-> PolicyAttributeTypeDescription -> Bool
$c/= :: PolicyAttributeTypeDescription
-> PolicyAttributeTypeDescription -> Bool
== :: PolicyAttributeTypeDescription
-> PolicyAttributeTypeDescription -> Bool
$c== :: PolicyAttributeTypeDescription
-> PolicyAttributeTypeDescription -> Bool
Prelude.Eq, ReadPrec [PolicyAttributeTypeDescription]
ReadPrec PolicyAttributeTypeDescription
Int -> ReadS PolicyAttributeTypeDescription
ReadS [PolicyAttributeTypeDescription]
(Int -> ReadS PolicyAttributeTypeDescription)
-> ReadS [PolicyAttributeTypeDescription]
-> ReadPrec PolicyAttributeTypeDescription
-> ReadPrec [PolicyAttributeTypeDescription]
-> Read PolicyAttributeTypeDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyAttributeTypeDescription]
$creadListPrec :: ReadPrec [PolicyAttributeTypeDescription]
readPrec :: ReadPrec PolicyAttributeTypeDescription
$creadPrec :: ReadPrec PolicyAttributeTypeDescription
readList :: ReadS [PolicyAttributeTypeDescription]
$creadList :: ReadS [PolicyAttributeTypeDescription]
readsPrec :: Int -> ReadS PolicyAttributeTypeDescription
$creadsPrec :: Int -> ReadS PolicyAttributeTypeDescription
Prelude.Read, Int -> PolicyAttributeTypeDescription -> ShowS
[PolicyAttributeTypeDescription] -> ShowS
PolicyAttributeTypeDescription -> String
(Int -> PolicyAttributeTypeDescription -> ShowS)
-> (PolicyAttributeTypeDescription -> String)
-> ([PolicyAttributeTypeDescription] -> ShowS)
-> Show PolicyAttributeTypeDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyAttributeTypeDescription] -> ShowS
$cshowList :: [PolicyAttributeTypeDescription] -> ShowS
show :: PolicyAttributeTypeDescription -> String
$cshow :: PolicyAttributeTypeDescription -> String
showsPrec :: Int -> PolicyAttributeTypeDescription -> ShowS
$cshowsPrec :: Int -> PolicyAttributeTypeDescription -> ShowS
Prelude.Show, (forall x.
 PolicyAttributeTypeDescription
 -> Rep PolicyAttributeTypeDescription x)
-> (forall x.
    Rep PolicyAttributeTypeDescription x
    -> PolicyAttributeTypeDescription)
-> Generic PolicyAttributeTypeDescription
forall x.
Rep PolicyAttributeTypeDescription x
-> PolicyAttributeTypeDescription
forall x.
PolicyAttributeTypeDescription
-> Rep PolicyAttributeTypeDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PolicyAttributeTypeDescription x
-> PolicyAttributeTypeDescription
$cfrom :: forall x.
PolicyAttributeTypeDescription
-> Rep PolicyAttributeTypeDescription x
Prelude.Generic)

-- |
-- Create a value of 'PolicyAttributeTypeDescription' 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:
--
-- 'attributeType', 'policyAttributeTypeDescription_attributeType' - The type of the attribute. For example, @Boolean@ or @Integer@.
--
-- 'cardinality', 'policyAttributeTypeDescription_cardinality' - The cardinality of the attribute.
--
-- Valid values:
--
-- -   ONE(1) : Single value required
--
-- -   ZERO_OR_ONE(0..1) : Up to one value is allowed
--
-- -   ZERO_OR_MORE(0..*) : Optional. Multiple values are allowed
--
-- -   ONE_OR_MORE(1..*0) : Required. Multiple values are allowed
--
-- 'defaultValue', 'policyAttributeTypeDescription_defaultValue' - The default value of the attribute, if applicable.
--
-- 'attributeName', 'policyAttributeTypeDescription_attributeName' - The name of the attribute.
--
-- 'description', 'policyAttributeTypeDescription_description' - A description of the attribute.
newPolicyAttributeTypeDescription ::
  PolicyAttributeTypeDescription
newPolicyAttributeTypeDescription :: PolicyAttributeTypeDescription
newPolicyAttributeTypeDescription =
  PolicyAttributeTypeDescription' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PolicyAttributeTypeDescription
PolicyAttributeTypeDescription'
    { $sel:attributeType:PolicyAttributeTypeDescription' :: Maybe Text
attributeType =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cardinality:PolicyAttributeTypeDescription' :: Maybe Text
cardinality = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValue:PolicyAttributeTypeDescription' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributeName:PolicyAttributeTypeDescription' :: Maybe Text
attributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:PolicyAttributeTypeDescription' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of the attribute. For example, @Boolean@ or @Integer@.
policyAttributeTypeDescription_attributeType :: Lens.Lens' PolicyAttributeTypeDescription (Prelude.Maybe Prelude.Text)
policyAttributeTypeDescription_attributeType :: (Maybe Text -> f (Maybe Text))
-> PolicyAttributeTypeDescription
-> f PolicyAttributeTypeDescription
policyAttributeTypeDescription_attributeType = (PolicyAttributeTypeDescription -> Maybe Text)
-> (PolicyAttributeTypeDescription
    -> Maybe Text -> PolicyAttributeTypeDescription)
-> Lens
     PolicyAttributeTypeDescription
     PolicyAttributeTypeDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyAttributeTypeDescription' {Maybe Text
attributeType :: Maybe Text
$sel:attributeType:PolicyAttributeTypeDescription' :: PolicyAttributeTypeDescription -> Maybe Text
attributeType} -> Maybe Text
attributeType) (\s :: PolicyAttributeTypeDescription
s@PolicyAttributeTypeDescription' {} Maybe Text
a -> PolicyAttributeTypeDescription
s {$sel:attributeType:PolicyAttributeTypeDescription' :: Maybe Text
attributeType = Maybe Text
a} :: PolicyAttributeTypeDescription)

-- | The cardinality of the attribute.
--
-- Valid values:
--
-- -   ONE(1) : Single value required
--
-- -   ZERO_OR_ONE(0..1) : Up to one value is allowed
--
-- -   ZERO_OR_MORE(0..*) : Optional. Multiple values are allowed
--
-- -   ONE_OR_MORE(1..*0) : Required. Multiple values are allowed
policyAttributeTypeDescription_cardinality :: Lens.Lens' PolicyAttributeTypeDescription (Prelude.Maybe Prelude.Text)
policyAttributeTypeDescription_cardinality :: (Maybe Text -> f (Maybe Text))
-> PolicyAttributeTypeDescription
-> f PolicyAttributeTypeDescription
policyAttributeTypeDescription_cardinality = (PolicyAttributeTypeDescription -> Maybe Text)
-> (PolicyAttributeTypeDescription
    -> Maybe Text -> PolicyAttributeTypeDescription)
-> Lens
     PolicyAttributeTypeDescription
     PolicyAttributeTypeDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyAttributeTypeDescription' {Maybe Text
cardinality :: Maybe Text
$sel:cardinality:PolicyAttributeTypeDescription' :: PolicyAttributeTypeDescription -> Maybe Text
cardinality} -> Maybe Text
cardinality) (\s :: PolicyAttributeTypeDescription
s@PolicyAttributeTypeDescription' {} Maybe Text
a -> PolicyAttributeTypeDescription
s {$sel:cardinality:PolicyAttributeTypeDescription' :: Maybe Text
cardinality = Maybe Text
a} :: PolicyAttributeTypeDescription)

-- | The default value of the attribute, if applicable.
policyAttributeTypeDescription_defaultValue :: Lens.Lens' PolicyAttributeTypeDescription (Prelude.Maybe Prelude.Text)
policyAttributeTypeDescription_defaultValue :: (Maybe Text -> f (Maybe Text))
-> PolicyAttributeTypeDescription
-> f PolicyAttributeTypeDescription
policyAttributeTypeDescription_defaultValue = (PolicyAttributeTypeDescription -> Maybe Text)
-> (PolicyAttributeTypeDescription
    -> Maybe Text -> PolicyAttributeTypeDescription)
-> Lens
     PolicyAttributeTypeDescription
     PolicyAttributeTypeDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyAttributeTypeDescription' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:PolicyAttributeTypeDescription' :: PolicyAttributeTypeDescription -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: PolicyAttributeTypeDescription
s@PolicyAttributeTypeDescription' {} Maybe Text
a -> PolicyAttributeTypeDescription
s {$sel:defaultValue:PolicyAttributeTypeDescription' :: Maybe Text
defaultValue = Maybe Text
a} :: PolicyAttributeTypeDescription)

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

-- | A description of the attribute.
policyAttributeTypeDescription_description :: Lens.Lens' PolicyAttributeTypeDescription (Prelude.Maybe Prelude.Text)
policyAttributeTypeDescription_description :: (Maybe Text -> f (Maybe Text))
-> PolicyAttributeTypeDescription
-> f PolicyAttributeTypeDescription
policyAttributeTypeDescription_description = (PolicyAttributeTypeDescription -> Maybe Text)
-> (PolicyAttributeTypeDescription
    -> Maybe Text -> PolicyAttributeTypeDescription)
-> Lens
     PolicyAttributeTypeDescription
     PolicyAttributeTypeDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyAttributeTypeDescription' {Maybe Text
description :: Maybe Text
$sel:description:PolicyAttributeTypeDescription' :: PolicyAttributeTypeDescription -> Maybe Text
description} -> Maybe Text
description) (\s :: PolicyAttributeTypeDescription
s@PolicyAttributeTypeDescription' {} Maybe Text
a -> PolicyAttributeTypeDescription
s {$sel:description:PolicyAttributeTypeDescription' :: Maybe Text
description = Maybe Text
a} :: PolicyAttributeTypeDescription)

instance Core.FromXML PolicyAttributeTypeDescription where
  parseXML :: [Node] -> Either String PolicyAttributeTypeDescription
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PolicyAttributeTypeDescription
PolicyAttributeTypeDescription'
      (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> PolicyAttributeTypeDescription)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PolicyAttributeTypeDescription)
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
"AttributeType")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PolicyAttributeTypeDescription)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> PolicyAttributeTypeDescription)
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
"Cardinality")
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> PolicyAttributeTypeDescription)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> PolicyAttributeTypeDescription)
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
"DefaultValue")
      Either
  String (Maybe Text -> Maybe Text -> PolicyAttributeTypeDescription)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> PolicyAttributeTypeDescription)
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")
      Either String (Maybe Text -> PolicyAttributeTypeDescription)
-> Either String (Maybe Text)
-> Either String PolicyAttributeTypeDescription
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
"Description")

instance
  Prelude.Hashable
    PolicyAttributeTypeDescription

instance
  Prelude.NFData
    PolicyAttributeTypeDescription