{-# 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.CloudFormation.Types.AccountLimit
-- 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.CloudFormation.Types.AccountLimit where

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

-- | The AccountLimit data type.
--
-- CloudFormation has the following limits per account:
--
-- -   Number of concurrent resources
--
-- -   Number of stacks
--
-- -   Number of stack outputs
--
-- For more information about these account limits, and other
-- CloudFormation limits, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html CloudFormation Limits>
-- in the /CloudFormation User Guide/.
--
-- /See:/ 'newAccountLimit' smart constructor.
data AccountLimit = AccountLimit'
  { -- | The value that is associated with the account limit name.
    AccountLimit -> Maybe Int
value :: Prelude.Maybe Prelude.Int,
    -- | The name of the account limit.
    --
    -- Values: @ConcurrentResourcesLimit@ | @StackLimit@ | @StackOutputsLimit@
    AccountLimit -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (AccountLimit -> AccountLimit -> Bool
(AccountLimit -> AccountLimit -> Bool)
-> (AccountLimit -> AccountLimit -> Bool) -> Eq AccountLimit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountLimit -> AccountLimit -> Bool
$c/= :: AccountLimit -> AccountLimit -> Bool
== :: AccountLimit -> AccountLimit -> Bool
$c== :: AccountLimit -> AccountLimit -> Bool
Prelude.Eq, ReadPrec [AccountLimit]
ReadPrec AccountLimit
Int -> ReadS AccountLimit
ReadS [AccountLimit]
(Int -> ReadS AccountLimit)
-> ReadS [AccountLimit]
-> ReadPrec AccountLimit
-> ReadPrec [AccountLimit]
-> Read AccountLimit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountLimit]
$creadListPrec :: ReadPrec [AccountLimit]
readPrec :: ReadPrec AccountLimit
$creadPrec :: ReadPrec AccountLimit
readList :: ReadS [AccountLimit]
$creadList :: ReadS [AccountLimit]
readsPrec :: Int -> ReadS AccountLimit
$creadsPrec :: Int -> ReadS AccountLimit
Prelude.Read, Int -> AccountLimit -> ShowS
[AccountLimit] -> ShowS
AccountLimit -> String
(Int -> AccountLimit -> ShowS)
-> (AccountLimit -> String)
-> ([AccountLimit] -> ShowS)
-> Show AccountLimit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountLimit] -> ShowS
$cshowList :: [AccountLimit] -> ShowS
show :: AccountLimit -> String
$cshow :: AccountLimit -> String
showsPrec :: Int -> AccountLimit -> ShowS
$cshowsPrec :: Int -> AccountLimit -> ShowS
Prelude.Show, (forall x. AccountLimit -> Rep AccountLimit x)
-> (forall x. Rep AccountLimit x -> AccountLimit)
-> Generic AccountLimit
forall x. Rep AccountLimit x -> AccountLimit
forall x. AccountLimit -> Rep AccountLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountLimit x -> AccountLimit
$cfrom :: forall x. AccountLimit -> Rep AccountLimit x
Prelude.Generic)

-- |
-- Create a value of 'AccountLimit' 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', 'accountLimit_value' - The value that is associated with the account limit name.
--
-- 'name', 'accountLimit_name' - The name of the account limit.
--
-- Values: @ConcurrentResourcesLimit@ | @StackLimit@ | @StackOutputsLimit@
newAccountLimit ::
  AccountLimit
newAccountLimit :: AccountLimit
newAccountLimit =
  AccountLimit' :: Maybe Int -> Maybe Text -> AccountLimit
AccountLimit'
    { $sel:value:AccountLimit' :: Maybe Int
value = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AccountLimit' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value that is associated with the account limit name.
accountLimit_value :: Lens.Lens' AccountLimit (Prelude.Maybe Prelude.Int)
accountLimit_value :: (Maybe Int -> f (Maybe Int)) -> AccountLimit -> f AccountLimit
accountLimit_value = (AccountLimit -> Maybe Int)
-> (AccountLimit -> Maybe Int -> AccountLimit)
-> Lens AccountLimit AccountLimit (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {Maybe Int
value :: Maybe Int
$sel:value:AccountLimit' :: AccountLimit -> Maybe Int
value} -> Maybe Int
value) (\s :: AccountLimit
s@AccountLimit' {} Maybe Int
a -> AccountLimit
s {$sel:value:AccountLimit' :: Maybe Int
value = Maybe Int
a} :: AccountLimit)

-- | The name of the account limit.
--
-- Values: @ConcurrentResourcesLimit@ | @StackLimit@ | @StackOutputsLimit@
accountLimit_name :: Lens.Lens' AccountLimit (Prelude.Maybe Prelude.Text)
accountLimit_name :: (Maybe Text -> f (Maybe Text)) -> AccountLimit -> f AccountLimit
accountLimit_name = (AccountLimit -> Maybe Text)
-> (AccountLimit -> Maybe Text -> AccountLimit)
-> Lens AccountLimit AccountLimit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {Maybe Text
name :: Maybe Text
$sel:name:AccountLimit' :: AccountLimit -> Maybe Text
name} -> Maybe Text
name) (\s :: AccountLimit
s@AccountLimit' {} Maybe Text
a -> AccountLimit
s {$sel:name:AccountLimit' :: Maybe Text
name = Maybe Text
a} :: AccountLimit)

instance Core.FromXML AccountLimit where
  parseXML :: [Node] -> Either String AccountLimit
parseXML [Node]
x =
    Maybe Int -> Maybe Text -> AccountLimit
AccountLimit'
      (Maybe Int -> Maybe Text -> AccountLimit)
-> Either String (Maybe Int)
-> Either String (Maybe Text -> AccountLimit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Value") Either String (Maybe Text -> AccountLimit)
-> Either String (Maybe Text) -> Either String AccountLimit
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 AccountLimit

instance Prelude.NFData AccountLimit