{-# 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.WorkMailMessageFlow.PutRawMessageContent
(
PutRawMessageContent (..),
newPutRawMessageContent,
putRawMessageContent_messageId,
putRawMessageContent_content,
PutRawMessageContentResponse (..),
newPutRawMessageContentResponse,
putRawMessageContentResponse_httpStatus,
)
where
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
import Amazonka.WorkMailMessageFlow.Types
data PutRawMessageContent = PutRawMessageContent'
{
PutRawMessageContent -> Text
messageId :: Prelude.Text,
PutRawMessageContent -> RawMessageContent
content :: RawMessageContent
}
deriving (PutRawMessageContent -> PutRawMessageContent -> Bool
(PutRawMessageContent -> PutRawMessageContent -> Bool)
-> (PutRawMessageContent -> PutRawMessageContent -> Bool)
-> Eq PutRawMessageContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRawMessageContent -> PutRawMessageContent -> Bool
$c/= :: PutRawMessageContent -> PutRawMessageContent -> Bool
== :: PutRawMessageContent -> PutRawMessageContent -> Bool
$c== :: PutRawMessageContent -> PutRawMessageContent -> Bool
Prelude.Eq, ReadPrec [PutRawMessageContent]
ReadPrec PutRawMessageContent
Int -> ReadS PutRawMessageContent
ReadS [PutRawMessageContent]
(Int -> ReadS PutRawMessageContent)
-> ReadS [PutRawMessageContent]
-> ReadPrec PutRawMessageContent
-> ReadPrec [PutRawMessageContent]
-> Read PutRawMessageContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRawMessageContent]
$creadListPrec :: ReadPrec [PutRawMessageContent]
readPrec :: ReadPrec PutRawMessageContent
$creadPrec :: ReadPrec PutRawMessageContent
readList :: ReadS [PutRawMessageContent]
$creadList :: ReadS [PutRawMessageContent]
readsPrec :: Int -> ReadS PutRawMessageContent
$creadsPrec :: Int -> ReadS PutRawMessageContent
Prelude.Read, Int -> PutRawMessageContent -> ShowS
[PutRawMessageContent] -> ShowS
PutRawMessageContent -> String
(Int -> PutRawMessageContent -> ShowS)
-> (PutRawMessageContent -> String)
-> ([PutRawMessageContent] -> ShowS)
-> Show PutRawMessageContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRawMessageContent] -> ShowS
$cshowList :: [PutRawMessageContent] -> ShowS
show :: PutRawMessageContent -> String
$cshow :: PutRawMessageContent -> String
showsPrec :: Int -> PutRawMessageContent -> ShowS
$cshowsPrec :: Int -> PutRawMessageContent -> ShowS
Prelude.Show, (forall x. PutRawMessageContent -> Rep PutRawMessageContent x)
-> (forall x. Rep PutRawMessageContent x -> PutRawMessageContent)
-> Generic PutRawMessageContent
forall x. Rep PutRawMessageContent x -> PutRawMessageContent
forall x. PutRawMessageContent -> Rep PutRawMessageContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutRawMessageContent x -> PutRawMessageContent
$cfrom :: forall x. PutRawMessageContent -> Rep PutRawMessageContent x
Prelude.Generic)
newPutRawMessageContent ::
Prelude.Text ->
RawMessageContent ->
PutRawMessageContent
newPutRawMessageContent :: Text -> RawMessageContent -> PutRawMessageContent
newPutRawMessageContent Text
pMessageId_ RawMessageContent
pContent_ =
PutRawMessageContent' :: Text -> RawMessageContent -> PutRawMessageContent
PutRawMessageContent'
{ $sel:messageId:PutRawMessageContent' :: Text
messageId = Text
pMessageId_,
$sel:content:PutRawMessageContent' :: RawMessageContent
content = RawMessageContent
pContent_
}
putRawMessageContent_messageId :: Lens.Lens' PutRawMessageContent Prelude.Text
putRawMessageContent_messageId :: (Text -> f Text) -> PutRawMessageContent -> f PutRawMessageContent
putRawMessageContent_messageId = (PutRawMessageContent -> Text)
-> (PutRawMessageContent -> Text -> PutRawMessageContent)
-> Lens PutRawMessageContent PutRawMessageContent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRawMessageContent' {Text
messageId :: Text
$sel:messageId:PutRawMessageContent' :: PutRawMessageContent -> Text
messageId} -> Text
messageId) (\s :: PutRawMessageContent
s@PutRawMessageContent' {} Text
a -> PutRawMessageContent
s {$sel:messageId:PutRawMessageContent' :: Text
messageId = Text
a} :: PutRawMessageContent)
putRawMessageContent_content :: Lens.Lens' PutRawMessageContent RawMessageContent
putRawMessageContent_content :: (RawMessageContent -> f RawMessageContent)
-> PutRawMessageContent -> f PutRawMessageContent
putRawMessageContent_content = (PutRawMessageContent -> RawMessageContent)
-> (PutRawMessageContent
-> RawMessageContent -> PutRawMessageContent)
-> Lens
PutRawMessageContent
PutRawMessageContent
RawMessageContent
RawMessageContent
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRawMessageContent' {RawMessageContent
content :: RawMessageContent
$sel:content:PutRawMessageContent' :: PutRawMessageContent -> RawMessageContent
content} -> RawMessageContent
content) (\s :: PutRawMessageContent
s@PutRawMessageContent' {} RawMessageContent
a -> PutRawMessageContent
s {$sel:content:PutRawMessageContent' :: RawMessageContent
content = RawMessageContent
a} :: PutRawMessageContent)
instance Core.AWSRequest PutRawMessageContent where
type
AWSResponse PutRawMessageContent =
PutRawMessageContentResponse
request :: PutRawMessageContent -> Request PutRawMessageContent
request = Service -> PutRawMessageContent -> Request PutRawMessageContent
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutRawMessageContent
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutRawMessageContent)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutRawMessageContent))
-> Logger
-> Service
-> Proxy PutRawMessageContent
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutRawMessageContent)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutRawMessageContentResponse
PutRawMessageContentResponse'
(Int -> PutRawMessageContentResponse)
-> Either String Int -> Either String PutRawMessageContentResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutRawMessageContent
instance Prelude.NFData PutRawMessageContent
instance Core.ToHeaders PutRawMessageContent where
toHeaders :: PutRawMessageContent -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutRawMessageContent -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutRawMessageContent where
toJSON :: PutRawMessageContent -> Value
toJSON PutRawMessageContent' {Text
RawMessageContent
content :: RawMessageContent
messageId :: Text
$sel:content:PutRawMessageContent' :: PutRawMessageContent -> RawMessageContent
$sel:messageId:PutRawMessageContent' :: PutRawMessageContent -> 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
"content" Text -> RawMessageContent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RawMessageContent
content)]
)
instance Core.ToPath PutRawMessageContent where
toPath :: PutRawMessageContent -> ByteString
toPath PutRawMessageContent' {Text
RawMessageContent
content :: RawMessageContent
messageId :: Text
$sel:content:PutRawMessageContent' :: PutRawMessageContent -> RawMessageContent
$sel:messageId:PutRawMessageContent' :: PutRawMessageContent -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/messages/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
messageId]
instance Core.ToQuery PutRawMessageContent where
toQuery :: PutRawMessageContent -> QueryString
toQuery = QueryString -> PutRawMessageContent -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutRawMessageContentResponse = PutRawMessageContentResponse'
{
PutRawMessageContentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutRawMessageContentResponse
-> PutRawMessageContentResponse -> Bool
(PutRawMessageContentResponse
-> PutRawMessageContentResponse -> Bool)
-> (PutRawMessageContentResponse
-> PutRawMessageContentResponse -> Bool)
-> Eq PutRawMessageContentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRawMessageContentResponse
-> PutRawMessageContentResponse -> Bool
$c/= :: PutRawMessageContentResponse
-> PutRawMessageContentResponse -> Bool
== :: PutRawMessageContentResponse
-> PutRawMessageContentResponse -> Bool
$c== :: PutRawMessageContentResponse
-> PutRawMessageContentResponse -> Bool
Prelude.Eq, ReadPrec [PutRawMessageContentResponse]
ReadPrec PutRawMessageContentResponse
Int -> ReadS PutRawMessageContentResponse
ReadS [PutRawMessageContentResponse]
(Int -> ReadS PutRawMessageContentResponse)
-> ReadS [PutRawMessageContentResponse]
-> ReadPrec PutRawMessageContentResponse
-> ReadPrec [PutRawMessageContentResponse]
-> Read PutRawMessageContentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRawMessageContentResponse]
$creadListPrec :: ReadPrec [PutRawMessageContentResponse]
readPrec :: ReadPrec PutRawMessageContentResponse
$creadPrec :: ReadPrec PutRawMessageContentResponse
readList :: ReadS [PutRawMessageContentResponse]
$creadList :: ReadS [PutRawMessageContentResponse]
readsPrec :: Int -> ReadS PutRawMessageContentResponse
$creadsPrec :: Int -> ReadS PutRawMessageContentResponse
Prelude.Read, Int -> PutRawMessageContentResponse -> ShowS
[PutRawMessageContentResponse] -> ShowS
PutRawMessageContentResponse -> String
(Int -> PutRawMessageContentResponse -> ShowS)
-> (PutRawMessageContentResponse -> String)
-> ([PutRawMessageContentResponse] -> ShowS)
-> Show PutRawMessageContentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRawMessageContentResponse] -> ShowS
$cshowList :: [PutRawMessageContentResponse] -> ShowS
show :: PutRawMessageContentResponse -> String
$cshow :: PutRawMessageContentResponse -> String
showsPrec :: Int -> PutRawMessageContentResponse -> ShowS
$cshowsPrec :: Int -> PutRawMessageContentResponse -> ShowS
Prelude.Show, (forall x.
PutRawMessageContentResponse -> Rep PutRawMessageContentResponse x)
-> (forall x.
Rep PutRawMessageContentResponse x -> PutRawMessageContentResponse)
-> Generic PutRawMessageContentResponse
forall x.
Rep PutRawMessageContentResponse x -> PutRawMessageContentResponse
forall x.
PutRawMessageContentResponse -> Rep PutRawMessageContentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutRawMessageContentResponse x -> PutRawMessageContentResponse
$cfrom :: forall x.
PutRawMessageContentResponse -> Rep PutRawMessageContentResponse x
Prelude.Generic)
newPutRawMessageContentResponse ::
Prelude.Int ->
PutRawMessageContentResponse
newPutRawMessageContentResponse :: Int -> PutRawMessageContentResponse
newPutRawMessageContentResponse Int
pHttpStatus_ =
PutRawMessageContentResponse' :: Int -> PutRawMessageContentResponse
PutRawMessageContentResponse'
{ $sel:httpStatus:PutRawMessageContentResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putRawMessageContentResponse_httpStatus :: Lens.Lens' PutRawMessageContentResponse Prelude.Int
putRawMessageContentResponse_httpStatus :: (Int -> f Int)
-> PutRawMessageContentResponse -> f PutRawMessageContentResponse
putRawMessageContentResponse_httpStatus = (PutRawMessageContentResponse -> Int)
-> (PutRawMessageContentResponse
-> Int -> PutRawMessageContentResponse)
-> Lens
PutRawMessageContentResponse PutRawMessageContentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRawMessageContentResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutRawMessageContentResponse' :: PutRawMessageContentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutRawMessageContentResponse
s@PutRawMessageContentResponse' {} Int
a -> PutRawMessageContentResponse
s {$sel:httpStatus:PutRawMessageContentResponse' :: Int
httpStatus = Int
a} :: PutRawMessageContentResponse)
instance Prelude.NFData PutRawMessageContentResponse