{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CognitoSync.SetCognitoEvents
(
SetCognitoEvents (..),
newSetCognitoEvents,
setCognitoEvents_identityPoolId,
setCognitoEvents_events,
SetCognitoEventsResponse (..),
newSetCognitoEventsResponse,
)
where
import Amazonka.CognitoSync.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data SetCognitoEvents = SetCognitoEvents'
{
SetCognitoEvents -> Text
identityPoolId :: Prelude.Text,
SetCognitoEvents -> HashMap Text Text
events :: Prelude.HashMap Prelude.Text Prelude.Text
}
deriving (SetCognitoEvents -> SetCognitoEvents -> Bool
(SetCognitoEvents -> SetCognitoEvents -> Bool)
-> (SetCognitoEvents -> SetCognitoEvents -> Bool)
-> Eq SetCognitoEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetCognitoEvents -> SetCognitoEvents -> Bool
$c/= :: SetCognitoEvents -> SetCognitoEvents -> Bool
== :: SetCognitoEvents -> SetCognitoEvents -> Bool
$c== :: SetCognitoEvents -> SetCognitoEvents -> Bool
Prelude.Eq, ReadPrec [SetCognitoEvents]
ReadPrec SetCognitoEvents
Int -> ReadS SetCognitoEvents
ReadS [SetCognitoEvents]
(Int -> ReadS SetCognitoEvents)
-> ReadS [SetCognitoEvents]
-> ReadPrec SetCognitoEvents
-> ReadPrec [SetCognitoEvents]
-> Read SetCognitoEvents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetCognitoEvents]
$creadListPrec :: ReadPrec [SetCognitoEvents]
readPrec :: ReadPrec SetCognitoEvents
$creadPrec :: ReadPrec SetCognitoEvents
readList :: ReadS [SetCognitoEvents]
$creadList :: ReadS [SetCognitoEvents]
readsPrec :: Int -> ReadS SetCognitoEvents
$creadsPrec :: Int -> ReadS SetCognitoEvents
Prelude.Read, Int -> SetCognitoEvents -> ShowS
[SetCognitoEvents] -> ShowS
SetCognitoEvents -> String
(Int -> SetCognitoEvents -> ShowS)
-> (SetCognitoEvents -> String)
-> ([SetCognitoEvents] -> ShowS)
-> Show SetCognitoEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetCognitoEvents] -> ShowS
$cshowList :: [SetCognitoEvents] -> ShowS
show :: SetCognitoEvents -> String
$cshow :: SetCognitoEvents -> String
showsPrec :: Int -> SetCognitoEvents -> ShowS
$cshowsPrec :: Int -> SetCognitoEvents -> ShowS
Prelude.Show, (forall x. SetCognitoEvents -> Rep SetCognitoEvents x)
-> (forall x. Rep SetCognitoEvents x -> SetCognitoEvents)
-> Generic SetCognitoEvents
forall x. Rep SetCognitoEvents x -> SetCognitoEvents
forall x. SetCognitoEvents -> Rep SetCognitoEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetCognitoEvents x -> SetCognitoEvents
$cfrom :: forall x. SetCognitoEvents -> Rep SetCognitoEvents x
Prelude.Generic)
newSetCognitoEvents ::
Prelude.Text ->
SetCognitoEvents
newSetCognitoEvents :: Text -> SetCognitoEvents
newSetCognitoEvents Text
pIdentityPoolId_ =
SetCognitoEvents' :: Text -> HashMap Text Text -> SetCognitoEvents
SetCognitoEvents'
{ $sel:identityPoolId:SetCognitoEvents' :: Text
identityPoolId =
Text
pIdentityPoolId_,
$sel:events:SetCognitoEvents' :: HashMap Text Text
events = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
}
setCognitoEvents_identityPoolId :: Lens.Lens' SetCognitoEvents Prelude.Text
setCognitoEvents_identityPoolId :: (Text -> f Text) -> SetCognitoEvents -> f SetCognitoEvents
setCognitoEvents_identityPoolId = (SetCognitoEvents -> Text)
-> (SetCognitoEvents -> Text -> SetCognitoEvents)
-> Lens SetCognitoEvents SetCognitoEvents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetCognitoEvents' {Text
identityPoolId :: Text
$sel:identityPoolId:SetCognitoEvents' :: SetCognitoEvents -> Text
identityPoolId} -> Text
identityPoolId) (\s :: SetCognitoEvents
s@SetCognitoEvents' {} Text
a -> SetCognitoEvents
s {$sel:identityPoolId:SetCognitoEvents' :: Text
identityPoolId = Text
a} :: SetCognitoEvents)
setCognitoEvents_events :: Lens.Lens' SetCognitoEvents (Prelude.HashMap Prelude.Text Prelude.Text)
setCognitoEvents_events :: (HashMap Text Text -> f (HashMap Text Text))
-> SetCognitoEvents -> f SetCognitoEvents
setCognitoEvents_events = (SetCognitoEvents -> HashMap Text Text)
-> (SetCognitoEvents -> HashMap Text Text -> SetCognitoEvents)
-> Lens
SetCognitoEvents
SetCognitoEvents
(HashMap Text Text)
(HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetCognitoEvents' {HashMap Text Text
events :: HashMap Text Text
$sel:events:SetCognitoEvents' :: SetCognitoEvents -> HashMap Text Text
events} -> HashMap Text Text
events) (\s :: SetCognitoEvents
s@SetCognitoEvents' {} HashMap Text Text
a -> SetCognitoEvents
s {$sel:events:SetCognitoEvents' :: HashMap Text Text
events = HashMap Text Text
a} :: SetCognitoEvents) ((HashMap Text Text -> f (HashMap Text Text))
-> SetCognitoEvents -> f SetCognitoEvents)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> SetCognitoEvents
-> f SetCognitoEvents
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest SetCognitoEvents where
type
AWSResponse SetCognitoEvents =
SetCognitoEventsResponse
request :: SetCognitoEvents -> Request SetCognitoEvents
request = Service -> SetCognitoEvents -> Request SetCognitoEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SetCognitoEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SetCognitoEvents)))
response =
AWSResponse SetCognitoEvents
-> Logger
-> Service
-> Proxy SetCognitoEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SetCognitoEvents)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse SetCognitoEvents
SetCognitoEventsResponse
SetCognitoEventsResponse'
instance Prelude.Hashable SetCognitoEvents
instance Prelude.NFData SetCognitoEvents
instance Core.ToHeaders SetCognitoEvents where
toHeaders :: SetCognitoEvents -> [Header]
toHeaders =
[Header] -> SetCognitoEvents -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON SetCognitoEvents where
toJSON :: SetCognitoEvents -> Value
toJSON SetCognitoEvents' {Text
HashMap Text Text
events :: HashMap Text Text
identityPoolId :: Text
$sel:events:SetCognitoEvents' :: SetCognitoEvents -> HashMap Text Text
$sel:identityPoolId:SetCognitoEvents' :: SetCognitoEvents -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Events" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Text
events)]
)
instance Core.ToPath SetCognitoEvents where
toPath :: SetCognitoEvents -> ByteString
toPath SetCognitoEvents' {Text
HashMap Text Text
events :: HashMap Text Text
identityPoolId :: Text
$sel:events:SetCognitoEvents' :: SetCognitoEvents -> HashMap Text Text
$sel:identityPoolId:SetCognitoEvents' :: SetCognitoEvents -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/identitypools/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
identityPoolId,
ByteString
"/events"
]
instance Core.ToQuery SetCognitoEvents where
toQuery :: SetCognitoEvents -> QueryString
toQuery = QueryString -> SetCognitoEvents -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SetCognitoEventsResponse = SetCognitoEventsResponse'
{
}
deriving (SetCognitoEventsResponse -> SetCognitoEventsResponse -> Bool
(SetCognitoEventsResponse -> SetCognitoEventsResponse -> Bool)
-> (SetCognitoEventsResponse -> SetCognitoEventsResponse -> Bool)
-> Eq SetCognitoEventsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetCognitoEventsResponse -> SetCognitoEventsResponse -> Bool
$c/= :: SetCognitoEventsResponse -> SetCognitoEventsResponse -> Bool
== :: SetCognitoEventsResponse -> SetCognitoEventsResponse -> Bool
$c== :: SetCognitoEventsResponse -> SetCognitoEventsResponse -> Bool
Prelude.Eq, ReadPrec [SetCognitoEventsResponse]
ReadPrec SetCognitoEventsResponse
Int -> ReadS SetCognitoEventsResponse
ReadS [SetCognitoEventsResponse]
(Int -> ReadS SetCognitoEventsResponse)
-> ReadS [SetCognitoEventsResponse]
-> ReadPrec SetCognitoEventsResponse
-> ReadPrec [SetCognitoEventsResponse]
-> Read SetCognitoEventsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetCognitoEventsResponse]
$creadListPrec :: ReadPrec [SetCognitoEventsResponse]
readPrec :: ReadPrec SetCognitoEventsResponse
$creadPrec :: ReadPrec SetCognitoEventsResponse
readList :: ReadS [SetCognitoEventsResponse]
$creadList :: ReadS [SetCognitoEventsResponse]
readsPrec :: Int -> ReadS SetCognitoEventsResponse
$creadsPrec :: Int -> ReadS SetCognitoEventsResponse
Prelude.Read, Int -> SetCognitoEventsResponse -> ShowS
[SetCognitoEventsResponse] -> ShowS
SetCognitoEventsResponse -> String
(Int -> SetCognitoEventsResponse -> ShowS)
-> (SetCognitoEventsResponse -> String)
-> ([SetCognitoEventsResponse] -> ShowS)
-> Show SetCognitoEventsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetCognitoEventsResponse] -> ShowS
$cshowList :: [SetCognitoEventsResponse] -> ShowS
show :: SetCognitoEventsResponse -> String
$cshow :: SetCognitoEventsResponse -> String
showsPrec :: Int -> SetCognitoEventsResponse -> ShowS
$cshowsPrec :: Int -> SetCognitoEventsResponse -> ShowS
Prelude.Show, (forall x.
SetCognitoEventsResponse -> Rep SetCognitoEventsResponse x)
-> (forall x.
Rep SetCognitoEventsResponse x -> SetCognitoEventsResponse)
-> Generic SetCognitoEventsResponse
forall x.
Rep SetCognitoEventsResponse x -> SetCognitoEventsResponse
forall x.
SetCognitoEventsResponse -> Rep SetCognitoEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetCognitoEventsResponse x -> SetCognitoEventsResponse
$cfrom :: forall x.
SetCognitoEventsResponse -> Rep SetCognitoEventsResponse x
Prelude.Generic)
newSetCognitoEventsResponse ::
SetCognitoEventsResponse
newSetCognitoEventsResponse :: SetCognitoEventsResponse
newSetCognitoEventsResponse =
SetCognitoEventsResponse
SetCognitoEventsResponse'
instance Prelude.NFData SetCognitoEventsResponse