{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ELB.Types.AdditionalAttribute where

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

-- | Information about additional load balancer attributes.
--
-- /See:/ 'newAdditionalAttribute' smart constructor.
data AdditionalAttribute = 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 -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | This value of the attribute.
    AdditionalAttribute -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (AdditionalAttribute -> AdditionalAttribute -> Bool
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]
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
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. 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:
--
-- '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@.
--
-- 'value', 'additionalAttribute_value' - This value of the attribute.
newAdditionalAttribute ::
  AdditionalAttribute
newAdditionalAttribute :: AdditionalAttribute
newAdditionalAttribute =
  AdditionalAttribute'
    { $sel:key:AdditionalAttribute' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:value:AdditionalAttribute' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' AdditionalAttribute (Maybe Text)
additionalAttribute_key = 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)

-- | This value of the attribute.
additionalAttribute_value :: Lens.Lens' AdditionalAttribute (Prelude.Maybe Prelude.Text)
additionalAttribute_value :: Lens' AdditionalAttribute (Maybe Text)
additionalAttribute_value = 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)

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

instance Prelude.Hashable AdditionalAttribute where
  hashWithSalt :: Int -> AdditionalAttribute -> Int
hashWithSalt Int
_salt AdditionalAttribute' {Maybe Text
value :: Maybe Text
key :: Maybe Text
$sel:value:AdditionalAttribute' :: AdditionalAttribute -> Maybe Text
$sel:key:AdditionalAttribute' :: AdditionalAttribute -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData AdditionalAttribute where
  rnf :: AdditionalAttribute -> ()
rnf AdditionalAttribute' {Maybe Text
value :: Maybe Text
key :: Maybe Text
$sel:value:AdditionalAttribute' :: AdditionalAttribute -> Maybe Text
$sel:key:AdditionalAttribute' :: AdditionalAttribute -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value

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