{-# 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.WorkMail.RegisterToWorkMail
(
RegisterToWorkMail (..),
newRegisterToWorkMail,
registerToWorkMail_organizationId,
registerToWorkMail_entityId,
registerToWorkMail_email,
RegisterToWorkMailResponse (..),
newRegisterToWorkMailResponse,
registerToWorkMailResponse_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.WorkMail.Types
data RegisterToWorkMail = RegisterToWorkMail'
{
RegisterToWorkMail -> Text
organizationId :: Prelude.Text,
RegisterToWorkMail -> Text
entityId :: Prelude.Text,
RegisterToWorkMail -> Text
email :: Prelude.Text
}
deriving (RegisterToWorkMail -> RegisterToWorkMail -> Bool
(RegisterToWorkMail -> RegisterToWorkMail -> Bool)
-> (RegisterToWorkMail -> RegisterToWorkMail -> Bool)
-> Eq RegisterToWorkMail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterToWorkMail -> RegisterToWorkMail -> Bool
$c/= :: RegisterToWorkMail -> RegisterToWorkMail -> Bool
== :: RegisterToWorkMail -> RegisterToWorkMail -> Bool
$c== :: RegisterToWorkMail -> RegisterToWorkMail -> Bool
Prelude.Eq, ReadPrec [RegisterToWorkMail]
ReadPrec RegisterToWorkMail
Int -> ReadS RegisterToWorkMail
ReadS [RegisterToWorkMail]
(Int -> ReadS RegisterToWorkMail)
-> ReadS [RegisterToWorkMail]
-> ReadPrec RegisterToWorkMail
-> ReadPrec [RegisterToWorkMail]
-> Read RegisterToWorkMail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterToWorkMail]
$creadListPrec :: ReadPrec [RegisterToWorkMail]
readPrec :: ReadPrec RegisterToWorkMail
$creadPrec :: ReadPrec RegisterToWorkMail
readList :: ReadS [RegisterToWorkMail]
$creadList :: ReadS [RegisterToWorkMail]
readsPrec :: Int -> ReadS RegisterToWorkMail
$creadsPrec :: Int -> ReadS RegisterToWorkMail
Prelude.Read, Int -> RegisterToWorkMail -> ShowS
[RegisterToWorkMail] -> ShowS
RegisterToWorkMail -> String
(Int -> RegisterToWorkMail -> ShowS)
-> (RegisterToWorkMail -> String)
-> ([RegisterToWorkMail] -> ShowS)
-> Show RegisterToWorkMail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterToWorkMail] -> ShowS
$cshowList :: [RegisterToWorkMail] -> ShowS
show :: RegisterToWorkMail -> String
$cshow :: RegisterToWorkMail -> String
showsPrec :: Int -> RegisterToWorkMail -> ShowS
$cshowsPrec :: Int -> RegisterToWorkMail -> ShowS
Prelude.Show, (forall x. RegisterToWorkMail -> Rep RegisterToWorkMail x)
-> (forall x. Rep RegisterToWorkMail x -> RegisterToWorkMail)
-> Generic RegisterToWorkMail
forall x. Rep RegisterToWorkMail x -> RegisterToWorkMail
forall x. RegisterToWorkMail -> Rep RegisterToWorkMail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterToWorkMail x -> RegisterToWorkMail
$cfrom :: forall x. RegisterToWorkMail -> Rep RegisterToWorkMail x
Prelude.Generic)
newRegisterToWorkMail ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
RegisterToWorkMail
newRegisterToWorkMail :: Text -> Text -> Text -> RegisterToWorkMail
newRegisterToWorkMail
Text
pOrganizationId_
Text
pEntityId_
Text
pEmail_ =
RegisterToWorkMail' :: Text -> Text -> Text -> RegisterToWorkMail
RegisterToWorkMail'
{ $sel:organizationId:RegisterToWorkMail' :: Text
organizationId =
Text
pOrganizationId_,
$sel:entityId:RegisterToWorkMail' :: Text
entityId = Text
pEntityId_,
$sel:email:RegisterToWorkMail' :: Text
email = Text
pEmail_
}
registerToWorkMail_organizationId :: Lens.Lens' RegisterToWorkMail Prelude.Text
registerToWorkMail_organizationId :: (Text -> f Text) -> RegisterToWorkMail -> f RegisterToWorkMail
registerToWorkMail_organizationId = (RegisterToWorkMail -> Text)
-> (RegisterToWorkMail -> Text -> RegisterToWorkMail)
-> Lens RegisterToWorkMail RegisterToWorkMail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterToWorkMail' {Text
organizationId :: Text
$sel:organizationId:RegisterToWorkMail' :: RegisterToWorkMail -> Text
organizationId} -> Text
organizationId) (\s :: RegisterToWorkMail
s@RegisterToWorkMail' {} Text
a -> RegisterToWorkMail
s {$sel:organizationId:RegisterToWorkMail' :: Text
organizationId = Text
a} :: RegisterToWorkMail)
registerToWorkMail_entityId :: Lens.Lens' RegisterToWorkMail Prelude.Text
registerToWorkMail_entityId :: (Text -> f Text) -> RegisterToWorkMail -> f RegisterToWorkMail
registerToWorkMail_entityId = (RegisterToWorkMail -> Text)
-> (RegisterToWorkMail -> Text -> RegisterToWorkMail)
-> Lens RegisterToWorkMail RegisterToWorkMail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterToWorkMail' {Text
entityId :: Text
$sel:entityId:RegisterToWorkMail' :: RegisterToWorkMail -> Text
entityId} -> Text
entityId) (\s :: RegisterToWorkMail
s@RegisterToWorkMail' {} Text
a -> RegisterToWorkMail
s {$sel:entityId:RegisterToWorkMail' :: Text
entityId = Text
a} :: RegisterToWorkMail)
registerToWorkMail_email :: Lens.Lens' RegisterToWorkMail Prelude.Text
registerToWorkMail_email :: (Text -> f Text) -> RegisterToWorkMail -> f RegisterToWorkMail
registerToWorkMail_email = (RegisterToWorkMail -> Text)
-> (RegisterToWorkMail -> Text -> RegisterToWorkMail)
-> Lens RegisterToWorkMail RegisterToWorkMail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterToWorkMail' {Text
email :: Text
$sel:email:RegisterToWorkMail' :: RegisterToWorkMail -> Text
email} -> Text
email) (\s :: RegisterToWorkMail
s@RegisterToWorkMail' {} Text
a -> RegisterToWorkMail
s {$sel:email:RegisterToWorkMail' :: Text
email = Text
a} :: RegisterToWorkMail)
instance Core.AWSRequest RegisterToWorkMail where
type
AWSResponse RegisterToWorkMail =
RegisterToWorkMailResponse
request :: RegisterToWorkMail -> Request RegisterToWorkMail
request = Service -> RegisterToWorkMail -> Request RegisterToWorkMail
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterToWorkMail
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterToWorkMail)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RegisterToWorkMail))
-> Logger
-> Service
-> Proxy RegisterToWorkMail
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterToWorkMail)))
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 -> RegisterToWorkMailResponse
RegisterToWorkMailResponse'
(Int -> RegisterToWorkMailResponse)
-> Either String Int -> Either String RegisterToWorkMailResponse
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 RegisterToWorkMail
instance Prelude.NFData RegisterToWorkMail
instance Core.ToHeaders RegisterToWorkMail where
toHeaders :: RegisterToWorkMail -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterToWorkMail -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkMailService.RegisterToWorkMail" ::
Prelude.ByteString
),
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 RegisterToWorkMail where
toJSON :: RegisterToWorkMail -> Value
toJSON RegisterToWorkMail' {Text
email :: Text
entityId :: Text
organizationId :: Text
$sel:email:RegisterToWorkMail' :: RegisterToWorkMail -> Text
$sel:entityId:RegisterToWorkMail' :: RegisterToWorkMail -> Text
$sel:organizationId:RegisterToWorkMail' :: RegisterToWorkMail -> 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
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EntityId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
entityId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Email" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
email)
]
)
instance Core.ToPath RegisterToWorkMail where
toPath :: RegisterToWorkMail -> ByteString
toPath = ByteString -> RegisterToWorkMail -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RegisterToWorkMail where
toQuery :: RegisterToWorkMail -> QueryString
toQuery = QueryString -> RegisterToWorkMail -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterToWorkMailResponse = RegisterToWorkMailResponse'
{
RegisterToWorkMailResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterToWorkMailResponse -> RegisterToWorkMailResponse -> Bool
(RegisterToWorkMailResponse -> RegisterToWorkMailResponse -> Bool)
-> (RegisterToWorkMailResponse
-> RegisterToWorkMailResponse -> Bool)
-> Eq RegisterToWorkMailResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterToWorkMailResponse -> RegisterToWorkMailResponse -> Bool
$c/= :: RegisterToWorkMailResponse -> RegisterToWorkMailResponse -> Bool
== :: RegisterToWorkMailResponse -> RegisterToWorkMailResponse -> Bool
$c== :: RegisterToWorkMailResponse -> RegisterToWorkMailResponse -> Bool
Prelude.Eq, ReadPrec [RegisterToWorkMailResponse]
ReadPrec RegisterToWorkMailResponse
Int -> ReadS RegisterToWorkMailResponse
ReadS [RegisterToWorkMailResponse]
(Int -> ReadS RegisterToWorkMailResponse)
-> ReadS [RegisterToWorkMailResponse]
-> ReadPrec RegisterToWorkMailResponse
-> ReadPrec [RegisterToWorkMailResponse]
-> Read RegisterToWorkMailResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterToWorkMailResponse]
$creadListPrec :: ReadPrec [RegisterToWorkMailResponse]
readPrec :: ReadPrec RegisterToWorkMailResponse
$creadPrec :: ReadPrec RegisterToWorkMailResponse
readList :: ReadS [RegisterToWorkMailResponse]
$creadList :: ReadS [RegisterToWorkMailResponse]
readsPrec :: Int -> ReadS RegisterToWorkMailResponse
$creadsPrec :: Int -> ReadS RegisterToWorkMailResponse
Prelude.Read, Int -> RegisterToWorkMailResponse -> ShowS
[RegisterToWorkMailResponse] -> ShowS
RegisterToWorkMailResponse -> String
(Int -> RegisterToWorkMailResponse -> ShowS)
-> (RegisterToWorkMailResponse -> String)
-> ([RegisterToWorkMailResponse] -> ShowS)
-> Show RegisterToWorkMailResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterToWorkMailResponse] -> ShowS
$cshowList :: [RegisterToWorkMailResponse] -> ShowS
show :: RegisterToWorkMailResponse -> String
$cshow :: RegisterToWorkMailResponse -> String
showsPrec :: Int -> RegisterToWorkMailResponse -> ShowS
$cshowsPrec :: Int -> RegisterToWorkMailResponse -> ShowS
Prelude.Show, (forall x.
RegisterToWorkMailResponse -> Rep RegisterToWorkMailResponse x)
-> (forall x.
Rep RegisterToWorkMailResponse x -> RegisterToWorkMailResponse)
-> Generic RegisterToWorkMailResponse
forall x.
Rep RegisterToWorkMailResponse x -> RegisterToWorkMailResponse
forall x.
RegisterToWorkMailResponse -> Rep RegisterToWorkMailResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterToWorkMailResponse x -> RegisterToWorkMailResponse
$cfrom :: forall x.
RegisterToWorkMailResponse -> Rep RegisterToWorkMailResponse x
Prelude.Generic)
newRegisterToWorkMailResponse ::
Prelude.Int ->
RegisterToWorkMailResponse
newRegisterToWorkMailResponse :: Int -> RegisterToWorkMailResponse
newRegisterToWorkMailResponse Int
pHttpStatus_ =
RegisterToWorkMailResponse' :: Int -> RegisterToWorkMailResponse
RegisterToWorkMailResponse'
{ $sel:httpStatus:RegisterToWorkMailResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
registerToWorkMailResponse_httpStatus :: Lens.Lens' RegisterToWorkMailResponse Prelude.Int
registerToWorkMailResponse_httpStatus :: (Int -> f Int)
-> RegisterToWorkMailResponse -> f RegisterToWorkMailResponse
registerToWorkMailResponse_httpStatus = (RegisterToWorkMailResponse -> Int)
-> (RegisterToWorkMailResponse
-> Int -> RegisterToWorkMailResponse)
-> Lens
RegisterToWorkMailResponse RegisterToWorkMailResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterToWorkMailResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterToWorkMailResponse' :: RegisterToWorkMailResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterToWorkMailResponse
s@RegisterToWorkMailResponse' {} Int
a -> RegisterToWorkMailResponse
s {$sel:httpStatus:RegisterToWorkMailResponse' :: Int
httpStatus = Int
a} :: RegisterToWorkMailResponse)
instance Prelude.NFData RegisterToWorkMailResponse