{-# 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.Pinpoint.Types.MessageRequest where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.AddressConfiguration
import Amazonka.Pinpoint.Types.DirectMessageConfiguration
import Amazonka.Pinpoint.Types.EndpointSendConfiguration
import Amazonka.Pinpoint.Types.TemplateConfiguration
import qualified Amazonka.Prelude as Prelude
data MessageRequest = MessageRequest'
{
MessageRequest -> Maybe Text
traceId :: Prelude.Maybe Prelude.Text,
MessageRequest -> Maybe (HashMap Text Text)
context :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
MessageRequest -> Maybe (HashMap Text AddressConfiguration)
addresses :: Prelude.Maybe (Prelude.HashMap Prelude.Text AddressConfiguration),
MessageRequest -> Maybe TemplateConfiguration
templateConfiguration :: Prelude.Maybe TemplateConfiguration,
MessageRequest -> Maybe (HashMap Text EndpointSendConfiguration)
endpoints :: Prelude.Maybe (Prelude.HashMap Prelude.Text EndpointSendConfiguration),
MessageRequest -> DirectMessageConfiguration
messageConfiguration :: DirectMessageConfiguration
}
deriving (MessageRequest -> MessageRequest -> Bool
(MessageRequest -> MessageRequest -> Bool)
-> (MessageRequest -> MessageRequest -> Bool) -> Eq MessageRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MessageRequest -> MessageRequest -> Bool
$c/= :: MessageRequest -> MessageRequest -> Bool
== :: MessageRequest -> MessageRequest -> Bool
$c== :: MessageRequest -> MessageRequest -> Bool
Prelude.Eq, ReadPrec [MessageRequest]
ReadPrec MessageRequest
Int -> ReadS MessageRequest
ReadS [MessageRequest]
(Int -> ReadS MessageRequest)
-> ReadS [MessageRequest]
-> ReadPrec MessageRequest
-> ReadPrec [MessageRequest]
-> Read MessageRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MessageRequest]
$creadListPrec :: ReadPrec [MessageRequest]
readPrec :: ReadPrec MessageRequest
$creadPrec :: ReadPrec MessageRequest
readList :: ReadS [MessageRequest]
$creadList :: ReadS [MessageRequest]
readsPrec :: Int -> ReadS MessageRequest
$creadsPrec :: Int -> ReadS MessageRequest
Prelude.Read, Int -> MessageRequest -> ShowS
[MessageRequest] -> ShowS
MessageRequest -> String
(Int -> MessageRequest -> ShowS)
-> (MessageRequest -> String)
-> ([MessageRequest] -> ShowS)
-> Show MessageRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MessageRequest] -> ShowS
$cshowList :: [MessageRequest] -> ShowS
show :: MessageRequest -> String
$cshow :: MessageRequest -> String
showsPrec :: Int -> MessageRequest -> ShowS
$cshowsPrec :: Int -> MessageRequest -> ShowS
Prelude.Show, (forall x. MessageRequest -> Rep MessageRequest x)
-> (forall x. Rep MessageRequest x -> MessageRequest)
-> Generic MessageRequest
forall x. Rep MessageRequest x -> MessageRequest
forall x. MessageRequest -> Rep MessageRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MessageRequest x -> MessageRequest
$cfrom :: forall x. MessageRequest -> Rep MessageRequest x
Prelude.Generic)
newMessageRequest ::
DirectMessageConfiguration ->
MessageRequest
newMessageRequest :: DirectMessageConfiguration -> MessageRequest
newMessageRequest DirectMessageConfiguration
pMessageConfiguration_ =
MessageRequest' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text AddressConfiguration)
-> Maybe TemplateConfiguration
-> Maybe (HashMap Text EndpointSendConfiguration)
-> DirectMessageConfiguration
-> MessageRequest
MessageRequest'
{ $sel:traceId:MessageRequest' :: Maybe Text
traceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:context:MessageRequest' :: Maybe (HashMap Text Text)
context = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:addresses:MessageRequest' :: Maybe (HashMap Text AddressConfiguration)
addresses = Maybe (HashMap Text AddressConfiguration)
forall a. Maybe a
Prelude.Nothing,
$sel:templateConfiguration:MessageRequest' :: Maybe TemplateConfiguration
templateConfiguration = Maybe TemplateConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:endpoints:MessageRequest' :: Maybe (HashMap Text EndpointSendConfiguration)
endpoints = Maybe (HashMap Text EndpointSendConfiguration)
forall a. Maybe a
Prelude.Nothing,
$sel:messageConfiguration:MessageRequest' :: DirectMessageConfiguration
messageConfiguration = DirectMessageConfiguration
pMessageConfiguration_
}
messageRequest_traceId :: Lens.Lens' MessageRequest (Prelude.Maybe Prelude.Text)
messageRequest_traceId :: (Maybe Text -> f (Maybe Text))
-> MessageRequest -> f MessageRequest
messageRequest_traceId = (MessageRequest -> Maybe Text)
-> (MessageRequest -> Maybe Text -> MessageRequest)
-> Lens MessageRequest MessageRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe Text
traceId :: Maybe Text
$sel:traceId:MessageRequest' :: MessageRequest -> Maybe Text
traceId} -> Maybe Text
traceId) (\s :: MessageRequest
s@MessageRequest' {} Maybe Text
a -> MessageRequest
s {$sel:traceId:MessageRequest' :: Maybe Text
traceId = Maybe Text
a} :: MessageRequest)
messageRequest_context :: Lens.Lens' MessageRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
messageRequest_context :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MessageRequest -> f MessageRequest
messageRequest_context = (MessageRequest -> Maybe (HashMap Text Text))
-> (MessageRequest -> Maybe (HashMap Text Text) -> MessageRequest)
-> Lens
MessageRequest
MessageRequest
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe (HashMap Text Text)
context :: Maybe (HashMap Text Text)
$sel:context:MessageRequest' :: MessageRequest -> Maybe (HashMap Text Text)
context} -> Maybe (HashMap Text Text)
context) (\s :: MessageRequest
s@MessageRequest' {} Maybe (HashMap Text Text)
a -> MessageRequest
s {$sel:context:MessageRequest' :: Maybe (HashMap Text Text)
context = Maybe (HashMap Text Text)
a} :: MessageRequest) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MessageRequest -> f MessageRequest)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> MessageRequest
-> f MessageRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
messageRequest_addresses :: Lens.Lens' MessageRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text AddressConfiguration))
messageRequest_addresses :: (Maybe (HashMap Text AddressConfiguration)
-> f (Maybe (HashMap Text AddressConfiguration)))
-> MessageRequest -> f MessageRequest
messageRequest_addresses = (MessageRequest -> Maybe (HashMap Text AddressConfiguration))
-> (MessageRequest
-> Maybe (HashMap Text AddressConfiguration) -> MessageRequest)
-> Lens
MessageRequest
MessageRequest
(Maybe (HashMap Text AddressConfiguration))
(Maybe (HashMap Text AddressConfiguration))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe (HashMap Text AddressConfiguration)
addresses :: Maybe (HashMap Text AddressConfiguration)
$sel:addresses:MessageRequest' :: MessageRequest -> Maybe (HashMap Text AddressConfiguration)
addresses} -> Maybe (HashMap Text AddressConfiguration)
addresses) (\s :: MessageRequest
s@MessageRequest' {} Maybe (HashMap Text AddressConfiguration)
a -> MessageRequest
s {$sel:addresses:MessageRequest' :: Maybe (HashMap Text AddressConfiguration)
addresses = Maybe (HashMap Text AddressConfiguration)
a} :: MessageRequest) ((Maybe (HashMap Text AddressConfiguration)
-> f (Maybe (HashMap Text AddressConfiguration)))
-> MessageRequest -> f MessageRequest)
-> ((Maybe (HashMap Text AddressConfiguration)
-> f (Maybe (HashMap Text AddressConfiguration)))
-> Maybe (HashMap Text AddressConfiguration)
-> f (Maybe (HashMap Text AddressConfiguration)))
-> (Maybe (HashMap Text AddressConfiguration)
-> f (Maybe (HashMap Text AddressConfiguration)))
-> MessageRequest
-> f MessageRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text AddressConfiguration)
(HashMap Text AddressConfiguration)
(HashMap Text AddressConfiguration)
(HashMap Text AddressConfiguration)
-> Iso
(Maybe (HashMap Text AddressConfiguration))
(Maybe (HashMap Text AddressConfiguration))
(Maybe (HashMap Text AddressConfiguration))
(Maybe (HashMap Text AddressConfiguration))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text AddressConfiguration)
(HashMap Text AddressConfiguration)
(HashMap Text AddressConfiguration)
(HashMap Text AddressConfiguration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
messageRequest_templateConfiguration :: Lens.Lens' MessageRequest (Prelude.Maybe TemplateConfiguration)
messageRequest_templateConfiguration :: (Maybe TemplateConfiguration -> f (Maybe TemplateConfiguration))
-> MessageRequest -> f MessageRequest
messageRequest_templateConfiguration = (MessageRequest -> Maybe TemplateConfiguration)
-> (MessageRequest
-> Maybe TemplateConfiguration -> MessageRequest)
-> Lens
MessageRequest
MessageRequest
(Maybe TemplateConfiguration)
(Maybe TemplateConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe TemplateConfiguration
templateConfiguration :: Maybe TemplateConfiguration
$sel:templateConfiguration:MessageRequest' :: MessageRequest -> Maybe TemplateConfiguration
templateConfiguration} -> Maybe TemplateConfiguration
templateConfiguration) (\s :: MessageRequest
s@MessageRequest' {} Maybe TemplateConfiguration
a -> MessageRequest
s {$sel:templateConfiguration:MessageRequest' :: Maybe TemplateConfiguration
templateConfiguration = Maybe TemplateConfiguration
a} :: MessageRequest)
messageRequest_endpoints :: Lens.Lens' MessageRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text EndpointSendConfiguration))
messageRequest_endpoints :: (Maybe (HashMap Text EndpointSendConfiguration)
-> f (Maybe (HashMap Text EndpointSendConfiguration)))
-> MessageRequest -> f MessageRequest
messageRequest_endpoints = (MessageRequest -> Maybe (HashMap Text EndpointSendConfiguration))
-> (MessageRequest
-> Maybe (HashMap Text EndpointSendConfiguration)
-> MessageRequest)
-> Lens
MessageRequest
MessageRequest
(Maybe (HashMap Text EndpointSendConfiguration))
(Maybe (HashMap Text EndpointSendConfiguration))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {Maybe (HashMap Text EndpointSendConfiguration)
endpoints :: Maybe (HashMap Text EndpointSendConfiguration)
$sel:endpoints:MessageRequest' :: MessageRequest -> Maybe (HashMap Text EndpointSendConfiguration)
endpoints} -> Maybe (HashMap Text EndpointSendConfiguration)
endpoints) (\s :: MessageRequest
s@MessageRequest' {} Maybe (HashMap Text EndpointSendConfiguration)
a -> MessageRequest
s {$sel:endpoints:MessageRequest' :: Maybe (HashMap Text EndpointSendConfiguration)
endpoints = Maybe (HashMap Text EndpointSendConfiguration)
a} :: MessageRequest) ((Maybe (HashMap Text EndpointSendConfiguration)
-> f (Maybe (HashMap Text EndpointSendConfiguration)))
-> MessageRequest -> f MessageRequest)
-> ((Maybe (HashMap Text EndpointSendConfiguration)
-> f (Maybe (HashMap Text EndpointSendConfiguration)))
-> Maybe (HashMap Text EndpointSendConfiguration)
-> f (Maybe (HashMap Text EndpointSendConfiguration)))
-> (Maybe (HashMap Text EndpointSendConfiguration)
-> f (Maybe (HashMap Text EndpointSendConfiguration)))
-> MessageRequest
-> f MessageRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text EndpointSendConfiguration)
(HashMap Text EndpointSendConfiguration)
(HashMap Text EndpointSendConfiguration)
(HashMap Text EndpointSendConfiguration)
-> Iso
(Maybe (HashMap Text EndpointSendConfiguration))
(Maybe (HashMap Text EndpointSendConfiguration))
(Maybe (HashMap Text EndpointSendConfiguration))
(Maybe (HashMap Text EndpointSendConfiguration))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text EndpointSendConfiguration)
(HashMap Text EndpointSendConfiguration)
(HashMap Text EndpointSendConfiguration)
(HashMap Text EndpointSendConfiguration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
messageRequest_messageConfiguration :: Lens.Lens' MessageRequest DirectMessageConfiguration
messageRequest_messageConfiguration :: (DirectMessageConfiguration -> f DirectMessageConfiguration)
-> MessageRequest -> f MessageRequest
messageRequest_messageConfiguration = (MessageRequest -> DirectMessageConfiguration)
-> (MessageRequest -> DirectMessageConfiguration -> MessageRequest)
-> Lens
MessageRequest
MessageRequest
DirectMessageConfiguration
DirectMessageConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageRequest' {DirectMessageConfiguration
messageConfiguration :: DirectMessageConfiguration
$sel:messageConfiguration:MessageRequest' :: MessageRequest -> DirectMessageConfiguration
messageConfiguration} -> DirectMessageConfiguration
messageConfiguration) (\s :: MessageRequest
s@MessageRequest' {} DirectMessageConfiguration
a -> MessageRequest
s {$sel:messageConfiguration:MessageRequest' :: DirectMessageConfiguration
messageConfiguration = DirectMessageConfiguration
a} :: MessageRequest)
instance Prelude.Hashable MessageRequest
instance Prelude.NFData MessageRequest
instance Core.ToJSON MessageRequest where
toJSON :: MessageRequest -> Value
toJSON MessageRequest' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text AddressConfiguration)
Maybe (HashMap Text EndpointSendConfiguration)
Maybe TemplateConfiguration
DirectMessageConfiguration
messageConfiguration :: DirectMessageConfiguration
endpoints :: Maybe (HashMap Text EndpointSendConfiguration)
templateConfiguration :: Maybe TemplateConfiguration
addresses :: Maybe (HashMap Text AddressConfiguration)
context :: Maybe (HashMap Text Text)
traceId :: Maybe Text
$sel:messageConfiguration:MessageRequest' :: MessageRequest -> DirectMessageConfiguration
$sel:endpoints:MessageRequest' :: MessageRequest -> Maybe (HashMap Text EndpointSendConfiguration)
$sel:templateConfiguration:MessageRequest' :: MessageRequest -> Maybe TemplateConfiguration
$sel:addresses:MessageRequest' :: MessageRequest -> Maybe (HashMap Text AddressConfiguration)
$sel:context:MessageRequest' :: MessageRequest -> Maybe (HashMap Text Text)
$sel:traceId:MessageRequest' :: MessageRequest -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TraceId" 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
traceId,
(Text
"Context" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
context,
(Text
"Addresses" Text -> HashMap Text AddressConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text AddressConfiguration -> Pair)
-> Maybe (HashMap Text AddressConfiguration) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text AddressConfiguration)
addresses,
(Text
"TemplateConfiguration" Text -> TemplateConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(TemplateConfiguration -> Pair)
-> Maybe TemplateConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TemplateConfiguration
templateConfiguration,
(Text
"Endpoints" Text -> HashMap Text EndpointSendConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text EndpointSendConfiguration -> Pair)
-> Maybe (HashMap Text EndpointSendConfiguration) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text EndpointSendConfiguration)
endpoints,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"MessageConfiguration"
Text -> DirectMessageConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DirectMessageConfiguration
messageConfiguration
)
]
)