{-# 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.PolicyTypeDescription
-- 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.PolicyTypeDescription where

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

-- | Information about a policy type.
--
-- /See:/ 'newPolicyTypeDescription' smart constructor.
data PolicyTypeDescription = PolicyTypeDescription'
  { -- | The name of the policy type.
    PolicyTypeDescription -> Maybe Text
policyTypeName :: Prelude.Maybe Prelude.Text,
    -- | A description of the policy type.
    PolicyTypeDescription -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The description of the policy attributes associated with the policies
    -- defined by Elastic Load Balancing.
    PolicyTypeDescription -> Maybe [PolicyAttributeTypeDescription]
policyAttributeTypeDescriptions :: Prelude.Maybe [PolicyAttributeTypeDescription]
  }
  deriving (PolicyTypeDescription -> PolicyTypeDescription -> Bool
(PolicyTypeDescription -> PolicyTypeDescription -> Bool)
-> (PolicyTypeDescription -> PolicyTypeDescription -> Bool)
-> Eq PolicyTypeDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyTypeDescription -> PolicyTypeDescription -> Bool
$c/= :: PolicyTypeDescription -> PolicyTypeDescription -> Bool
== :: PolicyTypeDescription -> PolicyTypeDescription -> Bool
$c== :: PolicyTypeDescription -> PolicyTypeDescription -> Bool
Prelude.Eq, ReadPrec [PolicyTypeDescription]
ReadPrec PolicyTypeDescription
Int -> ReadS PolicyTypeDescription
ReadS [PolicyTypeDescription]
(Int -> ReadS PolicyTypeDescription)
-> ReadS [PolicyTypeDescription]
-> ReadPrec PolicyTypeDescription
-> ReadPrec [PolicyTypeDescription]
-> Read PolicyTypeDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyTypeDescription]
$creadListPrec :: ReadPrec [PolicyTypeDescription]
readPrec :: ReadPrec PolicyTypeDescription
$creadPrec :: ReadPrec PolicyTypeDescription
readList :: ReadS [PolicyTypeDescription]
$creadList :: ReadS [PolicyTypeDescription]
readsPrec :: Int -> ReadS PolicyTypeDescription
$creadsPrec :: Int -> ReadS PolicyTypeDescription
Prelude.Read, Int -> PolicyTypeDescription -> ShowS
[PolicyTypeDescription] -> ShowS
PolicyTypeDescription -> String
(Int -> PolicyTypeDescription -> ShowS)
-> (PolicyTypeDescription -> String)
-> ([PolicyTypeDescription] -> ShowS)
-> Show PolicyTypeDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyTypeDescription] -> ShowS
$cshowList :: [PolicyTypeDescription] -> ShowS
show :: PolicyTypeDescription -> String
$cshow :: PolicyTypeDescription -> String
showsPrec :: Int -> PolicyTypeDescription -> ShowS
$cshowsPrec :: Int -> PolicyTypeDescription -> ShowS
Prelude.Show, (forall x. PolicyTypeDescription -> Rep PolicyTypeDescription x)
-> (forall x. Rep PolicyTypeDescription x -> PolicyTypeDescription)
-> Generic PolicyTypeDescription
forall x. Rep PolicyTypeDescription x -> PolicyTypeDescription
forall x. PolicyTypeDescription -> Rep PolicyTypeDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyTypeDescription x -> PolicyTypeDescription
$cfrom :: forall x. PolicyTypeDescription -> Rep PolicyTypeDescription x
Prelude.Generic)

-- |
-- Create a value of 'PolicyTypeDescription' 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:
--
-- 'policyTypeName', 'policyTypeDescription_policyTypeName' - The name of the policy type.
--
-- 'description', 'policyTypeDescription_description' - A description of the policy type.
--
-- 'policyAttributeTypeDescriptions', 'policyTypeDescription_policyAttributeTypeDescriptions' - The description of the policy attributes associated with the policies
-- defined by Elastic Load Balancing.
newPolicyTypeDescription ::
  PolicyTypeDescription
newPolicyTypeDescription :: PolicyTypeDescription
newPolicyTypeDescription =
  PolicyTypeDescription' :: Maybe Text
-> Maybe Text
-> Maybe [PolicyAttributeTypeDescription]
-> PolicyTypeDescription
PolicyTypeDescription'
    { $sel:policyTypeName:PolicyTypeDescription' :: Maybe Text
policyTypeName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:PolicyTypeDescription' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyAttributeTypeDescriptions:PolicyTypeDescription' :: Maybe [PolicyAttributeTypeDescription]
policyAttributeTypeDescriptions = Maybe [PolicyAttributeTypeDescription]
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the policy type.
policyTypeDescription_policyTypeName :: Lens.Lens' PolicyTypeDescription (Prelude.Maybe Prelude.Text)
policyTypeDescription_policyTypeName :: (Maybe Text -> f (Maybe Text))
-> PolicyTypeDescription -> f PolicyTypeDescription
policyTypeDescription_policyTypeName = (PolicyTypeDescription -> Maybe Text)
-> (PolicyTypeDescription -> Maybe Text -> PolicyTypeDescription)
-> Lens
     PolicyTypeDescription
     PolicyTypeDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyTypeDescription' {Maybe Text
policyTypeName :: Maybe Text
$sel:policyTypeName:PolicyTypeDescription' :: PolicyTypeDescription -> Maybe Text
policyTypeName} -> Maybe Text
policyTypeName) (\s :: PolicyTypeDescription
s@PolicyTypeDescription' {} Maybe Text
a -> PolicyTypeDescription
s {$sel:policyTypeName:PolicyTypeDescription' :: Maybe Text
policyTypeName = Maybe Text
a} :: PolicyTypeDescription)

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

-- | The description of the policy attributes associated with the policies
-- defined by Elastic Load Balancing.
policyTypeDescription_policyAttributeTypeDescriptions :: Lens.Lens' PolicyTypeDescription (Prelude.Maybe [PolicyAttributeTypeDescription])
policyTypeDescription_policyAttributeTypeDescriptions :: (Maybe [PolicyAttributeTypeDescription]
 -> f (Maybe [PolicyAttributeTypeDescription]))
-> PolicyTypeDescription -> f PolicyTypeDescription
policyTypeDescription_policyAttributeTypeDescriptions = (PolicyTypeDescription -> Maybe [PolicyAttributeTypeDescription])
-> (PolicyTypeDescription
    -> Maybe [PolicyAttributeTypeDescription] -> PolicyTypeDescription)
-> Lens
     PolicyTypeDescription
     PolicyTypeDescription
     (Maybe [PolicyAttributeTypeDescription])
     (Maybe [PolicyAttributeTypeDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyTypeDescription' {Maybe [PolicyAttributeTypeDescription]
policyAttributeTypeDescriptions :: Maybe [PolicyAttributeTypeDescription]
$sel:policyAttributeTypeDescriptions:PolicyTypeDescription' :: PolicyTypeDescription -> Maybe [PolicyAttributeTypeDescription]
policyAttributeTypeDescriptions} -> Maybe [PolicyAttributeTypeDescription]
policyAttributeTypeDescriptions) (\s :: PolicyTypeDescription
s@PolicyTypeDescription' {} Maybe [PolicyAttributeTypeDescription]
a -> PolicyTypeDescription
s {$sel:policyAttributeTypeDescriptions:PolicyTypeDescription' :: Maybe [PolicyAttributeTypeDescription]
policyAttributeTypeDescriptions = Maybe [PolicyAttributeTypeDescription]
a} :: PolicyTypeDescription) ((Maybe [PolicyAttributeTypeDescription]
  -> f (Maybe [PolicyAttributeTypeDescription]))
 -> PolicyTypeDescription -> f PolicyTypeDescription)
-> ((Maybe [PolicyAttributeTypeDescription]
     -> f (Maybe [PolicyAttributeTypeDescription]))
    -> Maybe [PolicyAttributeTypeDescription]
    -> f (Maybe [PolicyAttributeTypeDescription]))
-> (Maybe [PolicyAttributeTypeDescription]
    -> f (Maybe [PolicyAttributeTypeDescription]))
-> PolicyTypeDescription
-> f PolicyTypeDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PolicyAttributeTypeDescription]
  [PolicyAttributeTypeDescription]
  [PolicyAttributeTypeDescription]
  [PolicyAttributeTypeDescription]
-> Iso
     (Maybe [PolicyAttributeTypeDescription])
     (Maybe [PolicyAttributeTypeDescription])
     (Maybe [PolicyAttributeTypeDescription])
     (Maybe [PolicyAttributeTypeDescription])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [PolicyAttributeTypeDescription]
  [PolicyAttributeTypeDescription]
  [PolicyAttributeTypeDescription]
  [PolicyAttributeTypeDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromXML PolicyTypeDescription where
  parseXML :: [Node] -> Either String PolicyTypeDescription
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe [PolicyAttributeTypeDescription]
-> PolicyTypeDescription
PolicyTypeDescription'
      (Maybe Text
 -> Maybe Text
 -> Maybe [PolicyAttributeTypeDescription]
 -> PolicyTypeDescription)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe [PolicyAttributeTypeDescription] -> PolicyTypeDescription)
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
"PolicyTypeName")
      Either
  String
  (Maybe Text
   -> Maybe [PolicyAttributeTypeDescription] -> PolicyTypeDescription)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [PolicyAttributeTypeDescription] -> PolicyTypeDescription)
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")
      Either
  String
  (Maybe [PolicyAttributeTypeDescription] -> PolicyTypeDescription)
-> Either String (Maybe [PolicyAttributeTypeDescription])
-> Either String PolicyTypeDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyAttributeTypeDescriptions"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node]
    -> Either String (Maybe [PolicyAttributeTypeDescription]))
-> Either String (Maybe [PolicyAttributeTypeDescription])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [PolicyAttributeTypeDescription])
-> [Node] -> Either String (Maybe [PolicyAttributeTypeDescription])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [PolicyAttributeTypeDescription]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )

instance Prelude.Hashable PolicyTypeDescription

instance Prelude.NFData PolicyTypeDescription