{-# 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.ProtectionLimits
-- 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.ProtectionLimits where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Shield.Types.Limit

-- | Limits settings on protections for your subscription.
--
-- /See:/ 'newProtectionLimits' smart constructor.
data ProtectionLimits = ProtectionLimits'
  { -- | The maximum number of resource types that you can specify in a
    -- protection.
    ProtectionLimits -> [Limit]
protectedResourceTypeLimits :: [Limit]
  }
  deriving (ProtectionLimits -> ProtectionLimits -> Bool
(ProtectionLimits -> ProtectionLimits -> Bool)
-> (ProtectionLimits -> ProtectionLimits -> Bool)
-> Eq ProtectionLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtectionLimits -> ProtectionLimits -> Bool
$c/= :: ProtectionLimits -> ProtectionLimits -> Bool
== :: ProtectionLimits -> ProtectionLimits -> Bool
$c== :: ProtectionLimits -> ProtectionLimits -> Bool
Prelude.Eq, ReadPrec [ProtectionLimits]
ReadPrec ProtectionLimits
Int -> ReadS ProtectionLimits
ReadS [ProtectionLimits]
(Int -> ReadS ProtectionLimits)
-> ReadS [ProtectionLimits]
-> ReadPrec ProtectionLimits
-> ReadPrec [ProtectionLimits]
-> Read ProtectionLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProtectionLimits]
$creadListPrec :: ReadPrec [ProtectionLimits]
readPrec :: ReadPrec ProtectionLimits
$creadPrec :: ReadPrec ProtectionLimits
readList :: ReadS [ProtectionLimits]
$creadList :: ReadS [ProtectionLimits]
readsPrec :: Int -> ReadS ProtectionLimits
$creadsPrec :: Int -> ReadS ProtectionLimits
Prelude.Read, Int -> ProtectionLimits -> ShowS
[ProtectionLimits] -> ShowS
ProtectionLimits -> String
(Int -> ProtectionLimits -> ShowS)
-> (ProtectionLimits -> String)
-> ([ProtectionLimits] -> ShowS)
-> Show ProtectionLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtectionLimits] -> ShowS
$cshowList :: [ProtectionLimits] -> ShowS
show :: ProtectionLimits -> String
$cshow :: ProtectionLimits -> String
showsPrec :: Int -> ProtectionLimits -> ShowS
$cshowsPrec :: Int -> ProtectionLimits -> ShowS
Prelude.Show, (forall x. ProtectionLimits -> Rep ProtectionLimits x)
-> (forall x. Rep ProtectionLimits x -> ProtectionLimits)
-> Generic ProtectionLimits
forall x. Rep ProtectionLimits x -> ProtectionLimits
forall x. ProtectionLimits -> Rep ProtectionLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProtectionLimits x -> ProtectionLimits
$cfrom :: forall x. ProtectionLimits -> Rep ProtectionLimits x
Prelude.Generic)

-- |
-- Create a value of 'ProtectionLimits' 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:
--
-- 'protectedResourceTypeLimits', 'protectionLimits_protectedResourceTypeLimits' - The maximum number of resource types that you can specify in a
-- protection.
newProtectionLimits ::
  ProtectionLimits
newProtectionLimits :: ProtectionLimits
newProtectionLimits =
  ProtectionLimits' :: [Limit] -> ProtectionLimits
ProtectionLimits'
    { $sel:protectedResourceTypeLimits:ProtectionLimits' :: [Limit]
protectedResourceTypeLimits =
        [Limit]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The maximum number of resource types that you can specify in a
-- protection.
protectionLimits_protectedResourceTypeLimits :: Lens.Lens' ProtectionLimits [Limit]
protectionLimits_protectedResourceTypeLimits :: ([Limit] -> f [Limit]) -> ProtectionLimits -> f ProtectionLimits
protectionLimits_protectedResourceTypeLimits = (ProtectionLimits -> [Limit])
-> (ProtectionLimits -> [Limit] -> ProtectionLimits)
-> Lens ProtectionLimits ProtectionLimits [Limit] [Limit]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionLimits' {[Limit]
protectedResourceTypeLimits :: [Limit]
$sel:protectedResourceTypeLimits:ProtectionLimits' :: ProtectionLimits -> [Limit]
protectedResourceTypeLimits} -> [Limit]
protectedResourceTypeLimits) (\s :: ProtectionLimits
s@ProtectionLimits' {} [Limit]
a -> ProtectionLimits
s {$sel:protectedResourceTypeLimits:ProtectionLimits' :: [Limit]
protectedResourceTypeLimits = [Limit]
a} :: ProtectionLimits) (([Limit] -> f [Limit]) -> ProtectionLimits -> f ProtectionLimits)
-> (([Limit] -> f [Limit]) -> [Limit] -> f [Limit])
-> ([Limit] -> f [Limit])
-> ProtectionLimits
-> f ProtectionLimits
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Limit] -> f [Limit]) -> [Limit] -> f [Limit]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ProtectionLimits where
  parseJSON :: Value -> Parser ProtectionLimits
parseJSON =
    String
-> (Object -> Parser ProtectionLimits)
-> Value
-> Parser ProtectionLimits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProtectionLimits"
      ( \Object
x ->
          [Limit] -> ProtectionLimits
ProtectionLimits'
            ([Limit] -> ProtectionLimits)
-> Parser [Limit] -> Parser ProtectionLimits
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe [Limit])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProtectedResourceTypeLimits"
                            Parser (Maybe [Limit]) -> [Limit] -> Parser [Limit]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Limit]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ProtectionLimits

instance Prelude.NFData ProtectionLimits