{-# 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.LabelSummary
-- 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.LabelSummary 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

-- | List of labels used by one or more of the rules of a RuleGroup. This
-- summary object is used for the following rule group lists:
--
-- -   @AvailableLabels@ - Labels that rules add to matching requests.
--     These labels are defined in the @RuleLabels@ for a Rule.
--
-- -   @ConsumedLabels@ - Labels that rules match against. These labels are
--     defined in a @LabelMatchStatement@ specification, in the Statement
--     definition of a rule.
--
-- /See:/ 'newLabelSummary' smart constructor.
data LabelSummary = LabelSummary'
  { -- | An individual label specification.
    LabelSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (LabelSummary -> LabelSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LabelSummary -> LabelSummary -> Bool
$c/= :: LabelSummary -> LabelSummary -> Bool
== :: LabelSummary -> LabelSummary -> Bool
$c== :: LabelSummary -> LabelSummary -> Bool
Prelude.Eq, ReadPrec [LabelSummary]
ReadPrec LabelSummary
Int -> ReadS LabelSummary
ReadS [LabelSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LabelSummary]
$creadListPrec :: ReadPrec [LabelSummary]
readPrec :: ReadPrec LabelSummary
$creadPrec :: ReadPrec LabelSummary
readList :: ReadS [LabelSummary]
$creadList :: ReadS [LabelSummary]
readsPrec :: Int -> ReadS LabelSummary
$creadsPrec :: Int -> ReadS LabelSummary
Prelude.Read, Int -> LabelSummary -> ShowS
[LabelSummary] -> ShowS
LabelSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LabelSummary] -> ShowS
$cshowList :: [LabelSummary] -> ShowS
show :: LabelSummary -> String
$cshow :: LabelSummary -> String
showsPrec :: Int -> LabelSummary -> ShowS
$cshowsPrec :: Int -> LabelSummary -> ShowS
Prelude.Show, forall x. Rep LabelSummary x -> LabelSummary
forall x. LabelSummary -> Rep LabelSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LabelSummary x -> LabelSummary
$cfrom :: forall x. LabelSummary -> Rep LabelSummary x
Prelude.Generic)

-- |
-- Create a value of 'LabelSummary' 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:
--
-- 'name', 'labelSummary_name' - An individual label specification.
newLabelSummary ::
  LabelSummary
newLabelSummary :: LabelSummary
newLabelSummary =
  LabelSummary' {$sel:name:LabelSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing}

-- | An individual label specification.
labelSummary_name :: Lens.Lens' LabelSummary (Prelude.Maybe Prelude.Text)
labelSummary_name :: Lens' LabelSummary (Maybe Text)
labelSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelSummary' {Maybe Text
name :: Maybe Text
$sel:name:LabelSummary' :: LabelSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: LabelSummary
s@LabelSummary' {} Maybe Text
a -> LabelSummary
s {$sel:name:LabelSummary' :: Maybe Text
name = Maybe Text
a} :: LabelSummary)

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

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

instance Prelude.NFData LabelSummary where
  rnf :: LabelSummary -> ()
rnf LabelSummary' {Maybe Text
name :: Maybe Text
$sel:name:LabelSummary' :: LabelSummary -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name