{-# 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.CognitoIdentityProvider.Types.ContextDataType where
import Amazonka.CognitoIdentityProvider.Types.HttpHeader
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ContextDataType = ContextDataType'
{
ContextDataType -> Maybe Text
encodedData :: Prelude.Maybe Prelude.Text,
ContextDataType -> Text
ipAddress :: Prelude.Text,
ContextDataType -> Text
serverName :: Prelude.Text,
ContextDataType -> Text
serverPath :: Prelude.Text,
:: [HttpHeader]
}
deriving (ContextDataType -> ContextDataType -> Bool
(ContextDataType -> ContextDataType -> Bool)
-> (ContextDataType -> ContextDataType -> Bool)
-> Eq ContextDataType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContextDataType -> ContextDataType -> Bool
$c/= :: ContextDataType -> ContextDataType -> Bool
== :: ContextDataType -> ContextDataType -> Bool
$c== :: ContextDataType -> ContextDataType -> Bool
Prelude.Eq, ReadPrec [ContextDataType]
ReadPrec ContextDataType
Int -> ReadS ContextDataType
ReadS [ContextDataType]
(Int -> ReadS ContextDataType)
-> ReadS [ContextDataType]
-> ReadPrec ContextDataType
-> ReadPrec [ContextDataType]
-> Read ContextDataType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContextDataType]
$creadListPrec :: ReadPrec [ContextDataType]
readPrec :: ReadPrec ContextDataType
$creadPrec :: ReadPrec ContextDataType
readList :: ReadS [ContextDataType]
$creadList :: ReadS [ContextDataType]
readsPrec :: Int -> ReadS ContextDataType
$creadsPrec :: Int -> ReadS ContextDataType
Prelude.Read, Int -> ContextDataType -> ShowS
[ContextDataType] -> ShowS
ContextDataType -> String
(Int -> ContextDataType -> ShowS)
-> (ContextDataType -> String)
-> ([ContextDataType] -> ShowS)
-> Show ContextDataType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContextDataType] -> ShowS
$cshowList :: [ContextDataType] -> ShowS
show :: ContextDataType -> String
$cshow :: ContextDataType -> String
showsPrec :: Int -> ContextDataType -> ShowS
$cshowsPrec :: Int -> ContextDataType -> ShowS
Prelude.Show, (forall x. ContextDataType -> Rep ContextDataType x)
-> (forall x. Rep ContextDataType x -> ContextDataType)
-> Generic ContextDataType
forall x. Rep ContextDataType x -> ContextDataType
forall x. ContextDataType -> Rep ContextDataType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContextDataType x -> ContextDataType
$cfrom :: forall x. ContextDataType -> Rep ContextDataType x
Prelude.Generic)
newContextDataType ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ContextDataType
newContextDataType :: Text -> Text -> Text -> ContextDataType
newContextDataType
Text
pIpAddress_
Text
pServerName_
Text
pServerPath_ =
ContextDataType' :: Maybe Text
-> Text -> Text -> Text -> [HttpHeader] -> ContextDataType
ContextDataType'
{ $sel:encodedData:ContextDataType' :: Maybe Text
encodedData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ipAddress:ContextDataType' :: Text
ipAddress = Text
pIpAddress_,
$sel:serverName:ContextDataType' :: Text
serverName = Text
pServerName_,
$sel:serverPath:ContextDataType' :: Text
serverPath = Text
pServerPath_,
$sel:httpHeaders:ContextDataType' :: [HttpHeader]
httpHeaders = [HttpHeader]
forall a. Monoid a => a
Prelude.mempty
}
contextDataType_encodedData :: Lens.Lens' ContextDataType (Prelude.Maybe Prelude.Text)
contextDataType_encodedData :: (Maybe Text -> f (Maybe Text))
-> ContextDataType -> f ContextDataType
contextDataType_encodedData = (ContextDataType -> Maybe Text)
-> (ContextDataType -> Maybe Text -> ContextDataType)
-> Lens ContextDataType ContextDataType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextDataType' {Maybe Text
encodedData :: Maybe Text
$sel:encodedData:ContextDataType' :: ContextDataType -> Maybe Text
encodedData} -> Maybe Text
encodedData) (\s :: ContextDataType
s@ContextDataType' {} Maybe Text
a -> ContextDataType
s {$sel:encodedData:ContextDataType' :: Maybe Text
encodedData = Maybe Text
a} :: ContextDataType)
contextDataType_ipAddress :: Lens.Lens' ContextDataType Prelude.Text
contextDataType_ipAddress :: (Text -> f Text) -> ContextDataType -> f ContextDataType
contextDataType_ipAddress = (ContextDataType -> Text)
-> (ContextDataType -> Text -> ContextDataType)
-> Lens ContextDataType ContextDataType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextDataType' {Text
ipAddress :: Text
$sel:ipAddress:ContextDataType' :: ContextDataType -> Text
ipAddress} -> Text
ipAddress) (\s :: ContextDataType
s@ContextDataType' {} Text
a -> ContextDataType
s {$sel:ipAddress:ContextDataType' :: Text
ipAddress = Text
a} :: ContextDataType)
contextDataType_serverName :: Lens.Lens' ContextDataType Prelude.Text
contextDataType_serverName :: (Text -> f Text) -> ContextDataType -> f ContextDataType
contextDataType_serverName = (ContextDataType -> Text)
-> (ContextDataType -> Text -> ContextDataType)
-> Lens ContextDataType ContextDataType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextDataType' {Text
serverName :: Text
$sel:serverName:ContextDataType' :: ContextDataType -> Text
serverName} -> Text
serverName) (\s :: ContextDataType
s@ContextDataType' {} Text
a -> ContextDataType
s {$sel:serverName:ContextDataType' :: Text
serverName = Text
a} :: ContextDataType)
contextDataType_serverPath :: Lens.Lens' ContextDataType Prelude.Text
contextDataType_serverPath :: (Text -> f Text) -> ContextDataType -> f ContextDataType
contextDataType_serverPath = (ContextDataType -> Text)
-> (ContextDataType -> Text -> ContextDataType)
-> Lens ContextDataType ContextDataType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextDataType' {Text
serverPath :: Text
$sel:serverPath:ContextDataType' :: ContextDataType -> Text
serverPath} -> Text
serverPath) (\s :: ContextDataType
s@ContextDataType' {} Text
a -> ContextDataType
s {$sel:serverPath:ContextDataType' :: Text
serverPath = Text
a} :: ContextDataType)
contextDataType_httpHeaders :: Lens.Lens' ContextDataType [HttpHeader]
= (ContextDataType -> [HttpHeader])
-> (ContextDataType -> [HttpHeader] -> ContextDataType)
-> Lens ContextDataType ContextDataType [HttpHeader] [HttpHeader]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextDataType' {[HttpHeader]
httpHeaders :: [HttpHeader]
$sel:httpHeaders:ContextDataType' :: ContextDataType -> [HttpHeader]
httpHeaders} -> [HttpHeader]
httpHeaders) (\s :: ContextDataType
s@ContextDataType' {} [HttpHeader]
a -> ContextDataType
s {$sel:httpHeaders:ContextDataType' :: [HttpHeader]
httpHeaders = [HttpHeader]
a} :: ContextDataType) (([HttpHeader] -> f [HttpHeader])
-> ContextDataType -> f ContextDataType)
-> (([HttpHeader] -> f [HttpHeader])
-> [HttpHeader] -> f [HttpHeader])
-> ([HttpHeader] -> f [HttpHeader])
-> ContextDataType
-> f ContextDataType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([HttpHeader] -> f [HttpHeader]) -> [HttpHeader] -> f [HttpHeader]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable ContextDataType
instance Prelude.NFData ContextDataType
instance Core.ToJSON ContextDataType where
toJSON :: ContextDataType -> Value
toJSON ContextDataType' {[HttpHeader]
Maybe Text
Text
httpHeaders :: [HttpHeader]
serverPath :: Text
serverName :: Text
ipAddress :: Text
encodedData :: Maybe Text
$sel:httpHeaders:ContextDataType' :: ContextDataType -> [HttpHeader]
$sel:serverPath:ContextDataType' :: ContextDataType -> Text
$sel:serverName:ContextDataType' :: ContextDataType -> Text
$sel:ipAddress:ContextDataType' :: ContextDataType -> Text
$sel:encodedData:ContextDataType' :: ContextDataType -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EncodedData" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
encodedData,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IpAddress" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ipAddress),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServerPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverPath),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HttpHeaders" Text -> [HttpHeader] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [HttpHeader]
httpHeaders)
]
)