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

-- |
-- Create a value of 'WebACLSummary' 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', 'webACLSummary_arn' - The Amazon Resource Name (ARN) of the entity.
--
-- 'description', 'webACLSummary_description' - A description of the web ACL that helps with identification.
--
-- 'id', 'webACLSummary_id' - The unique identifier for the web ACL. This ID is returned in the
-- responses to create and list commands. You provide it to operations like
-- update and delete.
--
-- 'lockToken', 'webACLSummary_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', 'webACLSummary_name' - The name of the web ACL. You cannot change the name of a web ACL after
-- you create it.
newWebACLSummary ::
  WebACLSummary
newWebACLSummary :: WebACLSummary
newWebACLSummary =
  WebACLSummary'
    { $sel:arn:WebACLSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:description:WebACLSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:WebACLSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:lockToken:WebACLSummary' :: Maybe Text
lockToken = forall a. Maybe a
Prelude.Nothing,
      $sel:name:WebACLSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

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

-- | The name of the web ACL. You cannot change the name of a web ACL after
-- you create it.
webACLSummary_name :: Lens.Lens' WebACLSummary (Prelude.Maybe Prelude.Text)
webACLSummary_name :: Lens' WebACLSummary (Maybe Text)
webACLSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebACLSummary' {Maybe Text
name :: Maybe Text
$sel:name:WebACLSummary' :: WebACLSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: WebACLSummary
s@WebACLSummary' {} Maybe Text
a -> WebACLSummary
s {$sel:name:WebACLSummary' :: Maybe Text
name = Maybe Text
a} :: WebACLSummary)

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