{-# 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.ProtectionGroupLimits
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Shield.Types.ProtectionGroupLimits where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Shield.Types.ProtectionGroupPatternTypeLimits

-- | Limits settings on protection groups for your subscription.
--
-- /See:/ 'newProtectionGroupLimits' smart constructor.
data ProtectionGroupLimits = ProtectionGroupLimits'
  { -- | The maximum number of protection groups that you can have at one time.
    ProtectionGroupLimits -> Integer
maxProtectionGroups :: Prelude.Integer,
    -- | Limits settings by pattern type in the protection groups for your
    -- subscription.
    ProtectionGroupLimits -> ProtectionGroupPatternTypeLimits
patternTypeLimits :: ProtectionGroupPatternTypeLimits
  }
  deriving (ProtectionGroupLimits -> ProtectionGroupLimits -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtectionGroupLimits -> ProtectionGroupLimits -> Bool
$c/= :: ProtectionGroupLimits -> ProtectionGroupLimits -> Bool
== :: ProtectionGroupLimits -> ProtectionGroupLimits -> Bool
$c== :: ProtectionGroupLimits -> ProtectionGroupLimits -> Bool
Prelude.Eq, ReadPrec [ProtectionGroupLimits]
ReadPrec ProtectionGroupLimits
Int -> ReadS ProtectionGroupLimits
ReadS [ProtectionGroupLimits]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProtectionGroupLimits]
$creadListPrec :: ReadPrec [ProtectionGroupLimits]
readPrec :: ReadPrec ProtectionGroupLimits
$creadPrec :: ReadPrec ProtectionGroupLimits
readList :: ReadS [ProtectionGroupLimits]
$creadList :: ReadS [ProtectionGroupLimits]
readsPrec :: Int -> ReadS ProtectionGroupLimits
$creadsPrec :: Int -> ReadS ProtectionGroupLimits
Prelude.Read, Int -> ProtectionGroupLimits -> ShowS
[ProtectionGroupLimits] -> ShowS
ProtectionGroupLimits -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtectionGroupLimits] -> ShowS
$cshowList :: [ProtectionGroupLimits] -> ShowS
show :: ProtectionGroupLimits -> String
$cshow :: ProtectionGroupLimits -> String
showsPrec :: Int -> ProtectionGroupLimits -> ShowS
$cshowsPrec :: Int -> ProtectionGroupLimits -> ShowS
Prelude.Show, forall x. Rep ProtectionGroupLimits x -> ProtectionGroupLimits
forall x. ProtectionGroupLimits -> Rep ProtectionGroupLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProtectionGroupLimits x -> ProtectionGroupLimits
$cfrom :: forall x. ProtectionGroupLimits -> Rep ProtectionGroupLimits x
Prelude.Generic)

-- |
-- Create a value of 'ProtectionGroupLimits' 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:
--
-- 'maxProtectionGroups', 'protectionGroupLimits_maxProtectionGroups' - The maximum number of protection groups that you can have at one time.
--
-- 'patternTypeLimits', 'protectionGroupLimits_patternTypeLimits' - Limits settings by pattern type in the protection groups for your
-- subscription.
newProtectionGroupLimits ::
  -- | 'maxProtectionGroups'
  Prelude.Integer ->
  -- | 'patternTypeLimits'
  ProtectionGroupPatternTypeLimits ->
  ProtectionGroupLimits
newProtectionGroupLimits :: Integer
-> ProtectionGroupPatternTypeLimits -> ProtectionGroupLimits
newProtectionGroupLimits
  Integer
pMaxProtectionGroups_
  ProtectionGroupPatternTypeLimits
pPatternTypeLimits_ =
    ProtectionGroupLimits'
      { $sel:maxProtectionGroups:ProtectionGroupLimits' :: Integer
maxProtectionGroups =
          Integer
pMaxProtectionGroups_,
        $sel:patternTypeLimits:ProtectionGroupLimits' :: ProtectionGroupPatternTypeLimits
patternTypeLimits = ProtectionGroupPatternTypeLimits
pPatternTypeLimits_
      }

-- | The maximum number of protection groups that you can have at one time.
protectionGroupLimits_maxProtectionGroups :: Lens.Lens' ProtectionGroupLimits Prelude.Integer
protectionGroupLimits_maxProtectionGroups :: Lens' ProtectionGroupLimits Integer
protectionGroupLimits_maxProtectionGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionGroupLimits' {Integer
maxProtectionGroups :: Integer
$sel:maxProtectionGroups:ProtectionGroupLimits' :: ProtectionGroupLimits -> Integer
maxProtectionGroups} -> Integer
maxProtectionGroups) (\s :: ProtectionGroupLimits
s@ProtectionGroupLimits' {} Integer
a -> ProtectionGroupLimits
s {$sel:maxProtectionGroups:ProtectionGroupLimits' :: Integer
maxProtectionGroups = Integer
a} :: ProtectionGroupLimits)

-- | Limits settings by pattern type in the protection groups for your
-- subscription.
protectionGroupLimits_patternTypeLimits :: Lens.Lens' ProtectionGroupLimits ProtectionGroupPatternTypeLimits
protectionGroupLimits_patternTypeLimits :: Lens' ProtectionGroupLimits ProtectionGroupPatternTypeLimits
protectionGroupLimits_patternTypeLimits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionGroupLimits' {ProtectionGroupPatternTypeLimits
patternTypeLimits :: ProtectionGroupPatternTypeLimits
$sel:patternTypeLimits:ProtectionGroupLimits' :: ProtectionGroupLimits -> ProtectionGroupPatternTypeLimits
patternTypeLimits} -> ProtectionGroupPatternTypeLimits
patternTypeLimits) (\s :: ProtectionGroupLimits
s@ProtectionGroupLimits' {} ProtectionGroupPatternTypeLimits
a -> ProtectionGroupLimits
s {$sel:patternTypeLimits:ProtectionGroupLimits' :: ProtectionGroupPatternTypeLimits
patternTypeLimits = ProtectionGroupPatternTypeLimits
a} :: ProtectionGroupLimits)

instance Data.FromJSON ProtectionGroupLimits where
  parseJSON :: Value -> Parser ProtectionGroupLimits
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProtectionGroupLimits"
      ( \Object
x ->
          Integer
-> ProtectionGroupPatternTypeLimits -> ProtectionGroupLimits
ProtectionGroupLimits'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"MaxProtectionGroups")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"PatternTypeLimits")
      )

instance Prelude.Hashable ProtectionGroupLimits where
  hashWithSalt :: Int -> ProtectionGroupLimits -> Int
hashWithSalt Int
_salt ProtectionGroupLimits' {Integer
ProtectionGroupPatternTypeLimits
patternTypeLimits :: ProtectionGroupPatternTypeLimits
maxProtectionGroups :: Integer
$sel:patternTypeLimits:ProtectionGroupLimits' :: ProtectionGroupLimits -> ProtectionGroupPatternTypeLimits
$sel:maxProtectionGroups:ProtectionGroupLimits' :: ProtectionGroupLimits -> Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
maxProtectionGroups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ProtectionGroupPatternTypeLimits
patternTypeLimits

instance Prelude.NFData ProtectionGroupLimits where
  rnf :: ProtectionGroupLimits -> ()
rnf ProtectionGroupLimits' {Integer
ProtectionGroupPatternTypeLimits
patternTypeLimits :: ProtectionGroupPatternTypeLimits
maxProtectionGroups :: Integer
$sel:patternTypeLimits:ProtectionGroupLimits' :: ProtectionGroupLimits -> ProtectionGroupPatternTypeLimits
$sel:maxProtectionGroups:ProtectionGroupLimits' :: ProtectionGroupLimits -> Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Integer
maxProtectionGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ProtectionGroupPatternTypeLimits
patternTypeLimits