{-# 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.SecurityHub.Types.AwsElbv2LoadBalancerAttribute
-- 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.SecurityHub.Types.AwsElbv2LoadBalancerAttribute where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A load balancer attribute.
--
-- /See:/ 'newAwsElbv2LoadBalancerAttribute' smart constructor.
data AwsElbv2LoadBalancerAttribute = AwsElbv2LoadBalancerAttribute'
  { -- | The value of the load balancer attribute.
    AwsElbv2LoadBalancerAttribute -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The name of the load balancer attribute.
    AwsElbv2LoadBalancerAttribute -> Maybe Text
key :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsElbv2LoadBalancerAttribute
-> AwsElbv2LoadBalancerAttribute -> Bool
(AwsElbv2LoadBalancerAttribute
 -> AwsElbv2LoadBalancerAttribute -> Bool)
-> (AwsElbv2LoadBalancerAttribute
    -> AwsElbv2LoadBalancerAttribute -> Bool)
-> Eq AwsElbv2LoadBalancerAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsElbv2LoadBalancerAttribute
-> AwsElbv2LoadBalancerAttribute -> Bool
$c/= :: AwsElbv2LoadBalancerAttribute
-> AwsElbv2LoadBalancerAttribute -> Bool
== :: AwsElbv2LoadBalancerAttribute
-> AwsElbv2LoadBalancerAttribute -> Bool
$c== :: AwsElbv2LoadBalancerAttribute
-> AwsElbv2LoadBalancerAttribute -> Bool
Prelude.Eq, ReadPrec [AwsElbv2LoadBalancerAttribute]
ReadPrec AwsElbv2LoadBalancerAttribute
Int -> ReadS AwsElbv2LoadBalancerAttribute
ReadS [AwsElbv2LoadBalancerAttribute]
(Int -> ReadS AwsElbv2LoadBalancerAttribute)
-> ReadS [AwsElbv2LoadBalancerAttribute]
-> ReadPrec AwsElbv2LoadBalancerAttribute
-> ReadPrec [AwsElbv2LoadBalancerAttribute]
-> Read AwsElbv2LoadBalancerAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsElbv2LoadBalancerAttribute]
$creadListPrec :: ReadPrec [AwsElbv2LoadBalancerAttribute]
readPrec :: ReadPrec AwsElbv2LoadBalancerAttribute
$creadPrec :: ReadPrec AwsElbv2LoadBalancerAttribute
readList :: ReadS [AwsElbv2LoadBalancerAttribute]
$creadList :: ReadS [AwsElbv2LoadBalancerAttribute]
readsPrec :: Int -> ReadS AwsElbv2LoadBalancerAttribute
$creadsPrec :: Int -> ReadS AwsElbv2LoadBalancerAttribute
Prelude.Read, Int -> AwsElbv2LoadBalancerAttribute -> ShowS
[AwsElbv2LoadBalancerAttribute] -> ShowS
AwsElbv2LoadBalancerAttribute -> String
(Int -> AwsElbv2LoadBalancerAttribute -> ShowS)
-> (AwsElbv2LoadBalancerAttribute -> String)
-> ([AwsElbv2LoadBalancerAttribute] -> ShowS)
-> Show AwsElbv2LoadBalancerAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsElbv2LoadBalancerAttribute] -> ShowS
$cshowList :: [AwsElbv2LoadBalancerAttribute] -> ShowS
show :: AwsElbv2LoadBalancerAttribute -> String
$cshow :: AwsElbv2LoadBalancerAttribute -> String
showsPrec :: Int -> AwsElbv2LoadBalancerAttribute -> ShowS
$cshowsPrec :: Int -> AwsElbv2LoadBalancerAttribute -> ShowS
Prelude.Show, (forall x.
 AwsElbv2LoadBalancerAttribute
 -> Rep AwsElbv2LoadBalancerAttribute x)
-> (forall x.
    Rep AwsElbv2LoadBalancerAttribute x
    -> AwsElbv2LoadBalancerAttribute)
-> Generic AwsElbv2LoadBalancerAttribute
forall x.
Rep AwsElbv2LoadBalancerAttribute x
-> AwsElbv2LoadBalancerAttribute
forall x.
AwsElbv2LoadBalancerAttribute
-> Rep AwsElbv2LoadBalancerAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsElbv2LoadBalancerAttribute x
-> AwsElbv2LoadBalancerAttribute
$cfrom :: forall x.
AwsElbv2LoadBalancerAttribute
-> Rep AwsElbv2LoadBalancerAttribute x
Prelude.Generic)

-- |
-- Create a value of 'AwsElbv2LoadBalancerAttribute' 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', 'awsElbv2LoadBalancerAttribute_value' - The value of the load balancer attribute.
--
-- 'key', 'awsElbv2LoadBalancerAttribute_key' - The name of the load balancer attribute.
newAwsElbv2LoadBalancerAttribute ::
  AwsElbv2LoadBalancerAttribute
newAwsElbv2LoadBalancerAttribute :: AwsElbv2LoadBalancerAttribute
newAwsElbv2LoadBalancerAttribute =
  AwsElbv2LoadBalancerAttribute' :: Maybe Text -> Maybe Text -> AwsElbv2LoadBalancerAttribute
AwsElbv2LoadBalancerAttribute'
    { $sel:value:AwsElbv2LoadBalancerAttribute' :: Maybe Text
value =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:key:AwsElbv2LoadBalancerAttribute' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The name of the load balancer attribute.
awsElbv2LoadBalancerAttribute_key :: Lens.Lens' AwsElbv2LoadBalancerAttribute (Prelude.Maybe Prelude.Text)
awsElbv2LoadBalancerAttribute_key :: (Maybe Text -> f (Maybe Text))
-> AwsElbv2LoadBalancerAttribute -> f AwsElbv2LoadBalancerAttribute
awsElbv2LoadBalancerAttribute_key = (AwsElbv2LoadBalancerAttribute -> Maybe Text)
-> (AwsElbv2LoadBalancerAttribute
    -> Maybe Text -> AwsElbv2LoadBalancerAttribute)
-> Lens
     AwsElbv2LoadBalancerAttribute
     AwsElbv2LoadBalancerAttribute
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElbv2LoadBalancerAttribute' {Maybe Text
key :: Maybe Text
$sel:key:AwsElbv2LoadBalancerAttribute' :: AwsElbv2LoadBalancerAttribute -> Maybe Text
key} -> Maybe Text
key) (\s :: AwsElbv2LoadBalancerAttribute
s@AwsElbv2LoadBalancerAttribute' {} Maybe Text
a -> AwsElbv2LoadBalancerAttribute
s {$sel:key:AwsElbv2LoadBalancerAttribute' :: Maybe Text
key = Maybe Text
a} :: AwsElbv2LoadBalancerAttribute)

instance Core.FromJSON AwsElbv2LoadBalancerAttribute where
  parseJSON :: Value -> Parser AwsElbv2LoadBalancerAttribute
parseJSON =
    String
-> (Object -> Parser AwsElbv2LoadBalancerAttribute)
-> Value
-> Parser AwsElbv2LoadBalancerAttribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsElbv2LoadBalancerAttribute"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AwsElbv2LoadBalancerAttribute
AwsElbv2LoadBalancerAttribute'
            (Maybe Text -> Maybe Text -> AwsElbv2LoadBalancerAttribute)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsElbv2LoadBalancerAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value") Parser (Maybe Text -> AwsElbv2LoadBalancerAttribute)
-> Parser (Maybe Text) -> Parser AwsElbv2LoadBalancerAttribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Key")
      )

instance
  Prelude.Hashable
    AwsElbv2LoadBalancerAttribute

instance Prelude.NFData AwsElbv2LoadBalancerAttribute

instance Core.ToJSON AwsElbv2LoadBalancerAttribute where
  toJSON :: AwsElbv2LoadBalancerAttribute -> Value
toJSON AwsElbv2LoadBalancerAttribute' {Maybe Text
key :: Maybe Text
value :: Maybe Text
$sel:key:AwsElbv2LoadBalancerAttribute' :: AwsElbv2LoadBalancerAttribute -> Maybe Text
$sel:value:AwsElbv2LoadBalancerAttribute' :: AwsElbv2LoadBalancerAttribute -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
value,
            (Text
"Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
key
          ]
      )