{-# 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.AdditionalAttribute
-- 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.AdditionalAttribute 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 additional load balancer attributes.
--
-- /See:/ 'newAdditionalAttribute' smart constructor.
data AdditionalAttribute = AdditionalAttribute'
  { -- | This value of the attribute.
    AdditionalAttribute -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The name of the attribute.
    --
    -- The following attribute is supported.
    --
    -- -   @elb.http.desyncmitigationmode@ - Determines how the load balancer
    --     handles requests that might pose a security risk to your
    --     application. The possible values are @monitor@, @defensive@, and
    --     @strictest@. The default is @defensive@.
    AdditionalAttribute -> Maybe Text
key :: Prelude.Maybe Prelude.Text
  }
  deriving (AdditionalAttribute -> AdditionalAttribute -> Bool
(AdditionalAttribute -> AdditionalAttribute -> Bool)
-> (AdditionalAttribute -> AdditionalAttribute -> Bool)
-> Eq AdditionalAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdditionalAttribute -> AdditionalAttribute -> Bool
$c/= :: AdditionalAttribute -> AdditionalAttribute -> Bool
== :: AdditionalAttribute -> AdditionalAttribute -> Bool
$c== :: AdditionalAttribute -> AdditionalAttribute -> Bool
Prelude.Eq, ReadPrec [AdditionalAttribute]
ReadPrec AdditionalAttribute
Int -> ReadS AdditionalAttribute
ReadS [AdditionalAttribute]
(Int -> ReadS AdditionalAttribute)
-> ReadS [AdditionalAttribute]
-> ReadPrec AdditionalAttribute
-> ReadPrec [AdditionalAttribute]
-> Read AdditionalAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdditionalAttribute]
$creadListPrec :: ReadPrec [AdditionalAttribute]
readPrec :: ReadPrec AdditionalAttribute
$creadPrec :: ReadPrec AdditionalAttribute
readList :: ReadS [AdditionalAttribute]
$creadList :: ReadS [AdditionalAttribute]
readsPrec :: Int -> ReadS AdditionalAttribute
$creadsPrec :: Int -> ReadS AdditionalAttribute
Prelude.Read, Int -> AdditionalAttribute -> ShowS
[AdditionalAttribute] -> ShowS
AdditionalAttribute -> String
(Int -> AdditionalAttribute -> ShowS)
-> (AdditionalAttribute -> String)
-> ([AdditionalAttribute] -> ShowS)
-> Show AdditionalAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdditionalAttribute] -> ShowS
$cshowList :: [AdditionalAttribute] -> ShowS
show :: AdditionalAttribute -> String
$cshow :: AdditionalAttribute -> String
showsPrec :: Int -> AdditionalAttribute -> ShowS
$cshowsPrec :: Int -> AdditionalAttribute -> ShowS
Prelude.Show, (forall x. AdditionalAttribute -> Rep AdditionalAttribute x)
-> (forall x. Rep AdditionalAttribute x -> AdditionalAttribute)
-> Generic AdditionalAttribute
forall x. Rep AdditionalAttribute x -> AdditionalAttribute
forall x. AdditionalAttribute -> Rep AdditionalAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdditionalAttribute x -> AdditionalAttribute
$cfrom :: forall x. AdditionalAttribute -> Rep AdditionalAttribute x
Prelude.Generic)

-- |
-- Create a value of 'AdditionalAttribute' 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:
--
-- 'value', 'additionalAttribute_value' - This value of the attribute.
--
-- 'key', 'additionalAttribute_key' - The name of the attribute.
--
-- The following attribute is supported.
--
-- -   @elb.http.desyncmitigationmode@ - Determines how the load balancer
--     handles requests that might pose a security risk to your
--     application. The possible values are @monitor@, @defensive@, and
--     @strictest@. The default is @defensive@.
newAdditionalAttribute ::
  AdditionalAttribute
newAdditionalAttribute :: AdditionalAttribute
newAdditionalAttribute =
  AdditionalAttribute' :: Maybe Text -> Maybe Text -> AdditionalAttribute
AdditionalAttribute'
    { $sel:value:AdditionalAttribute' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:key:AdditionalAttribute' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The name of the attribute.
--
-- The following attribute is supported.
--
-- -   @elb.http.desyncmitigationmode@ - Determines how the load balancer
--     handles requests that might pose a security risk to your
--     application. The possible values are @monitor@, @defensive@, and
--     @strictest@. The default is @defensive@.
additionalAttribute_key :: Lens.Lens' AdditionalAttribute (Prelude.Maybe Prelude.Text)
additionalAttribute_key :: (Maybe Text -> f (Maybe Text))
-> AdditionalAttribute -> f AdditionalAttribute
additionalAttribute_key = (AdditionalAttribute -> Maybe Text)
-> (AdditionalAttribute -> Maybe Text -> AdditionalAttribute)
-> Lens
     AdditionalAttribute AdditionalAttribute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdditionalAttribute' {Maybe Text
key :: Maybe Text
$sel:key:AdditionalAttribute' :: AdditionalAttribute -> Maybe Text
key} -> Maybe Text
key) (\s :: AdditionalAttribute
s@AdditionalAttribute' {} Maybe Text
a -> AdditionalAttribute
s {$sel:key:AdditionalAttribute' :: Maybe Text
key = Maybe Text
a} :: AdditionalAttribute)

instance Core.FromXML AdditionalAttribute where
  parseXML :: [Node] -> Either String AdditionalAttribute
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> AdditionalAttribute
AdditionalAttribute'
      (Maybe Text -> Maybe Text -> AdditionalAttribute)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> AdditionalAttribute)
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
"Value") Either String (Maybe Text -> AdditionalAttribute)
-> Either String (Maybe Text) -> Either String AdditionalAttribute
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
"Key")

instance Prelude.Hashable AdditionalAttribute

instance Prelude.NFData AdditionalAttribute

instance Core.ToQuery AdditionalAttribute where
  toQuery :: AdditionalAttribute -> QueryString
toQuery AdditionalAttribute' {Maybe Text
key :: Maybe Text
value :: Maybe Text
$sel:key:AdditionalAttribute' :: AdditionalAttribute -> Maybe Text
$sel:value:AdditionalAttribute' :: AdditionalAttribute -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Value" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
value, ByteString
"Key" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
key]