{-# 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.RegexPatternSetSummary
-- 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.RegexPatternSetSummary 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 RegexPatternSet, returned by operations
-- like create and list. This provides information like the ID, that you
-- can use to retrieve and manage a @RegexPatternSet@, and the ARN, that
-- you provide to the RegexPatternSetReferenceStatement to use the pattern
-- set in a Rule.
--
-- /See:/ 'newRegexPatternSetSummary' smart constructor.
data RegexPatternSetSummary = RegexPatternSetSummary'
  { -- | The Amazon Resource Name (ARN) of the entity.
    RegexPatternSetSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | A description of the set that helps with identification.
    RegexPatternSetSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the set. This ID is returned in the responses to
    -- create and list commands. You provide it to operations like update and
    -- delete.
    RegexPatternSetSummary -> Maybe Text
id :: 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.
    RegexPatternSetSummary -> Maybe Text
lockToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the data type instance. You cannot change the name after you
    -- create the instance.
    RegexPatternSetSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (RegexPatternSetSummary -> RegexPatternSetSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegexPatternSetSummary -> RegexPatternSetSummary -> Bool
$c/= :: RegexPatternSetSummary -> RegexPatternSetSummary -> Bool
== :: RegexPatternSetSummary -> RegexPatternSetSummary -> Bool
$c== :: RegexPatternSetSummary -> RegexPatternSetSummary -> Bool
Prelude.Eq, ReadPrec [RegexPatternSetSummary]
ReadPrec RegexPatternSetSummary
Int -> ReadS RegexPatternSetSummary
ReadS [RegexPatternSetSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegexPatternSetSummary]
$creadListPrec :: ReadPrec [RegexPatternSetSummary]
readPrec :: ReadPrec RegexPatternSetSummary
$creadPrec :: ReadPrec RegexPatternSetSummary
readList :: ReadS [RegexPatternSetSummary]
$creadList :: ReadS [RegexPatternSetSummary]
readsPrec :: Int -> ReadS RegexPatternSetSummary
$creadsPrec :: Int -> ReadS RegexPatternSetSummary
Prelude.Read, Int -> RegexPatternSetSummary -> ShowS
[RegexPatternSetSummary] -> ShowS
RegexPatternSetSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegexPatternSetSummary] -> ShowS
$cshowList :: [RegexPatternSetSummary] -> ShowS
show :: RegexPatternSetSummary -> String
$cshow :: RegexPatternSetSummary -> String
showsPrec :: Int -> RegexPatternSetSummary -> ShowS
$cshowsPrec :: Int -> RegexPatternSetSummary -> ShowS
Prelude.Show, forall x. Rep RegexPatternSetSummary x -> RegexPatternSetSummary
forall x. RegexPatternSetSummary -> Rep RegexPatternSetSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegexPatternSetSummary x -> RegexPatternSetSummary
$cfrom :: forall x. RegexPatternSetSummary -> Rep RegexPatternSetSummary x
Prelude.Generic)

-- |
-- Create a value of 'RegexPatternSetSummary' 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', 'regexPatternSetSummary_arn' - The Amazon Resource Name (ARN) of the entity.
--
-- 'description', 'regexPatternSetSummary_description' - A description of the set that helps with identification.
--
-- 'id', 'regexPatternSetSummary_id' - A unique identifier for the set. This ID is returned in the responses to
-- create and list commands. You provide it to operations like update and
-- delete.
--
-- 'lockToken', 'regexPatternSetSummary_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', 'regexPatternSetSummary_name' - The name of the data type instance. You cannot change the name after you
-- create the instance.
newRegexPatternSetSummary ::
  RegexPatternSetSummary
newRegexPatternSetSummary :: RegexPatternSetSummary
newRegexPatternSetSummary =
  RegexPatternSetSummary'
    { $sel:arn:RegexPatternSetSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:description:RegexPatternSetSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:RegexPatternSetSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:lockToken:RegexPatternSetSummary' :: Maybe Text
lockToken = forall a. Maybe a
Prelude.Nothing,
      $sel:name:RegexPatternSetSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

-- | 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.
regexPatternSetSummary_lockToken :: Lens.Lens' RegexPatternSetSummary (Prelude.Maybe Prelude.Text)
regexPatternSetSummary_lockToken :: Lens' RegexPatternSetSummary (Maybe Text)
regexPatternSetSummary_lockToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegexPatternSetSummary' {Maybe Text
lockToken :: Maybe Text
$sel:lockToken:RegexPatternSetSummary' :: RegexPatternSetSummary -> Maybe Text
lockToken} -> Maybe Text
lockToken) (\s :: RegexPatternSetSummary
s@RegexPatternSetSummary' {} Maybe Text
a -> RegexPatternSetSummary
s {$sel:lockToken:RegexPatternSetSummary' :: Maybe Text
lockToken = Maybe Text
a} :: RegexPatternSetSummary)

-- | The name of the data type instance. You cannot change the name after you
-- create the instance.
regexPatternSetSummary_name :: Lens.Lens' RegexPatternSetSummary (Prelude.Maybe Prelude.Text)
regexPatternSetSummary_name :: Lens' RegexPatternSetSummary (Maybe Text)
regexPatternSetSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegexPatternSetSummary' {Maybe Text
name :: Maybe Text
$sel:name:RegexPatternSetSummary' :: RegexPatternSetSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: RegexPatternSetSummary
s@RegexPatternSetSummary' {} Maybe Text
a -> RegexPatternSetSummary
s {$sel:name:RegexPatternSetSummary' :: Maybe Text
name = Maybe Text
a} :: RegexPatternSetSummary)

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

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