{-# 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.Shield.Types.SubscriptionLimits
-- 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.Shield.Types.SubscriptionLimits where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Shield.Types.ProtectionGroupLimits
import Amazonka.Shield.Types.ProtectionLimits

-- | Limits settings for your subscription.
--
-- /See:/ 'newSubscriptionLimits' smart constructor.
data SubscriptionLimits = SubscriptionLimits'
  { -- | Limits settings on protections for your subscription.
    SubscriptionLimits -> ProtectionLimits
protectionLimits :: ProtectionLimits,
    -- | Limits settings on protection groups for your subscription.
    SubscriptionLimits -> ProtectionGroupLimits
protectionGroupLimits :: ProtectionGroupLimits
  }
  deriving (SubscriptionLimits -> SubscriptionLimits -> Bool
(SubscriptionLimits -> SubscriptionLimits -> Bool)
-> (SubscriptionLimits -> SubscriptionLimits -> Bool)
-> Eq SubscriptionLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubscriptionLimits -> SubscriptionLimits -> Bool
$c/= :: SubscriptionLimits -> SubscriptionLimits -> Bool
== :: SubscriptionLimits -> SubscriptionLimits -> Bool
$c== :: SubscriptionLimits -> SubscriptionLimits -> Bool
Prelude.Eq, ReadPrec [SubscriptionLimits]
ReadPrec SubscriptionLimits
Int -> ReadS SubscriptionLimits
ReadS [SubscriptionLimits]
(Int -> ReadS SubscriptionLimits)
-> ReadS [SubscriptionLimits]
-> ReadPrec SubscriptionLimits
-> ReadPrec [SubscriptionLimits]
-> Read SubscriptionLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubscriptionLimits]
$creadListPrec :: ReadPrec [SubscriptionLimits]
readPrec :: ReadPrec SubscriptionLimits
$creadPrec :: ReadPrec SubscriptionLimits
readList :: ReadS [SubscriptionLimits]
$creadList :: ReadS [SubscriptionLimits]
readsPrec :: Int -> ReadS SubscriptionLimits
$creadsPrec :: Int -> ReadS SubscriptionLimits
Prelude.Read, Int -> SubscriptionLimits -> ShowS
[SubscriptionLimits] -> ShowS
SubscriptionLimits -> String
(Int -> SubscriptionLimits -> ShowS)
-> (SubscriptionLimits -> String)
-> ([SubscriptionLimits] -> ShowS)
-> Show SubscriptionLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubscriptionLimits] -> ShowS
$cshowList :: [SubscriptionLimits] -> ShowS
show :: SubscriptionLimits -> String
$cshow :: SubscriptionLimits -> String
showsPrec :: Int -> SubscriptionLimits -> ShowS
$cshowsPrec :: Int -> SubscriptionLimits -> ShowS
Prelude.Show, (forall x. SubscriptionLimits -> Rep SubscriptionLimits x)
-> (forall x. Rep SubscriptionLimits x -> SubscriptionLimits)
-> Generic SubscriptionLimits
forall x. Rep SubscriptionLimits x -> SubscriptionLimits
forall x. SubscriptionLimits -> Rep SubscriptionLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubscriptionLimits x -> SubscriptionLimits
$cfrom :: forall x. SubscriptionLimits -> Rep SubscriptionLimits x
Prelude.Generic)

-- |
-- Create a value of 'SubscriptionLimits' 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:
--
-- 'protectionLimits', 'subscriptionLimits_protectionLimits' - Limits settings on protections for your subscription.
--
-- 'protectionGroupLimits', 'subscriptionLimits_protectionGroupLimits' - Limits settings on protection groups for your subscription.
newSubscriptionLimits ::
  -- | 'protectionLimits'
  ProtectionLimits ->
  -- | 'protectionGroupLimits'
  ProtectionGroupLimits ->
  SubscriptionLimits
newSubscriptionLimits :: ProtectionLimits -> ProtectionGroupLimits -> SubscriptionLimits
newSubscriptionLimits
  ProtectionLimits
pProtectionLimits_
  ProtectionGroupLimits
pProtectionGroupLimits_ =
    SubscriptionLimits' :: ProtectionLimits -> ProtectionGroupLimits -> SubscriptionLimits
SubscriptionLimits'
      { $sel:protectionLimits:SubscriptionLimits' :: ProtectionLimits
protectionLimits =
          ProtectionLimits
pProtectionLimits_,
        $sel:protectionGroupLimits:SubscriptionLimits' :: ProtectionGroupLimits
protectionGroupLimits = ProtectionGroupLimits
pProtectionGroupLimits_
      }

-- | Limits settings on protections for your subscription.
subscriptionLimits_protectionLimits :: Lens.Lens' SubscriptionLimits ProtectionLimits
subscriptionLimits_protectionLimits :: (ProtectionLimits -> f ProtectionLimits)
-> SubscriptionLimits -> f SubscriptionLimits
subscriptionLimits_protectionLimits = (SubscriptionLimits -> ProtectionLimits)
-> (SubscriptionLimits -> ProtectionLimits -> SubscriptionLimits)
-> Lens
     SubscriptionLimits
     SubscriptionLimits
     ProtectionLimits
     ProtectionLimits
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscriptionLimits' {ProtectionLimits
protectionLimits :: ProtectionLimits
$sel:protectionLimits:SubscriptionLimits' :: SubscriptionLimits -> ProtectionLimits
protectionLimits} -> ProtectionLimits
protectionLimits) (\s :: SubscriptionLimits
s@SubscriptionLimits' {} ProtectionLimits
a -> SubscriptionLimits
s {$sel:protectionLimits:SubscriptionLimits' :: ProtectionLimits
protectionLimits = ProtectionLimits
a} :: SubscriptionLimits)

-- | Limits settings on protection groups for your subscription.
subscriptionLimits_protectionGroupLimits :: Lens.Lens' SubscriptionLimits ProtectionGroupLimits
subscriptionLimits_protectionGroupLimits :: (ProtectionGroupLimits -> f ProtectionGroupLimits)
-> SubscriptionLimits -> f SubscriptionLimits
subscriptionLimits_protectionGroupLimits = (SubscriptionLimits -> ProtectionGroupLimits)
-> (SubscriptionLimits
    -> ProtectionGroupLimits -> SubscriptionLimits)
-> Lens
     SubscriptionLimits
     SubscriptionLimits
     ProtectionGroupLimits
     ProtectionGroupLimits
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscriptionLimits' {ProtectionGroupLimits
protectionGroupLimits :: ProtectionGroupLimits
$sel:protectionGroupLimits:SubscriptionLimits' :: SubscriptionLimits -> ProtectionGroupLimits
protectionGroupLimits} -> ProtectionGroupLimits
protectionGroupLimits) (\s :: SubscriptionLimits
s@SubscriptionLimits' {} ProtectionGroupLimits
a -> SubscriptionLimits
s {$sel:protectionGroupLimits:SubscriptionLimits' :: ProtectionGroupLimits
protectionGroupLimits = ProtectionGroupLimits
a} :: SubscriptionLimits)

instance Core.FromJSON SubscriptionLimits where
  parseJSON :: Value -> Parser SubscriptionLimits
parseJSON =
    String
-> (Object -> Parser SubscriptionLimits)
-> Value
-> Parser SubscriptionLimits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SubscriptionLimits"
      ( \Object
x ->
          ProtectionLimits -> ProtectionGroupLimits -> SubscriptionLimits
SubscriptionLimits'
            (ProtectionLimits -> ProtectionGroupLimits -> SubscriptionLimits)
-> Parser ProtectionLimits
-> Parser (ProtectionGroupLimits -> SubscriptionLimits)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser ProtectionLimits
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ProtectionLimits")
            Parser (ProtectionGroupLimits -> SubscriptionLimits)
-> Parser ProtectionGroupLimits -> Parser SubscriptionLimits
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ProtectionGroupLimits
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ProtectionGroupLimits")
      )

instance Prelude.Hashable SubscriptionLimits

instance Prelude.NFData SubscriptionLimits