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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(RuleGroupMetadata -> RuleGroupMetadata -> Bool)
-> (RuleGroupMetadata -> RuleGroupMetadata -> Bool)
-> Eq RuleGroupMetadata
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]
(Int -> ReadS RuleGroupMetadata)
-> ReadS [RuleGroupMetadata]
-> ReadPrec RuleGroupMetadata
-> ReadPrec [RuleGroupMetadata]
-> Read 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
(Int -> RuleGroupMetadata -> ShowS)
-> (RuleGroupMetadata -> String)
-> ([RuleGroupMetadata] -> ShowS)
-> Show RuleGroupMetadata
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. RuleGroupMetadata -> Rep RuleGroupMetadata x)
-> (forall x. Rep RuleGroupMetadata x -> RuleGroupMetadata)
-> Generic RuleGroupMetadata
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' :: Maybe Text -> Maybe Text -> RuleGroupMetadata
RuleGroupMetadata'
    { $sel:arn:RuleGroupMetadata' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:RuleGroupMetadata' :: Maybe Text
name = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> RuleGroupMetadata -> f RuleGroupMetadata
ruleGroupMetadata_arn = (RuleGroupMetadata -> Maybe Text)
-> (RuleGroupMetadata -> Maybe Text -> RuleGroupMetadata)
-> Lens
     RuleGroupMetadata RuleGroupMetadata (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> RuleGroupMetadata -> f RuleGroupMetadata
ruleGroupMetadata_name = (RuleGroupMetadata -> Maybe Text)
-> (RuleGroupMetadata -> Maybe Text -> RuleGroupMetadata)
-> Lens
     RuleGroupMetadata RuleGroupMetadata (Maybe Text) (Maybe Text)
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 Core.FromJSON RuleGroupMetadata where
  parseJSON :: Value -> Parser RuleGroupMetadata
parseJSON =
    String
-> (Object -> Parser RuleGroupMetadata)
-> Value
-> Parser RuleGroupMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RuleGroupMetadata"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> RuleGroupMetadata
RuleGroupMetadata'
            (Maybe Text -> Maybe Text -> RuleGroupMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Text -> RuleGroupMetadata)
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
"Arn") Parser (Maybe Text -> RuleGroupMetadata)
-> Parser (Maybe Text) -> Parser RuleGroupMetadata
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
"Name")
      )

instance Prelude.Hashable RuleGroupMetadata

instance Prelude.NFData RuleGroupMetadata