{-# 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-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.Limit 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 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
(Limit -> Limit -> Bool) -> (Limit -> Limit -> Bool) -> Eq Limit
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]
(Int -> ReadS Limit)
-> ReadS [Limit]
-> ReadPrec Limit
-> ReadPrec [Limit]
-> Read 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
(Int -> Limit -> ShowS)
-> (Limit -> String) -> ([Limit] -> ShowS) -> Show Limit
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. Limit -> Rep Limit x)
-> (forall x. Rep Limit x -> Limit) -> Generic Limit
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' :: Maybe Text -> Maybe Text -> Limit
Limit'
    { $sel:max:Limit' :: Maybe Text
max = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Limit' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum value of the limit.
limit_max :: Lens.Lens' Limit (Prelude.Maybe Prelude.Text)
limit_max :: (Maybe Text -> f (Maybe Text)) -> Limit -> f Limit
limit_max = (Limit -> Maybe Text)
-> (Limit -> Maybe Text -> Limit)
-> Lens Limit Limit (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> Limit -> f Limit
limit_name = (Limit -> Maybe Text)
-> (Limit -> Maybe Text -> Limit)
-> Lens Limit Limit (Maybe Text) (Maybe Text)
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 Core.FromXML Limit where
  parseXML :: [Node] -> Either String Limit
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Limit
Limit'
      (Maybe Text -> Maybe Text -> Limit)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Limit)
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
"Max") Either String (Maybe Text -> Limit)
-> Either String (Maybe Text) -> Either String Limit
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
"Name")

instance Prelude.Hashable Limit

instance Prelude.NFData Limit