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

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

-- | Network Firewall stateless rule group, used in a
-- NetworkFirewallPolicyDescription.
--
-- /See:/ 'newStatelessRuleGroup' smart constructor.
data StatelessRuleGroup = StatelessRuleGroup'
  { -- | The resource ID of the rule group.
    StatelessRuleGroup -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The priority of the rule group. Network Firewall evaluates the stateless
    -- rule groups in a firewall policy starting from the lowest priority
    -- setting.
    StatelessRuleGroup -> Maybe Natural
priority :: Prelude.Maybe Prelude.Natural,
    -- | The name of the rule group.
    StatelessRuleGroup -> Maybe Text
ruleGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (StatelessRuleGroup -> StatelessRuleGroup -> Bool
(StatelessRuleGroup -> StatelessRuleGroup -> Bool)
-> (StatelessRuleGroup -> StatelessRuleGroup -> Bool)
-> Eq StatelessRuleGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StatelessRuleGroup -> StatelessRuleGroup -> Bool
$c/= :: StatelessRuleGroup -> StatelessRuleGroup -> Bool
== :: StatelessRuleGroup -> StatelessRuleGroup -> Bool
$c== :: StatelessRuleGroup -> StatelessRuleGroup -> Bool
Prelude.Eq, ReadPrec [StatelessRuleGroup]
ReadPrec StatelessRuleGroup
Int -> ReadS StatelessRuleGroup
ReadS [StatelessRuleGroup]
(Int -> ReadS StatelessRuleGroup)
-> ReadS [StatelessRuleGroup]
-> ReadPrec StatelessRuleGroup
-> ReadPrec [StatelessRuleGroup]
-> Read StatelessRuleGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StatelessRuleGroup]
$creadListPrec :: ReadPrec [StatelessRuleGroup]
readPrec :: ReadPrec StatelessRuleGroup
$creadPrec :: ReadPrec StatelessRuleGroup
readList :: ReadS [StatelessRuleGroup]
$creadList :: ReadS [StatelessRuleGroup]
readsPrec :: Int -> ReadS StatelessRuleGroup
$creadsPrec :: Int -> ReadS StatelessRuleGroup
Prelude.Read, Int -> StatelessRuleGroup -> ShowS
[StatelessRuleGroup] -> ShowS
StatelessRuleGroup -> String
(Int -> StatelessRuleGroup -> ShowS)
-> (StatelessRuleGroup -> String)
-> ([StatelessRuleGroup] -> ShowS)
-> Show StatelessRuleGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StatelessRuleGroup] -> ShowS
$cshowList :: [StatelessRuleGroup] -> ShowS
show :: StatelessRuleGroup -> String
$cshow :: StatelessRuleGroup -> String
showsPrec :: Int -> StatelessRuleGroup -> ShowS
$cshowsPrec :: Int -> StatelessRuleGroup -> ShowS
Prelude.Show, (forall x. StatelessRuleGroup -> Rep StatelessRuleGroup x)
-> (forall x. Rep StatelessRuleGroup x -> StatelessRuleGroup)
-> Generic StatelessRuleGroup
forall x. Rep StatelessRuleGroup x -> StatelessRuleGroup
forall x. StatelessRuleGroup -> Rep StatelessRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StatelessRuleGroup x -> StatelessRuleGroup
$cfrom :: forall x. StatelessRuleGroup -> Rep StatelessRuleGroup x
Prelude.Generic)

-- |
-- Create a value of 'StatelessRuleGroup' 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:
--
-- 'resourceId', 'statelessRuleGroup_resourceId' - The resource ID of the rule group.
--
-- 'priority', 'statelessRuleGroup_priority' - The priority of the rule group. Network Firewall evaluates the stateless
-- rule groups in a firewall policy starting from the lowest priority
-- setting.
--
-- 'ruleGroupName', 'statelessRuleGroup_ruleGroupName' - The name of the rule group.
newStatelessRuleGroup ::
  StatelessRuleGroup
newStatelessRuleGroup :: StatelessRuleGroup
newStatelessRuleGroup =
  StatelessRuleGroup' :: Maybe Text -> Maybe Natural -> Maybe Text -> StatelessRuleGroup
StatelessRuleGroup'
    { $sel:resourceId:StatelessRuleGroup' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:priority:StatelessRuleGroup' :: Maybe Natural
priority = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleGroupName:StatelessRuleGroup' :: Maybe Text
ruleGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The resource ID of the rule group.
statelessRuleGroup_resourceId :: Lens.Lens' StatelessRuleGroup (Prelude.Maybe Prelude.Text)
statelessRuleGroup_resourceId :: (Maybe Text -> f (Maybe Text))
-> StatelessRuleGroup -> f StatelessRuleGroup
statelessRuleGroup_resourceId = (StatelessRuleGroup -> Maybe Text)
-> (StatelessRuleGroup -> Maybe Text -> StatelessRuleGroup)
-> Lens
     StatelessRuleGroup StatelessRuleGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatelessRuleGroup' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: StatelessRuleGroup
s@StatelessRuleGroup' {} Maybe Text
a -> StatelessRuleGroup
s {$sel:resourceId:StatelessRuleGroup' :: Maybe Text
resourceId = Maybe Text
a} :: StatelessRuleGroup)

-- | The priority of the rule group. Network Firewall evaluates the stateless
-- rule groups in a firewall policy starting from the lowest priority
-- setting.
statelessRuleGroup_priority :: Lens.Lens' StatelessRuleGroup (Prelude.Maybe Prelude.Natural)
statelessRuleGroup_priority :: (Maybe Natural -> f (Maybe Natural))
-> StatelessRuleGroup -> f StatelessRuleGroup
statelessRuleGroup_priority = (StatelessRuleGroup -> Maybe Natural)
-> (StatelessRuleGroup -> Maybe Natural -> StatelessRuleGroup)
-> Lens
     StatelessRuleGroup
     StatelessRuleGroup
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatelessRuleGroup' {Maybe Natural
priority :: Maybe Natural
$sel:priority:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Natural
priority} -> Maybe Natural
priority) (\s :: StatelessRuleGroup
s@StatelessRuleGroup' {} Maybe Natural
a -> StatelessRuleGroup
s {$sel:priority:StatelessRuleGroup' :: Maybe Natural
priority = Maybe Natural
a} :: StatelessRuleGroup)

-- | The name of the rule group.
statelessRuleGroup_ruleGroupName :: Lens.Lens' StatelessRuleGroup (Prelude.Maybe Prelude.Text)
statelessRuleGroup_ruleGroupName :: (Maybe Text -> f (Maybe Text))
-> StatelessRuleGroup -> f StatelessRuleGroup
statelessRuleGroup_ruleGroupName = (StatelessRuleGroup -> Maybe Text)
-> (StatelessRuleGroup -> Maybe Text -> StatelessRuleGroup)
-> Lens
     StatelessRuleGroup StatelessRuleGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatelessRuleGroup' {Maybe Text
ruleGroupName :: Maybe Text
$sel:ruleGroupName:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Text
ruleGroupName} -> Maybe Text
ruleGroupName) (\s :: StatelessRuleGroup
s@StatelessRuleGroup' {} Maybe Text
a -> StatelessRuleGroup
s {$sel:ruleGroupName:StatelessRuleGroup' :: Maybe Text
ruleGroupName = Maybe Text
a} :: StatelessRuleGroup)

instance Core.FromJSON StatelessRuleGroup where
  parseJSON :: Value -> Parser StatelessRuleGroup
parseJSON =
    String
-> (Object -> Parser StatelessRuleGroup)
-> Value
-> Parser StatelessRuleGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StatelessRuleGroup"
      ( \Object
x ->
          Maybe Text -> Maybe Natural -> Maybe Text -> StatelessRuleGroup
StatelessRuleGroup'
            (Maybe Text -> Maybe Natural -> Maybe Text -> StatelessRuleGroup)
-> Parser (Maybe Text)
-> Parser (Maybe Natural -> Maybe Text -> StatelessRuleGroup)
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
"ResourceId")
            Parser (Maybe Natural -> Maybe Text -> StatelessRuleGroup)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> StatelessRuleGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Priority")
            Parser (Maybe Text -> StatelessRuleGroup)
-> Parser (Maybe Text) -> Parser StatelessRuleGroup
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
"RuleGroupName")
      )

instance Prelude.Hashable StatelessRuleGroup

instance Prelude.NFData StatelessRuleGroup