{-# 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.Limit
-- 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.Limit 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 an Elastic Load Balancing resource limit for your AWS
-- account.
--
-- /See:/ 'newLimit' smart constructor.
data Limit = Limit'
  { -- | The maximum value of the limit.
    Limit -> Maybe Text
max :: Prelude.Maybe Prelude.Text,
    -- | The name of the limit. The possible values are:
    --
    -- -   classic-listeners
    --
    -- -   classic-load-balancers
    --
    -- -   classic-registered-instances
    Limit -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (Limit -> Limit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Limit -> Limit -> Bool
$c/= :: Limit -> Limit -> Bool
== :: Limit -> Limit -> Bool
$c== :: Limit -> Limit -> Bool
Prelude.Eq, ReadPrec [Limit]
ReadPrec Limit
Int -> ReadS Limit
ReadS [Limit]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Limit]
$creadListPrec :: ReadPrec [Limit]
readPrec :: ReadPrec Limit
$creadPrec :: ReadPrec Limit
readList :: ReadS [Limit]
$creadList :: ReadS [Limit]
readsPrec :: Int -> ReadS Limit
$creadsPrec :: Int -> ReadS Limit
Prelude.Read, Int -> Limit -> ShowS
[Limit] -> ShowS
Limit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Limit] -> ShowS
$cshowList :: [Limit] -> ShowS
show :: Limit -> String
$cshow :: Limit -> String
showsPrec :: Int -> Limit -> ShowS
$cshowsPrec :: Int -> Limit -> ShowS
Prelude.Show, forall x. Rep Limit x -> Limit
forall x. Limit -> Rep Limit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Limit x -> Limit
$cfrom :: forall x. Limit -> Rep Limit x
Prelude.Generic)

-- |
-- Create a value of 'Limit' 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:
--
-- 'max', 'limit_max' - The maximum value of the limit.
--
-- 'name', 'limit_name' - The name of the limit. The possible values are:
--
-- -   classic-listeners
--
-- -   classic-load-balancers
--
-- -   classic-registered-instances
newLimit ::
  Limit
newLimit :: Limit
newLimit =
  Limit'
    { $sel:max:Limit' :: Maybe Text
max = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Limit' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum value of the limit.
limit_max :: Lens.Lens' Limit (Prelude.Maybe Prelude.Text)
limit_max :: Lens' Limit (Maybe Text)
limit_max = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Limit' {Maybe Text
max :: Maybe Text
$sel:max:Limit' :: Limit -> Maybe Text
max} -> Maybe Text
max) (\s :: Limit
s@Limit' {} Maybe Text
a -> Limit
s {$sel:max:Limit' :: Maybe Text
max = Maybe Text
a} :: Limit)

-- | The name of the limit. The possible values are:
--
-- -   classic-listeners
--
-- -   classic-load-balancers
--
-- -   classic-registered-instances
limit_name :: Lens.Lens' Limit (Prelude.Maybe Prelude.Text)
limit_name :: Lens' Limit (Maybe Text)
limit_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Limit' {Maybe Text
name :: Maybe Text
$sel:name:Limit' :: Limit -> Maybe Text
name} -> Maybe Text
name) (\s :: Limit
s@Limit' {} Maybe Text
a -> Limit
s {$sel:name:Limit' :: Maybe Text
name = Maybe Text
a} :: Limit)

instance Data.FromXML Limit where
  parseXML :: [Node] -> Either String Limit
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Limit
Limit'
      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
"Max")
      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
"Name")

instance Prelude.Hashable Limit where
  hashWithSalt :: Int -> Limit -> Int
hashWithSalt Int
_salt Limit' {Maybe Text
name :: Maybe Text
max :: Maybe Text
$sel:name:Limit' :: Limit -> Maybe Text
$sel:max:Limit' :: Limit -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
max
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

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