{-# 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.APIGatewayManagementAPI.Types.Identity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Identity = Identity'
{
Identity -> Text
sourceIp :: Prelude.Text,
Identity -> Text
userAgent :: Prelude.Text
}
deriving (Identity -> Identity -> Bool
(Identity -> Identity -> Bool)
-> (Identity -> Identity -> Bool) -> Eq Identity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Identity -> Identity -> Bool
$c/= :: Identity -> Identity -> Bool
== :: Identity -> Identity -> Bool
$c== :: Identity -> Identity -> Bool
Prelude.Eq, ReadPrec [Identity]
ReadPrec Identity
Int -> ReadS Identity
ReadS [Identity]
(Int -> ReadS Identity)
-> ReadS [Identity]
-> ReadPrec Identity
-> ReadPrec [Identity]
-> Read Identity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Identity]
$creadListPrec :: ReadPrec [Identity]
readPrec :: ReadPrec Identity
$creadPrec :: ReadPrec Identity
readList :: ReadS [Identity]
$creadList :: ReadS [Identity]
readsPrec :: Int -> ReadS Identity
$creadsPrec :: Int -> ReadS Identity
Prelude.Read, Int -> Identity -> ShowS
[Identity] -> ShowS
Identity -> String
(Int -> Identity -> ShowS)
-> (Identity -> String) -> ([Identity] -> ShowS) -> Show Identity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Identity] -> ShowS
$cshowList :: [Identity] -> ShowS
show :: Identity -> String
$cshow :: Identity -> String
showsPrec :: Int -> Identity -> ShowS
$cshowsPrec :: Int -> Identity -> ShowS
Prelude.Show, (forall x. Identity -> Rep Identity x)
-> (forall x. Rep Identity x -> Identity) -> Generic Identity
forall x. Rep Identity x -> Identity
forall x. Identity -> Rep Identity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Identity x -> Identity
$cfrom :: forall x. Identity -> Rep Identity x
Prelude.Generic)
newIdentity ::
Prelude.Text ->
Prelude.Text ->
Identity
newIdentity :: Text -> Text -> Identity
newIdentity Text
pSourceIp_ Text
pUserAgent_ =
Identity' :: Text -> Text -> Identity
Identity'
{ $sel:sourceIp:Identity' :: Text
sourceIp = Text
pSourceIp_,
$sel:userAgent:Identity' :: Text
userAgent = Text
pUserAgent_
}
identity_sourceIp :: Lens.Lens' Identity Prelude.Text
identity_sourceIp :: (Text -> f Text) -> Identity -> f Identity
identity_sourceIp = (Identity -> Text)
-> (Identity -> Text -> Identity)
-> Lens Identity Identity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Identity' {Text
sourceIp :: Text
$sel:sourceIp:Identity' :: Identity -> Text
sourceIp} -> Text
sourceIp) (\s :: Identity
s@Identity' {} Text
a -> Identity
s {$sel:sourceIp:Identity' :: Text
sourceIp = Text
a} :: Identity)
identity_userAgent :: Lens.Lens' Identity Prelude.Text
identity_userAgent :: (Text -> f Text) -> Identity -> f Identity
identity_userAgent = (Identity -> Text)
-> (Identity -> Text -> Identity)
-> Lens Identity Identity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Identity' {Text
userAgent :: Text
$sel:userAgent:Identity' :: Identity -> Text
userAgent} -> Text
userAgent) (\s :: Identity
s@Identity' {} Text
a -> Identity
s {$sel:userAgent:Identity' :: Text
userAgent = Text
a} :: Identity)
instance Core.FromJSON Identity where
parseJSON :: Value -> Parser Identity
parseJSON =
String -> (Object -> Parser Identity) -> Value -> Parser Identity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Identity"
( \Object
x ->
Text -> Text -> Identity
Identity'
(Text -> Text -> Identity)
-> Parser Text -> Parser (Text -> Identity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"sourceIp")
Parser (Text -> Identity) -> Parser Text -> Parser Identity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"userAgent")
)
instance Prelude.Hashable Identity
instance Prelude.NFData Identity