{-# 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.WAFV2.Types.ManagedRuleSetSummary
-- 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.WAFV2.Types.ManagedRuleSetSummary 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 for a managed rule set.
--
-- This is intended for use only by vendors of managed rule sets. Vendors
-- are Amazon Web Services and Amazon Web Services Marketplace sellers.
--
-- Vendors, you can use the managed rule set APIs to provide controlled
-- rollout of your versioned managed rule group offerings for your
-- customers. The APIs are @ListManagedRuleSets@, @GetManagedRuleSet@,
-- @PutManagedRuleSetVersions@, and
-- @UpdateManagedRuleSetVersionExpiryDate@.
--
-- /See:/ 'newManagedRuleSetSummary' smart constructor.
data ManagedRuleSetSummary = ManagedRuleSetSummary'
  { -- | The Amazon Resource Name (ARN) of the entity.
    ManagedRuleSetSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | A description of the set that helps with identification.
    ManagedRuleSetSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the managed rule set. The ID is returned in the
    -- responses to commands like @list@. You provide it to operations like
    -- @get@ and @update@.
    ManagedRuleSetSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The label namespace prefix for the managed rule groups that are offered
    -- to customers from this managed rule set. All labels that are added by
    -- rules in the managed rule group have this prefix.
    --
    -- -   The syntax for the label namespace prefix for a managed rule group
    --     is the following:
    --
    --     @awswaf:managed:\<vendor>:\<rule group name>@:
    --
    -- -   When a rule with a label matches a web request, WAF adds the fully
    --     qualified label to the request. A fully qualified label is made up
    --     of the label namespace from the rule group or web ACL where the rule
    --     is defined and the label from the rule, separated by a colon:
    --
    --     @\<label namespace>:\<label from rule>@
    ManagedRuleSetSummary -> Maybe Text
labelNamespace :: Prelude.Maybe Prelude.Text,
    -- | A token used for optimistic locking. WAF returns a token to your @get@
    -- and @list@ requests, to mark the state of the entity at the time of the
    -- request. To make changes to the entity associated with the token, you
    -- provide the token to operations like @update@ and @delete@. WAF uses the
    -- token to ensure that no changes have been made to the entity since you
    -- last retrieved it. If a change has been made, the update fails with a
    -- @WAFOptimisticLockException@. If this happens, perform another @get@,
    -- and use the new token returned by that operation.
    ManagedRuleSetSummary -> Maybe Text
lockToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the managed rule set. You use this, along with the rule set
    -- ID, to identify the rule set.
    --
    -- This name is assigned to the corresponding managed rule group, which
    -- your customers can access and use.
    ManagedRuleSetSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (ManagedRuleSetSummary -> ManagedRuleSetSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManagedRuleSetSummary -> ManagedRuleSetSummary -> Bool
$c/= :: ManagedRuleSetSummary -> ManagedRuleSetSummary -> Bool
== :: ManagedRuleSetSummary -> ManagedRuleSetSummary -> Bool
$c== :: ManagedRuleSetSummary -> ManagedRuleSetSummary -> Bool
Prelude.Eq, ReadPrec [ManagedRuleSetSummary]
ReadPrec ManagedRuleSetSummary
Int -> ReadS ManagedRuleSetSummary
ReadS [ManagedRuleSetSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManagedRuleSetSummary]
$creadListPrec :: ReadPrec [ManagedRuleSetSummary]
readPrec :: ReadPrec ManagedRuleSetSummary
$creadPrec :: ReadPrec ManagedRuleSetSummary
readList :: ReadS [ManagedRuleSetSummary]
$creadList :: ReadS [ManagedRuleSetSummary]
readsPrec :: Int -> ReadS ManagedRuleSetSummary
$creadsPrec :: Int -> ReadS ManagedRuleSetSummary
Prelude.Read, Int -> ManagedRuleSetSummary -> ShowS
[ManagedRuleSetSummary] -> ShowS
ManagedRuleSetSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManagedRuleSetSummary] -> ShowS
$cshowList :: [ManagedRuleSetSummary] -> ShowS
show :: ManagedRuleSetSummary -> String
$cshow :: ManagedRuleSetSummary -> String
showsPrec :: Int -> ManagedRuleSetSummary -> ShowS
$cshowsPrec :: Int -> ManagedRuleSetSummary -> ShowS
Prelude.Show, forall x. Rep ManagedRuleSetSummary x -> ManagedRuleSetSummary
forall x. ManagedRuleSetSummary -> Rep ManagedRuleSetSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManagedRuleSetSummary x -> ManagedRuleSetSummary
$cfrom :: forall x. ManagedRuleSetSummary -> Rep ManagedRuleSetSummary x
Prelude.Generic)

-- |
-- Create a value of 'ManagedRuleSetSummary' 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', 'managedRuleSetSummary_arn' - The Amazon Resource Name (ARN) of the entity.
--
-- 'description', 'managedRuleSetSummary_description' - A description of the set that helps with identification.
--
-- 'id', 'managedRuleSetSummary_id' - A unique identifier for the managed rule set. The ID is returned in the
-- responses to commands like @list@. You provide it to operations like
-- @get@ and @update@.
--
-- 'labelNamespace', 'managedRuleSetSummary_labelNamespace' - The label namespace prefix for the managed rule groups that are offered
-- to customers from this managed rule set. All labels that are added by
-- rules in the managed rule group have this prefix.
--
-- -   The syntax for the label namespace prefix for a managed rule group
--     is the following:
--
--     @awswaf:managed:\<vendor>:\<rule group name>@:
--
-- -   When a rule with a label matches a web request, WAF adds the fully
--     qualified label to the request. A fully qualified label is made up
--     of the label namespace from the rule group or web ACL where the rule
--     is defined and the label from the rule, separated by a colon:
--
--     @\<label namespace>:\<label from rule>@
--
-- 'lockToken', 'managedRuleSetSummary_lockToken' - A token used for optimistic locking. WAF returns a token to your @get@
-- and @list@ requests, to mark the state of the entity at the time of the
-- request. To make changes to the entity associated with the token, you
-- provide the token to operations like @update@ and @delete@. WAF uses the
-- token to ensure that no changes have been made to the entity since you
-- last retrieved it. If a change has been made, the update fails with a
-- @WAFOptimisticLockException@. If this happens, perform another @get@,
-- and use the new token returned by that operation.
--
-- 'name', 'managedRuleSetSummary_name' - The name of the managed rule set. You use this, along with the rule set
-- ID, to identify the rule set.
--
-- This name is assigned to the corresponding managed rule group, which
-- your customers can access and use.
newManagedRuleSetSummary ::
  ManagedRuleSetSummary
newManagedRuleSetSummary :: ManagedRuleSetSummary
newManagedRuleSetSummary =
  ManagedRuleSetSummary'
    { $sel:arn:ManagedRuleSetSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ManagedRuleSetSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ManagedRuleSetSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:labelNamespace:ManagedRuleSetSummary' :: Maybe Text
labelNamespace = forall a. Maybe a
Prelude.Nothing,
      $sel:lockToken:ManagedRuleSetSummary' :: Maybe Text
lockToken = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ManagedRuleSetSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

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

-- | A description of the set that helps with identification.
managedRuleSetSummary_description :: Lens.Lens' ManagedRuleSetSummary (Prelude.Maybe Prelude.Text)
managedRuleSetSummary_description :: Lens' ManagedRuleSetSummary (Maybe Text)
managedRuleSetSummary_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedRuleSetSummary' {Maybe Text
description :: Maybe Text
$sel:description:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: ManagedRuleSetSummary
s@ManagedRuleSetSummary' {} Maybe Text
a -> ManagedRuleSetSummary
s {$sel:description:ManagedRuleSetSummary' :: Maybe Text
description = Maybe Text
a} :: ManagedRuleSetSummary)

-- | A unique identifier for the managed rule set. The ID is returned in the
-- responses to commands like @list@. You provide it to operations like
-- @get@ and @update@.
managedRuleSetSummary_id :: Lens.Lens' ManagedRuleSetSummary (Prelude.Maybe Prelude.Text)
managedRuleSetSummary_id :: Lens' ManagedRuleSetSummary (Maybe Text)
managedRuleSetSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedRuleSetSummary' {Maybe Text
id :: Maybe Text
$sel:id:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: ManagedRuleSetSummary
s@ManagedRuleSetSummary' {} Maybe Text
a -> ManagedRuleSetSummary
s {$sel:id:ManagedRuleSetSummary' :: Maybe Text
id = Maybe Text
a} :: ManagedRuleSetSummary)

-- | The label namespace prefix for the managed rule groups that are offered
-- to customers from this managed rule set. All labels that are added by
-- rules in the managed rule group have this prefix.
--
-- -   The syntax for the label namespace prefix for a managed rule group
--     is the following:
--
--     @awswaf:managed:\<vendor>:\<rule group name>@:
--
-- -   When a rule with a label matches a web request, WAF adds the fully
--     qualified label to the request. A fully qualified label is made up
--     of the label namespace from the rule group or web ACL where the rule
--     is defined and the label from the rule, separated by a colon:
--
--     @\<label namespace>:\<label from rule>@
managedRuleSetSummary_labelNamespace :: Lens.Lens' ManagedRuleSetSummary (Prelude.Maybe Prelude.Text)
managedRuleSetSummary_labelNamespace :: Lens' ManagedRuleSetSummary (Maybe Text)
managedRuleSetSummary_labelNamespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedRuleSetSummary' {Maybe Text
labelNamespace :: Maybe Text
$sel:labelNamespace:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
labelNamespace} -> Maybe Text
labelNamespace) (\s :: ManagedRuleSetSummary
s@ManagedRuleSetSummary' {} Maybe Text
a -> ManagedRuleSetSummary
s {$sel:labelNamespace:ManagedRuleSetSummary' :: Maybe Text
labelNamespace = Maybe Text
a} :: ManagedRuleSetSummary)

-- | A token used for optimistic locking. WAF returns a token to your @get@
-- and @list@ requests, to mark the state of the entity at the time of the
-- request. To make changes to the entity associated with the token, you
-- provide the token to operations like @update@ and @delete@. WAF uses the
-- token to ensure that no changes have been made to the entity since you
-- last retrieved it. If a change has been made, the update fails with a
-- @WAFOptimisticLockException@. If this happens, perform another @get@,
-- and use the new token returned by that operation.
managedRuleSetSummary_lockToken :: Lens.Lens' ManagedRuleSetSummary (Prelude.Maybe Prelude.Text)
managedRuleSetSummary_lockToken :: Lens' ManagedRuleSetSummary (Maybe Text)
managedRuleSetSummary_lockToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedRuleSetSummary' {Maybe Text
lockToken :: Maybe Text
$sel:lockToken:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
lockToken} -> Maybe Text
lockToken) (\s :: ManagedRuleSetSummary
s@ManagedRuleSetSummary' {} Maybe Text
a -> ManagedRuleSetSummary
s {$sel:lockToken:ManagedRuleSetSummary' :: Maybe Text
lockToken = Maybe Text
a} :: ManagedRuleSetSummary)

-- | The name of the managed rule set. You use this, along with the rule set
-- ID, to identify the rule set.
--
-- This name is assigned to the corresponding managed rule group, which
-- your customers can access and use.
managedRuleSetSummary_name :: Lens.Lens' ManagedRuleSetSummary (Prelude.Maybe Prelude.Text)
managedRuleSetSummary_name :: Lens' ManagedRuleSetSummary (Maybe Text)
managedRuleSetSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedRuleSetSummary' {Maybe Text
name :: Maybe Text
$sel:name:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: ManagedRuleSetSummary
s@ManagedRuleSetSummary' {} Maybe Text
a -> ManagedRuleSetSummary
s {$sel:name:ManagedRuleSetSummary' :: Maybe Text
name = Maybe Text
a} :: ManagedRuleSetSummary)

instance Data.FromJSON ManagedRuleSetSummary where
  parseJSON :: Value -> Parser ManagedRuleSetSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ManagedRuleSetSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ManagedRuleSetSummary
ManagedRuleSetSummary'
            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
"Description")
            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
"Id")
            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
"LabelNamespace")
            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
"LockToken")
            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 ManagedRuleSetSummary where
  hashWithSalt :: Int -> ManagedRuleSetSummary -> Int
hashWithSalt Int
_salt ManagedRuleSetSummary' {Maybe Text
name :: Maybe Text
lockToken :: Maybe Text
labelNamespace :: Maybe Text
id :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
$sel:name:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:lockToken:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:labelNamespace:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:id:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:description:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:arn:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> 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
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
labelNamespace
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lockToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData ManagedRuleSetSummary where
  rnf :: ManagedRuleSetSummary -> ()
rnf ManagedRuleSetSummary' {Maybe Text
name :: Maybe Text
lockToken :: Maybe Text
labelNamespace :: Maybe Text
id :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
$sel:name:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:lockToken:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:labelNamespace:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:id:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:description:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> Maybe Text
$sel:arn:ManagedRuleSetSummary' :: ManagedRuleSetSummary -> 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
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
labelNamespace
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lockToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name