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

-- | Network Firewall stateless rule group, used in a
-- NetworkFirewallPolicyDescription.
--
-- /See:/ 'newStatelessRuleGroup' smart constructor.
data StatelessRuleGroup = 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 -> Maybe Natural
priority :: Prelude.Maybe Prelude.Natural,
    -- | The resource ID of the rule group.
    StatelessRuleGroup -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The name of the rule group.
    StatelessRuleGroup -> Maybe Text
ruleGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (StatelessRuleGroup -> StatelessRuleGroup -> Bool
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]
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
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. 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:
--
-- '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.
--
-- 'resourceId', 'statelessRuleGroup_resourceId' - The resource ID of the rule group.
--
-- 'ruleGroupName', 'statelessRuleGroup_ruleGroupName' - The name of the rule group.
newStatelessRuleGroup ::
  StatelessRuleGroup
newStatelessRuleGroup :: StatelessRuleGroup
newStatelessRuleGroup =
  StatelessRuleGroup'
    { $sel:priority:StatelessRuleGroup' :: Maybe Natural
priority = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:StatelessRuleGroup' :: Maybe Text
resourceId = forall a. Maybe a
Prelude.Nothing,
      $sel:ruleGroupName:StatelessRuleGroup' :: Maybe Text
ruleGroupName = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' StatelessRuleGroup (Maybe Natural)
statelessRuleGroup_priority = 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 resource ID of the rule group.
statelessRuleGroup_resourceId :: Lens.Lens' StatelessRuleGroup (Prelude.Maybe Prelude.Text)
statelessRuleGroup_resourceId :: Lens' StatelessRuleGroup (Maybe Text)
statelessRuleGroup_resourceId = 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 name of the rule group.
statelessRuleGroup_ruleGroupName :: Lens.Lens' StatelessRuleGroup (Prelude.Maybe Prelude.Text)
statelessRuleGroup_ruleGroupName :: Lens' StatelessRuleGroup (Maybe Text)
statelessRuleGroup_ruleGroupName = 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 Data.FromJSON StatelessRuleGroup where
  parseJSON :: Value -> Parser StatelessRuleGroup
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StatelessRuleGroup"
      ( \Object
x ->
          Maybe Natural -> Maybe Text -> Maybe Text -> StatelessRuleGroup
StatelessRuleGroup'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Priority")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ResourceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RuleGroupName")
      )

instance Prelude.Hashable StatelessRuleGroup where
  hashWithSalt :: Int -> StatelessRuleGroup -> Int
hashWithSalt Int
_salt StatelessRuleGroup' {Maybe Natural
Maybe Text
ruleGroupName :: Maybe Text
resourceId :: Maybe Text
priority :: Maybe Natural
$sel:ruleGroupName:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Text
$sel:resourceId:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Text
$sel:priority:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
priority
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ruleGroupName

instance Prelude.NFData StatelessRuleGroup where
  rnf :: StatelessRuleGroup -> ()
rnf StatelessRuleGroup' {Maybe Natural
Maybe Text
ruleGroupName :: Maybe Text
resourceId :: Maybe Text
priority :: Maybe Natural
$sel:ruleGroupName:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Text
$sel:resourceId:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Text
$sel:priority:StatelessRuleGroup' :: StatelessRuleGroup -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
priority
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ruleGroupName