{-# 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.HostedZoneLimit
-- 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.HostedZoneLimit 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.HostedZoneLimitType

-- | A complex type that contains the type of limit that you specified in the
-- request and the current value for that limit.
--
-- /See:/ 'newHostedZoneLimit' smart constructor.
data HostedZoneLimit = HostedZoneLimit'
  { -- | The limit that you requested. Valid values include the following:
    --
    -- -   __MAX_RRSETS_BY_ZONE__: The maximum number of records that you can
    --     create in the specified hosted zone.
    --
    -- -   __MAX_VPCS_ASSOCIATED_BY_ZONE__: The maximum number of Amazon VPCs
    --     that you can associate with the specified private hosted zone.
    HostedZoneLimit -> HostedZoneLimitType
type' :: HostedZoneLimitType,
    -- | The current value for the limit that is specified by @Type@.
    HostedZoneLimit -> Natural
value :: Prelude.Natural
  }
  deriving (HostedZoneLimit -> HostedZoneLimit -> Bool
(HostedZoneLimit -> HostedZoneLimit -> Bool)
-> (HostedZoneLimit -> HostedZoneLimit -> Bool)
-> Eq HostedZoneLimit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HostedZoneLimit -> HostedZoneLimit -> Bool
$c/= :: HostedZoneLimit -> HostedZoneLimit -> Bool
== :: HostedZoneLimit -> HostedZoneLimit -> Bool
$c== :: HostedZoneLimit -> HostedZoneLimit -> Bool
Prelude.Eq, ReadPrec [HostedZoneLimit]
ReadPrec HostedZoneLimit
Int -> ReadS HostedZoneLimit
ReadS [HostedZoneLimit]
(Int -> ReadS HostedZoneLimit)
-> ReadS [HostedZoneLimit]
-> ReadPrec HostedZoneLimit
-> ReadPrec [HostedZoneLimit]
-> Read HostedZoneLimit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HostedZoneLimit]
$creadListPrec :: ReadPrec [HostedZoneLimit]
readPrec :: ReadPrec HostedZoneLimit
$creadPrec :: ReadPrec HostedZoneLimit
readList :: ReadS [HostedZoneLimit]
$creadList :: ReadS [HostedZoneLimit]
readsPrec :: Int -> ReadS HostedZoneLimit
$creadsPrec :: Int -> ReadS HostedZoneLimit
Prelude.Read, Int -> HostedZoneLimit -> ShowS
[HostedZoneLimit] -> ShowS
HostedZoneLimit -> String
(Int -> HostedZoneLimit -> ShowS)
-> (HostedZoneLimit -> String)
-> ([HostedZoneLimit] -> ShowS)
-> Show HostedZoneLimit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HostedZoneLimit] -> ShowS
$cshowList :: [HostedZoneLimit] -> ShowS
show :: HostedZoneLimit -> String
$cshow :: HostedZoneLimit -> String
showsPrec :: Int -> HostedZoneLimit -> ShowS
$cshowsPrec :: Int -> HostedZoneLimit -> ShowS
Prelude.Show, (forall x. HostedZoneLimit -> Rep HostedZoneLimit x)
-> (forall x. Rep HostedZoneLimit x -> HostedZoneLimit)
-> Generic HostedZoneLimit
forall x. Rep HostedZoneLimit x -> HostedZoneLimit
forall x. HostedZoneLimit -> Rep HostedZoneLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HostedZoneLimit x -> HostedZoneLimit
$cfrom :: forall x. HostedZoneLimit -> Rep HostedZoneLimit x
Prelude.Generic)

-- |
-- Create a value of 'HostedZoneLimit' 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'', 'hostedZoneLimit_type' - The limit that you requested. Valid values include the following:
--
-- -   __MAX_RRSETS_BY_ZONE__: The maximum number of records that you can
--     create in the specified hosted zone.
--
-- -   __MAX_VPCS_ASSOCIATED_BY_ZONE__: The maximum number of Amazon VPCs
--     that you can associate with the specified private hosted zone.
--
-- 'value', 'hostedZoneLimit_value' - The current value for the limit that is specified by @Type@.
newHostedZoneLimit ::
  -- | 'type''
  HostedZoneLimitType ->
  -- | 'value'
  Prelude.Natural ->
  HostedZoneLimit
newHostedZoneLimit :: HostedZoneLimitType -> Natural -> HostedZoneLimit
newHostedZoneLimit HostedZoneLimitType
pType_ Natural
pValue_ =
  HostedZoneLimit' :: HostedZoneLimitType -> Natural -> HostedZoneLimit
HostedZoneLimit' {$sel:type':HostedZoneLimit' :: HostedZoneLimitType
type' = HostedZoneLimitType
pType_, $sel:value:HostedZoneLimit' :: Natural
value = Natural
pValue_}

-- | The limit that you requested. Valid values include the following:
--
-- -   __MAX_RRSETS_BY_ZONE__: The maximum number of records that you can
--     create in the specified hosted zone.
--
-- -   __MAX_VPCS_ASSOCIATED_BY_ZONE__: The maximum number of Amazon VPCs
--     that you can associate with the specified private hosted zone.
hostedZoneLimit_type :: Lens.Lens' HostedZoneLimit HostedZoneLimitType
hostedZoneLimit_type :: (HostedZoneLimitType -> f HostedZoneLimitType)
-> HostedZoneLimit -> f HostedZoneLimit
hostedZoneLimit_type = (HostedZoneLimit -> HostedZoneLimitType)
-> (HostedZoneLimit -> HostedZoneLimitType -> HostedZoneLimit)
-> Lens
     HostedZoneLimit
     HostedZoneLimit
     HostedZoneLimitType
     HostedZoneLimitType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneLimit' {HostedZoneLimitType
type' :: HostedZoneLimitType
$sel:type':HostedZoneLimit' :: HostedZoneLimit -> HostedZoneLimitType
type'} -> HostedZoneLimitType
type') (\s :: HostedZoneLimit
s@HostedZoneLimit' {} HostedZoneLimitType
a -> HostedZoneLimit
s {$sel:type':HostedZoneLimit' :: HostedZoneLimitType
type' = HostedZoneLimitType
a} :: HostedZoneLimit)

-- | The current value for the limit that is specified by @Type@.
hostedZoneLimit_value :: Lens.Lens' HostedZoneLimit Prelude.Natural
hostedZoneLimit_value :: (Natural -> f Natural) -> HostedZoneLimit -> f HostedZoneLimit
hostedZoneLimit_value = (HostedZoneLimit -> Natural)
-> (HostedZoneLimit -> Natural -> HostedZoneLimit)
-> Lens HostedZoneLimit HostedZoneLimit Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneLimit' {Natural
value :: Natural
$sel:value:HostedZoneLimit' :: HostedZoneLimit -> Natural
value} -> Natural
value) (\s :: HostedZoneLimit
s@HostedZoneLimit' {} Natural
a -> HostedZoneLimit
s {$sel:value:HostedZoneLimit' :: Natural
value = Natural
a} :: HostedZoneLimit)

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

instance Prelude.NFData HostedZoneLimit