{-# 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 #-}
module Amazonka.WAFV2.Types.UsernameField 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
data UsernameField = UsernameField'
{
UsernameField -> Text
identifier :: Prelude.Text
}
deriving (UsernameField -> UsernameField -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsernameField -> UsernameField -> Bool
$c/= :: UsernameField -> UsernameField -> Bool
== :: UsernameField -> UsernameField -> Bool
$c== :: UsernameField -> UsernameField -> Bool
Prelude.Eq, ReadPrec [UsernameField]
ReadPrec UsernameField
Int -> ReadS UsernameField
ReadS [UsernameField]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsernameField]
$creadListPrec :: ReadPrec [UsernameField]
readPrec :: ReadPrec UsernameField
$creadPrec :: ReadPrec UsernameField
readList :: ReadS [UsernameField]
$creadList :: ReadS [UsernameField]
readsPrec :: Int -> ReadS UsernameField
$creadsPrec :: Int -> ReadS UsernameField
Prelude.Read, Int -> UsernameField -> ShowS
[UsernameField] -> ShowS
UsernameField -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsernameField] -> ShowS
$cshowList :: [UsernameField] -> ShowS
show :: UsernameField -> String
$cshow :: UsernameField -> String
showsPrec :: Int -> UsernameField -> ShowS
$cshowsPrec :: Int -> UsernameField -> ShowS
Prelude.Show, forall x. Rep UsernameField x -> UsernameField
forall x. UsernameField -> Rep UsernameField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsernameField x -> UsernameField
$cfrom :: forall x. UsernameField -> Rep UsernameField x
Prelude.Generic)
newUsernameField ::
Prelude.Text ->
UsernameField
newUsernameField :: Text -> UsernameField
newUsernameField Text
pIdentifier_ =
UsernameField' {$sel:identifier:UsernameField' :: Text
identifier = Text
pIdentifier_}
usernameField_identifier :: Lens.Lens' UsernameField Prelude.Text
usernameField_identifier :: Lens' UsernameField Text
usernameField_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsernameField' {Text
identifier :: Text
$sel:identifier:UsernameField' :: UsernameField -> Text
identifier} -> Text
identifier) (\s :: UsernameField
s@UsernameField' {} Text
a -> UsernameField
s {$sel:identifier:UsernameField' :: Text
identifier = Text
a} :: UsernameField)
instance Data.FromJSON UsernameField where
parseJSON :: Value -> Parser UsernameField
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"UsernameField"
( \Object
x ->
Text -> UsernameField
UsernameField' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Identifier")
)
instance Prelude.Hashable UsernameField where
hashWithSalt :: Int -> UsernameField -> Int
hashWithSalt Int
_salt UsernameField' {Text
identifier :: Text
$sel:identifier:UsernameField' :: UsernameField -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identifier
instance Prelude.NFData UsernameField where
rnf :: UsernameField -> ()
rnf UsernameField' {Text
identifier :: Text
$sel:identifier:UsernameField' :: UsernameField -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
identifier
instance Data.ToJSON UsernameField where
toJSON :: UsernameField -> Value
toJSON UsernameField' {Text
identifier :: Text
$sel:identifier:UsernameField' :: UsernameField -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Identifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
identifier)]
)