{-# 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.NetworkFirewall.Types.RuleGroupMetadata
-- 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.NetworkFirewall.Types.RuleGroupMetadata 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

-- | High-level information about a rule group, returned by ListRuleGroups.
-- You can use the information provided in the metadata to retrieve and
-- manage a rule group.
--
-- /See:/ 'newRuleGroupMetadata' smart constructor.
data RuleGroupMetadata = RuleGroupMetadata'
  { -- | The Amazon Resource Name (ARN) of the rule group.
    RuleGroupMetadata -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The descriptive name of the rule group. You can\'t change the name of a
    -- rule group after you create it.
    RuleGroupMetadata -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (RuleGroupMetadata -> RuleGroupMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RuleGroupMetadata -> RuleGroupMetadata -> Bool
$c/= :: RuleGroupMetadata -> RuleGroupMetadata -> Bool
== :: RuleGroupMetadata -> RuleGroupMetadata -> Bool
$c== :: RuleGroupMetadata -> RuleGroupMetadata -> Bool
Prelude.Eq, ReadPrec [RuleGroupMetadata]
ReadPrec RuleGroupMetadata
Int -> ReadS RuleGroupMetadata
ReadS [RuleGroupMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RuleGroupMetadata]
$creadListPrec :: ReadPrec [RuleGroupMetadata]
readPrec :: ReadPrec RuleGroupMetadata
$creadPrec :: ReadPrec RuleGroupMetadata
readList :: ReadS [RuleGroupMetadata]
$creadList :: ReadS [RuleGroupMetadata]
readsPrec :: Int -> ReadS RuleGroupMetadata
$creadsPrec :: Int -> ReadS RuleGroupMetadata
Prelude.Read, Int -> RuleGroupMetadata -> ShowS
[RuleGroupMetadata] -> ShowS
RuleGroupMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuleGroupMetadata] -> ShowS
$cshowList :: [RuleGroupMetadata] -> ShowS
show :: RuleGroupMetadata -> String
$cshow :: RuleGroupMetadata -> String
showsPrec :: Int -> RuleGroupMetadata -> ShowS
$cshowsPrec :: Int -> RuleGroupMetadata -> ShowS
Prelude.Show, forall x. Rep RuleGroupMetadata x -> RuleGroupMetadata
forall x. RuleGroupMetadata -> Rep RuleGroupMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RuleGroupMetadata x -> RuleGroupMetadata
$cfrom :: forall x. RuleGroupMetadata -> Rep RuleGroupMetadata x
Prelude.Generic)

-- |
-- Create a value of 'RuleGroupMetadata' 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:
--
-- 'arn', 'ruleGroupMetadata_arn' - The Amazon Resource Name (ARN) of the rule group.
--
-- 'name', 'ruleGroupMetadata_name' - The descriptive name of the rule group. You can\'t change the name of a
-- rule group after you create it.
newRuleGroupMetadata ::
  RuleGroupMetadata
newRuleGroupMetadata :: RuleGroupMetadata
newRuleGroupMetadata =
  RuleGroupMetadata'
    { $sel:arn:RuleGroupMetadata' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:RuleGroupMetadata' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the rule group.
ruleGroupMetadata_arn :: Lens.Lens' RuleGroupMetadata (Prelude.Maybe Prelude.Text)
ruleGroupMetadata_arn :: Lens' RuleGroupMetadata (Maybe Text)
ruleGroupMetadata_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroupMetadata' {Maybe Text
arn :: Maybe Text
$sel:arn:RuleGroupMetadata' :: RuleGroupMetadata -> Maybe Text
arn} -> Maybe Text
arn) (\s :: RuleGroupMetadata
s@RuleGroupMetadata' {} Maybe Text
a -> RuleGroupMetadata
s {$sel:arn:RuleGroupMetadata' :: Maybe Text
arn = Maybe Text
a} :: RuleGroupMetadata)

-- | The descriptive name of the rule group. You can\'t change the name of a
-- rule group after you create it.
ruleGroupMetadata_name :: Lens.Lens' RuleGroupMetadata (Prelude.Maybe Prelude.Text)
ruleGroupMetadata_name :: Lens' RuleGroupMetadata (Maybe Text)
ruleGroupMetadata_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroupMetadata' {Maybe Text
name :: Maybe Text
$sel:name:RuleGroupMetadata' :: RuleGroupMetadata -> Maybe Text
name} -> Maybe Text
name) (\s :: RuleGroupMetadata
s@RuleGroupMetadata' {} Maybe Text
a -> RuleGroupMetadata
s {$sel:name:RuleGroupMetadata' :: Maybe Text
name = Maybe Text
a} :: RuleGroupMetadata)

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

instance Prelude.Hashable RuleGroupMetadata where
  hashWithSalt :: Int -> RuleGroupMetadata -> Int
hashWithSalt Int
_salt RuleGroupMetadata' {Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:name:RuleGroupMetadata' :: RuleGroupMetadata -> Maybe Text
$sel:arn:RuleGroupMetadata' :: RuleGroupMetadata -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData RuleGroupMetadata where
  rnf :: RuleGroupMetadata -> ()
rnf RuleGroupMetadata' {Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:name:RuleGroupMetadata' :: RuleGroupMetadata -> Maybe Text
$sel:arn:RuleGroupMetadata' :: RuleGroupMetadata -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name