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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.Internal
import Amazonka.Route53.Types.AccountLimitType

-- | A complex type that contains the type of limit that you specified in the
-- request and the current value for that limit.
--
-- /See:/ 'newAccountLimit' smart constructor.
data AccountLimit = AccountLimit'
  { -- | The limit that you requested. Valid values include the following:
    --
    -- -   __MAX_HEALTH_CHECKS_BY_OWNER__: The maximum number of health checks
    --     that you can create using the current account.
    --
    -- -   __MAX_HOSTED_ZONES_BY_OWNER__: The maximum number of hosted zones
    --     that you can create using the current account.
    --
    -- -   __MAX_REUSABLE_DELEGATION_SETS_BY_OWNER__: The maximum number of
    --     reusable delegation sets that you can create using the current
    --     account.
    --
    -- -   __MAX_TRAFFIC_POLICIES_BY_OWNER__: The maximum number of traffic
    --     policies that you can create using the current account.
    --
    -- -   __MAX_TRAFFIC_POLICY_INSTANCES_BY_OWNER__: The maximum number of
    --     traffic policy instances that you can create using the current
    --     account. (Traffic policy instances are referred to as traffic flow
    --     policy records in the Amazon Route 53 console.)
    AccountLimit -> AccountLimitType
type' :: AccountLimitType,
    -- | The current value for the limit that is specified by
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_AccountLimit.html#Route53-Type-AccountLimit-Type Type>.
    AccountLimit -> Natural
value :: Prelude.Natural
  }
  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:
--
-- 'type'', 'accountLimit_type' - The limit that you requested. Valid values include the following:
--
-- -   __MAX_HEALTH_CHECKS_BY_OWNER__: The maximum number of health checks
--     that you can create using the current account.
--
-- -   __MAX_HOSTED_ZONES_BY_OWNER__: The maximum number of hosted zones
--     that you can create using the current account.
--
-- -   __MAX_REUSABLE_DELEGATION_SETS_BY_OWNER__: The maximum number of
--     reusable delegation sets that you can create using the current
--     account.
--
-- -   __MAX_TRAFFIC_POLICIES_BY_OWNER__: The maximum number of traffic
--     policies that you can create using the current account.
--
-- -   __MAX_TRAFFIC_POLICY_INSTANCES_BY_OWNER__: The maximum number of
--     traffic policy instances that you can create using the current
--     account. (Traffic policy instances are referred to as traffic flow
--     policy records in the Amazon Route 53 console.)
--
-- 'value', 'accountLimit_value' - The current value for the limit that is specified by
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_AccountLimit.html#Route53-Type-AccountLimit-Type Type>.
newAccountLimit ::
  -- | 'type''
  AccountLimitType ->
  -- | 'value'
  Prelude.Natural ->
  AccountLimit
newAccountLimit :: AccountLimitType -> Natural -> AccountLimit
newAccountLimit AccountLimitType
pType_ Natural
pValue_ =
  AccountLimit' :: AccountLimitType -> Natural -> AccountLimit
AccountLimit' {$sel:type':AccountLimit' :: AccountLimitType
type' = AccountLimitType
pType_, $sel:value:AccountLimit' :: Natural
value = Natural
pValue_}

-- | The limit that you requested. Valid values include the following:
--
-- -   __MAX_HEALTH_CHECKS_BY_OWNER__: The maximum number of health checks
--     that you can create using the current account.
--
-- -   __MAX_HOSTED_ZONES_BY_OWNER__: The maximum number of hosted zones
--     that you can create using the current account.
--
-- -   __MAX_REUSABLE_DELEGATION_SETS_BY_OWNER__: The maximum number of
--     reusable delegation sets that you can create using the current
--     account.
--
-- -   __MAX_TRAFFIC_POLICIES_BY_OWNER__: The maximum number of traffic
--     policies that you can create using the current account.
--
-- -   __MAX_TRAFFIC_POLICY_INSTANCES_BY_OWNER__: The maximum number of
--     traffic policy instances that you can create using the current
--     account. (Traffic policy instances are referred to as traffic flow
--     policy records in the Amazon Route 53 console.)
accountLimit_type :: Lens.Lens' AccountLimit AccountLimitType
accountLimit_type :: (AccountLimitType -> f AccountLimitType)
-> AccountLimit -> f AccountLimit
accountLimit_type = (AccountLimit -> AccountLimitType)
-> (AccountLimit -> AccountLimitType -> AccountLimit)
-> Lens AccountLimit AccountLimit AccountLimitType AccountLimitType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {AccountLimitType
type' :: AccountLimitType
$sel:type':AccountLimit' :: AccountLimit -> AccountLimitType
type'} -> AccountLimitType
type') (\s :: AccountLimit
s@AccountLimit' {} AccountLimitType
a -> AccountLimit
s {$sel:type':AccountLimit' :: AccountLimitType
type' = AccountLimitType
a} :: AccountLimit)

-- | The current value for the limit that is specified by
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_AccountLimit.html#Route53-Type-AccountLimit-Type Type>.
accountLimit_value :: Lens.Lens' AccountLimit Prelude.Natural
accountLimit_value :: (Natural -> f Natural) -> AccountLimit -> f AccountLimit
accountLimit_value = (AccountLimit -> Natural)
-> (AccountLimit -> Natural -> AccountLimit)
-> Lens AccountLimit AccountLimit Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {Natural
value :: Natural
$sel:value:AccountLimit' :: AccountLimit -> Natural
value} -> Natural
value) (\s :: AccountLimit
s@AccountLimit' {} Natural
a -> AccountLimit
s {$sel:value:AccountLimit' :: Natural
value = Natural
a} :: AccountLimit)

instance Core.FromXML AccountLimit where
  parseXML :: [Node] -> Either String AccountLimit
parseXML [Node]
x =
    AccountLimitType -> Natural -> AccountLimit
AccountLimit'
      (AccountLimitType -> Natural -> AccountLimit)
-> Either String AccountLimitType
-> Either String (Natural -> AccountLimit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String AccountLimitType
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Type") Either String (Natural -> AccountLimit)
-> Either String Natural -> Either String AccountLimit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Natural
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Value")

instance Prelude.Hashable AccountLimit

instance Prelude.NFData AccountLimit