{-# 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.FMS.Types.DnsRuleGroupLimitExceededViolation
-- 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.FMS.Types.DnsRuleGroupLimitExceededViolation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The VPC that Firewall Manager was applying a DNS Fireall policy to
-- reached the limit for associated DNS Firewall rule groups. Firewall
-- Manager tried to associate another rule group with the VPC and failed
-- due to the limit.
--
-- /See:/ 'newDnsRuleGroupLimitExceededViolation' smart constructor.
data DnsRuleGroupLimitExceededViolation = DnsRuleGroupLimitExceededViolation'
  { -- | A description of the violation that specifies the rule group and VPC.
    DnsRuleGroupLimitExceededViolation -> Maybe Text
violationTargetDescription :: Prelude.Maybe Prelude.Text,
    -- | Information about the VPC ID.
    DnsRuleGroupLimitExceededViolation -> Maybe Text
violationTarget :: Prelude.Maybe Prelude.Text,
    -- | The number of rule groups currently associated with the VPC.
    DnsRuleGroupLimitExceededViolation -> Maybe Int
numberOfRuleGroupsAlreadyAssociated :: Prelude.Maybe Prelude.Int
  }
  deriving (DnsRuleGroupLimitExceededViolation
-> DnsRuleGroupLimitExceededViolation -> Bool
(DnsRuleGroupLimitExceededViolation
 -> DnsRuleGroupLimitExceededViolation -> Bool)
-> (DnsRuleGroupLimitExceededViolation
    -> DnsRuleGroupLimitExceededViolation -> Bool)
-> Eq DnsRuleGroupLimitExceededViolation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DnsRuleGroupLimitExceededViolation
-> DnsRuleGroupLimitExceededViolation -> Bool
$c/= :: DnsRuleGroupLimitExceededViolation
-> DnsRuleGroupLimitExceededViolation -> Bool
== :: DnsRuleGroupLimitExceededViolation
-> DnsRuleGroupLimitExceededViolation -> Bool
$c== :: DnsRuleGroupLimitExceededViolation
-> DnsRuleGroupLimitExceededViolation -> Bool
Prelude.Eq, ReadPrec [DnsRuleGroupLimitExceededViolation]
ReadPrec DnsRuleGroupLimitExceededViolation
Int -> ReadS DnsRuleGroupLimitExceededViolation
ReadS [DnsRuleGroupLimitExceededViolation]
(Int -> ReadS DnsRuleGroupLimitExceededViolation)
-> ReadS [DnsRuleGroupLimitExceededViolation]
-> ReadPrec DnsRuleGroupLimitExceededViolation
-> ReadPrec [DnsRuleGroupLimitExceededViolation]
-> Read DnsRuleGroupLimitExceededViolation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DnsRuleGroupLimitExceededViolation]
$creadListPrec :: ReadPrec [DnsRuleGroupLimitExceededViolation]
readPrec :: ReadPrec DnsRuleGroupLimitExceededViolation
$creadPrec :: ReadPrec DnsRuleGroupLimitExceededViolation
readList :: ReadS [DnsRuleGroupLimitExceededViolation]
$creadList :: ReadS [DnsRuleGroupLimitExceededViolation]
readsPrec :: Int -> ReadS DnsRuleGroupLimitExceededViolation
$creadsPrec :: Int -> ReadS DnsRuleGroupLimitExceededViolation
Prelude.Read, Int -> DnsRuleGroupLimitExceededViolation -> ShowS
[DnsRuleGroupLimitExceededViolation] -> ShowS
DnsRuleGroupLimitExceededViolation -> String
(Int -> DnsRuleGroupLimitExceededViolation -> ShowS)
-> (DnsRuleGroupLimitExceededViolation -> String)
-> ([DnsRuleGroupLimitExceededViolation] -> ShowS)
-> Show DnsRuleGroupLimitExceededViolation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DnsRuleGroupLimitExceededViolation] -> ShowS
$cshowList :: [DnsRuleGroupLimitExceededViolation] -> ShowS
show :: DnsRuleGroupLimitExceededViolation -> String
$cshow :: DnsRuleGroupLimitExceededViolation -> String
showsPrec :: Int -> DnsRuleGroupLimitExceededViolation -> ShowS
$cshowsPrec :: Int -> DnsRuleGroupLimitExceededViolation -> ShowS
Prelude.Show, (forall x.
 DnsRuleGroupLimitExceededViolation
 -> Rep DnsRuleGroupLimitExceededViolation x)
-> (forall x.
    Rep DnsRuleGroupLimitExceededViolation x
    -> DnsRuleGroupLimitExceededViolation)
-> Generic DnsRuleGroupLimitExceededViolation
forall x.
Rep DnsRuleGroupLimitExceededViolation x
-> DnsRuleGroupLimitExceededViolation
forall x.
DnsRuleGroupLimitExceededViolation
-> Rep DnsRuleGroupLimitExceededViolation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DnsRuleGroupLimitExceededViolation x
-> DnsRuleGroupLimitExceededViolation
$cfrom :: forall x.
DnsRuleGroupLimitExceededViolation
-> Rep DnsRuleGroupLimitExceededViolation x
Prelude.Generic)

-- |
-- Create a value of 'DnsRuleGroupLimitExceededViolation' 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:
--
-- 'violationTargetDescription', 'dnsRuleGroupLimitExceededViolation_violationTargetDescription' - A description of the violation that specifies the rule group and VPC.
--
-- 'violationTarget', 'dnsRuleGroupLimitExceededViolation_violationTarget' - Information about the VPC ID.
--
-- 'numberOfRuleGroupsAlreadyAssociated', 'dnsRuleGroupLimitExceededViolation_numberOfRuleGroupsAlreadyAssociated' - The number of rule groups currently associated with the VPC.
newDnsRuleGroupLimitExceededViolation ::
  DnsRuleGroupLimitExceededViolation
newDnsRuleGroupLimitExceededViolation :: DnsRuleGroupLimitExceededViolation
newDnsRuleGroupLimitExceededViolation =
  DnsRuleGroupLimitExceededViolation' :: Maybe Text
-> Maybe Text -> Maybe Int -> DnsRuleGroupLimitExceededViolation
DnsRuleGroupLimitExceededViolation'
    { $sel:violationTargetDescription:DnsRuleGroupLimitExceededViolation' :: Maybe Text
violationTargetDescription =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:violationTarget:DnsRuleGroupLimitExceededViolation' :: Maybe Text
violationTarget = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfRuleGroupsAlreadyAssociated:DnsRuleGroupLimitExceededViolation' :: Maybe Int
numberOfRuleGroupsAlreadyAssociated =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | A description of the violation that specifies the rule group and VPC.
dnsRuleGroupLimitExceededViolation_violationTargetDescription :: Lens.Lens' DnsRuleGroupLimitExceededViolation (Prelude.Maybe Prelude.Text)
dnsRuleGroupLimitExceededViolation_violationTargetDescription :: (Maybe Text -> f (Maybe Text))
-> DnsRuleGroupLimitExceededViolation
-> f DnsRuleGroupLimitExceededViolation
dnsRuleGroupLimitExceededViolation_violationTargetDescription = (DnsRuleGroupLimitExceededViolation -> Maybe Text)
-> (DnsRuleGroupLimitExceededViolation
    -> Maybe Text -> DnsRuleGroupLimitExceededViolation)
-> Lens
     DnsRuleGroupLimitExceededViolation
     DnsRuleGroupLimitExceededViolation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsRuleGroupLimitExceededViolation' {Maybe Text
violationTargetDescription :: Maybe Text
$sel:violationTargetDescription:DnsRuleGroupLimitExceededViolation' :: DnsRuleGroupLimitExceededViolation -> Maybe Text
violationTargetDescription} -> Maybe Text
violationTargetDescription) (\s :: DnsRuleGroupLimitExceededViolation
s@DnsRuleGroupLimitExceededViolation' {} Maybe Text
a -> DnsRuleGroupLimitExceededViolation
s {$sel:violationTargetDescription:DnsRuleGroupLimitExceededViolation' :: Maybe Text
violationTargetDescription = Maybe Text
a} :: DnsRuleGroupLimitExceededViolation)

-- | Information about the VPC ID.
dnsRuleGroupLimitExceededViolation_violationTarget :: Lens.Lens' DnsRuleGroupLimitExceededViolation (Prelude.Maybe Prelude.Text)
dnsRuleGroupLimitExceededViolation_violationTarget :: (Maybe Text -> f (Maybe Text))
-> DnsRuleGroupLimitExceededViolation
-> f DnsRuleGroupLimitExceededViolation
dnsRuleGroupLimitExceededViolation_violationTarget = (DnsRuleGroupLimitExceededViolation -> Maybe Text)
-> (DnsRuleGroupLimitExceededViolation
    -> Maybe Text -> DnsRuleGroupLimitExceededViolation)
-> Lens
     DnsRuleGroupLimitExceededViolation
     DnsRuleGroupLimitExceededViolation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsRuleGroupLimitExceededViolation' {Maybe Text
violationTarget :: Maybe Text
$sel:violationTarget:DnsRuleGroupLimitExceededViolation' :: DnsRuleGroupLimitExceededViolation -> Maybe Text
violationTarget} -> Maybe Text
violationTarget) (\s :: DnsRuleGroupLimitExceededViolation
s@DnsRuleGroupLimitExceededViolation' {} Maybe Text
a -> DnsRuleGroupLimitExceededViolation
s {$sel:violationTarget:DnsRuleGroupLimitExceededViolation' :: Maybe Text
violationTarget = Maybe Text
a} :: DnsRuleGroupLimitExceededViolation)

-- | The number of rule groups currently associated with the VPC.
dnsRuleGroupLimitExceededViolation_numberOfRuleGroupsAlreadyAssociated :: Lens.Lens' DnsRuleGroupLimitExceededViolation (Prelude.Maybe Prelude.Int)
dnsRuleGroupLimitExceededViolation_numberOfRuleGroupsAlreadyAssociated :: (Maybe Int -> f (Maybe Int))
-> DnsRuleGroupLimitExceededViolation
-> f DnsRuleGroupLimitExceededViolation
dnsRuleGroupLimitExceededViolation_numberOfRuleGroupsAlreadyAssociated = (DnsRuleGroupLimitExceededViolation -> Maybe Int)
-> (DnsRuleGroupLimitExceededViolation
    -> Maybe Int -> DnsRuleGroupLimitExceededViolation)
-> Lens
     DnsRuleGroupLimitExceededViolation
     DnsRuleGroupLimitExceededViolation
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsRuleGroupLimitExceededViolation' {Maybe Int
numberOfRuleGroupsAlreadyAssociated :: Maybe Int
$sel:numberOfRuleGroupsAlreadyAssociated:DnsRuleGroupLimitExceededViolation' :: DnsRuleGroupLimitExceededViolation -> Maybe Int
numberOfRuleGroupsAlreadyAssociated} -> Maybe Int
numberOfRuleGroupsAlreadyAssociated) (\s :: DnsRuleGroupLimitExceededViolation
s@DnsRuleGroupLimitExceededViolation' {} Maybe Int
a -> DnsRuleGroupLimitExceededViolation
s {$sel:numberOfRuleGroupsAlreadyAssociated:DnsRuleGroupLimitExceededViolation' :: Maybe Int
numberOfRuleGroupsAlreadyAssociated = Maybe Int
a} :: DnsRuleGroupLimitExceededViolation)

instance
  Core.FromJSON
    DnsRuleGroupLimitExceededViolation
  where
  parseJSON :: Value -> Parser DnsRuleGroupLimitExceededViolation
parseJSON =
    String
-> (Object -> Parser DnsRuleGroupLimitExceededViolation)
-> Value
-> Parser DnsRuleGroupLimitExceededViolation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DnsRuleGroupLimitExceededViolation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Int -> DnsRuleGroupLimitExceededViolation
DnsRuleGroupLimitExceededViolation'
            (Maybe Text
 -> Maybe Text -> Maybe Int -> DnsRuleGroupLimitExceededViolation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Int -> DnsRuleGroupLimitExceededViolation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ViolationTargetDescription")
            Parser
  (Maybe Text -> Maybe Int -> DnsRuleGroupLimitExceededViolation)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> DnsRuleGroupLimitExceededViolation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ViolationTarget")
            Parser (Maybe Int -> DnsRuleGroupLimitExceededViolation)
-> Parser (Maybe Int) -> Parser DnsRuleGroupLimitExceededViolation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NumberOfRuleGroupsAlreadyAssociated")
      )

instance
  Prelude.Hashable
    DnsRuleGroupLimitExceededViolation

instance
  Prelude.NFData
    DnsRuleGroupLimitExceededViolation