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

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

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

-- |
-- Create a value of 'StatefulRuleGroup' 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', 'statefulRuleGroup_resourceId' - The resource ID of the rule group.
--
-- 'ruleGroupName', 'statefulRuleGroup_ruleGroupName' - The name of the rule group.
newStatefulRuleGroup ::
  StatefulRuleGroup
newStatefulRuleGroup :: StatefulRuleGroup
newStatefulRuleGroup =
  StatefulRuleGroup' :: Maybe Text -> Maybe Text -> StatefulRuleGroup
StatefulRuleGroup'
    { $sel:resourceId:StatefulRuleGroup' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleGroupName:StatefulRuleGroup' :: Maybe Text
ruleGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance Core.FromJSON StatefulRuleGroup where
  parseJSON :: Value -> Parser StatefulRuleGroup
parseJSON =
    String
-> (Object -> Parser StatefulRuleGroup)
-> Value
-> Parser StatefulRuleGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StatefulRuleGroup"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> StatefulRuleGroup
StatefulRuleGroup'
            (Maybe Text -> Maybe Text -> StatefulRuleGroup)
-> Parser (Maybe Text) -> Parser (Maybe Text -> StatefulRuleGroup)
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 Text -> StatefulRuleGroup)
-> Parser (Maybe Text) -> Parser StatefulRuleGroup
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 StatefulRuleGroup

instance Prelude.NFData StatefulRuleGroup