{-# 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.SESV2.CreateEmailIdentityPolicy
(
CreateEmailIdentityPolicy (..),
newCreateEmailIdentityPolicy,
createEmailIdentityPolicy_emailIdentity,
createEmailIdentityPolicy_policyName,
createEmailIdentityPolicy_policy,
CreateEmailIdentityPolicyResponse (..),
newCreateEmailIdentityPolicyResponse,
createEmailIdentityPolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SESV2.Types
data CreateEmailIdentityPolicy = CreateEmailIdentityPolicy'
{
CreateEmailIdentityPolicy -> Text
emailIdentity :: Prelude.Text,
CreateEmailIdentityPolicy -> Text
policyName :: Prelude.Text,
CreateEmailIdentityPolicy -> Text
policy :: Prelude.Text
}
deriving (CreateEmailIdentityPolicy -> CreateEmailIdentityPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEmailIdentityPolicy -> CreateEmailIdentityPolicy -> Bool
$c/= :: CreateEmailIdentityPolicy -> CreateEmailIdentityPolicy -> Bool
== :: CreateEmailIdentityPolicy -> CreateEmailIdentityPolicy -> Bool
$c== :: CreateEmailIdentityPolicy -> CreateEmailIdentityPolicy -> Bool
Prelude.Eq, ReadPrec [CreateEmailIdentityPolicy]
ReadPrec CreateEmailIdentityPolicy
Int -> ReadS CreateEmailIdentityPolicy
ReadS [CreateEmailIdentityPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEmailIdentityPolicy]
$creadListPrec :: ReadPrec [CreateEmailIdentityPolicy]
readPrec :: ReadPrec CreateEmailIdentityPolicy
$creadPrec :: ReadPrec CreateEmailIdentityPolicy
readList :: ReadS [CreateEmailIdentityPolicy]
$creadList :: ReadS [CreateEmailIdentityPolicy]
readsPrec :: Int -> ReadS CreateEmailIdentityPolicy
$creadsPrec :: Int -> ReadS CreateEmailIdentityPolicy
Prelude.Read, Int -> CreateEmailIdentityPolicy -> ShowS
[CreateEmailIdentityPolicy] -> ShowS
CreateEmailIdentityPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEmailIdentityPolicy] -> ShowS
$cshowList :: [CreateEmailIdentityPolicy] -> ShowS
show :: CreateEmailIdentityPolicy -> String
$cshow :: CreateEmailIdentityPolicy -> String
showsPrec :: Int -> CreateEmailIdentityPolicy -> ShowS
$cshowsPrec :: Int -> CreateEmailIdentityPolicy -> ShowS
Prelude.Show, forall x.
Rep CreateEmailIdentityPolicy x -> CreateEmailIdentityPolicy
forall x.
CreateEmailIdentityPolicy -> Rep CreateEmailIdentityPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEmailIdentityPolicy x -> CreateEmailIdentityPolicy
$cfrom :: forall x.
CreateEmailIdentityPolicy -> Rep CreateEmailIdentityPolicy x
Prelude.Generic)
newCreateEmailIdentityPolicy ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateEmailIdentityPolicy
newCreateEmailIdentityPolicy :: Text -> Text -> Text -> CreateEmailIdentityPolicy
newCreateEmailIdentityPolicy
Text
pEmailIdentity_
Text
pPolicyName_
Text
pPolicy_ =
CreateEmailIdentityPolicy'
{ $sel:emailIdentity:CreateEmailIdentityPolicy' :: Text
emailIdentity =
Text
pEmailIdentity_,
$sel:policyName:CreateEmailIdentityPolicy' :: Text
policyName = Text
pPolicyName_,
$sel:policy:CreateEmailIdentityPolicy' :: Text
policy = Text
pPolicy_
}
createEmailIdentityPolicy_emailIdentity :: Lens.Lens' CreateEmailIdentityPolicy Prelude.Text
createEmailIdentityPolicy_emailIdentity :: Lens' CreateEmailIdentityPolicy Text
createEmailIdentityPolicy_emailIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEmailIdentityPolicy' {Text
emailIdentity :: Text
$sel:emailIdentity:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
emailIdentity} -> Text
emailIdentity) (\s :: CreateEmailIdentityPolicy
s@CreateEmailIdentityPolicy' {} Text
a -> CreateEmailIdentityPolicy
s {$sel:emailIdentity:CreateEmailIdentityPolicy' :: Text
emailIdentity = Text
a} :: CreateEmailIdentityPolicy)
createEmailIdentityPolicy_policyName :: Lens.Lens' CreateEmailIdentityPolicy Prelude.Text
createEmailIdentityPolicy_policyName :: Lens' CreateEmailIdentityPolicy Text
createEmailIdentityPolicy_policyName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEmailIdentityPolicy' {Text
policyName :: Text
$sel:policyName:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
policyName} -> Text
policyName) (\s :: CreateEmailIdentityPolicy
s@CreateEmailIdentityPolicy' {} Text
a -> CreateEmailIdentityPolicy
s {$sel:policyName:CreateEmailIdentityPolicy' :: Text
policyName = Text
a} :: CreateEmailIdentityPolicy)
createEmailIdentityPolicy_policy :: Lens.Lens' CreateEmailIdentityPolicy Prelude.Text
createEmailIdentityPolicy_policy :: Lens' CreateEmailIdentityPolicy Text
createEmailIdentityPolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEmailIdentityPolicy' {Text
policy :: Text
$sel:policy:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
policy} -> Text
policy) (\s :: CreateEmailIdentityPolicy
s@CreateEmailIdentityPolicy' {} Text
a -> CreateEmailIdentityPolicy
s {$sel:policy:CreateEmailIdentityPolicy' :: Text
policy = Text
a} :: CreateEmailIdentityPolicy)
instance Core.AWSRequest CreateEmailIdentityPolicy where
type
AWSResponse CreateEmailIdentityPolicy =
CreateEmailIdentityPolicyResponse
request :: (Service -> Service)
-> CreateEmailIdentityPolicy -> Request CreateEmailIdentityPolicy
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateEmailIdentityPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateEmailIdentityPolicy)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CreateEmailIdentityPolicyResponse
CreateEmailIdentityPolicyResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateEmailIdentityPolicy where
hashWithSalt :: Int -> CreateEmailIdentityPolicy -> Int
hashWithSalt Int
_salt CreateEmailIdentityPolicy' {Text
policy :: Text
policyName :: Text
emailIdentity :: Text
$sel:policy:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
$sel:policyName:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
$sel:emailIdentity:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
emailIdentity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policy
instance Prelude.NFData CreateEmailIdentityPolicy where
rnf :: CreateEmailIdentityPolicy -> ()
rnf CreateEmailIdentityPolicy' {Text
policy :: Text
policyName :: Text
emailIdentity :: Text
$sel:policy:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
$sel:policyName:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
$sel:emailIdentity:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
emailIdentity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policyName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy
instance Data.ToHeaders CreateEmailIdentityPolicy where
toHeaders :: CreateEmailIdentityPolicy -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateEmailIdentityPolicy where
toJSON :: CreateEmailIdentityPolicy -> Value
toJSON CreateEmailIdentityPolicy' {Text
policy :: Text
policyName :: Text
emailIdentity :: Text
$sel:policy:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
$sel:policyName:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
$sel:emailIdentity:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Policy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policy)]
)
instance Data.ToPath CreateEmailIdentityPolicy where
toPath :: CreateEmailIdentityPolicy -> ByteString
toPath CreateEmailIdentityPolicy' {Text
policy :: Text
policyName :: Text
emailIdentity :: Text
$sel:policy:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
$sel:policyName:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
$sel:emailIdentity:CreateEmailIdentityPolicy' :: CreateEmailIdentityPolicy -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v2/email/identities/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
emailIdentity,
ByteString
"/policies/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
policyName
]
instance Data.ToQuery CreateEmailIdentityPolicy where
toQuery :: CreateEmailIdentityPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateEmailIdentityPolicyResponse = CreateEmailIdentityPolicyResponse'
{
CreateEmailIdentityPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateEmailIdentityPolicyResponse
-> CreateEmailIdentityPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEmailIdentityPolicyResponse
-> CreateEmailIdentityPolicyResponse -> Bool
$c/= :: CreateEmailIdentityPolicyResponse
-> CreateEmailIdentityPolicyResponse -> Bool
== :: CreateEmailIdentityPolicyResponse
-> CreateEmailIdentityPolicyResponse -> Bool
$c== :: CreateEmailIdentityPolicyResponse
-> CreateEmailIdentityPolicyResponse -> Bool
Prelude.Eq, ReadPrec [CreateEmailIdentityPolicyResponse]
ReadPrec CreateEmailIdentityPolicyResponse
Int -> ReadS CreateEmailIdentityPolicyResponse
ReadS [CreateEmailIdentityPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEmailIdentityPolicyResponse]
$creadListPrec :: ReadPrec [CreateEmailIdentityPolicyResponse]
readPrec :: ReadPrec CreateEmailIdentityPolicyResponse
$creadPrec :: ReadPrec CreateEmailIdentityPolicyResponse
readList :: ReadS [CreateEmailIdentityPolicyResponse]
$creadList :: ReadS [CreateEmailIdentityPolicyResponse]
readsPrec :: Int -> ReadS CreateEmailIdentityPolicyResponse
$creadsPrec :: Int -> ReadS CreateEmailIdentityPolicyResponse
Prelude.Read, Int -> CreateEmailIdentityPolicyResponse -> ShowS
[CreateEmailIdentityPolicyResponse] -> ShowS
CreateEmailIdentityPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEmailIdentityPolicyResponse] -> ShowS
$cshowList :: [CreateEmailIdentityPolicyResponse] -> ShowS
show :: CreateEmailIdentityPolicyResponse -> String
$cshow :: CreateEmailIdentityPolicyResponse -> String
showsPrec :: Int -> CreateEmailIdentityPolicyResponse -> ShowS
$cshowsPrec :: Int -> CreateEmailIdentityPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep CreateEmailIdentityPolicyResponse x
-> CreateEmailIdentityPolicyResponse
forall x.
CreateEmailIdentityPolicyResponse
-> Rep CreateEmailIdentityPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEmailIdentityPolicyResponse x
-> CreateEmailIdentityPolicyResponse
$cfrom :: forall x.
CreateEmailIdentityPolicyResponse
-> Rep CreateEmailIdentityPolicyResponse x
Prelude.Generic)
newCreateEmailIdentityPolicyResponse ::
Prelude.Int ->
CreateEmailIdentityPolicyResponse
newCreateEmailIdentityPolicyResponse :: Int -> CreateEmailIdentityPolicyResponse
newCreateEmailIdentityPolicyResponse Int
pHttpStatus_ =
CreateEmailIdentityPolicyResponse'
{ $sel:httpStatus:CreateEmailIdentityPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createEmailIdentityPolicyResponse_httpStatus :: Lens.Lens' CreateEmailIdentityPolicyResponse Prelude.Int
createEmailIdentityPolicyResponse_httpStatus :: Lens' CreateEmailIdentityPolicyResponse Int
createEmailIdentityPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEmailIdentityPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateEmailIdentityPolicyResponse' :: CreateEmailIdentityPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateEmailIdentityPolicyResponse
s@CreateEmailIdentityPolicyResponse' {} Int
a -> CreateEmailIdentityPolicyResponse
s {$sel:httpStatus:CreateEmailIdentityPolicyResponse' :: Int
httpStatus = Int
a} :: CreateEmailIdentityPolicyResponse)
instance
Prelude.NFData
CreateEmailIdentityPolicyResponse
where
rnf :: CreateEmailIdentityPolicyResponse -> ()
rnf CreateEmailIdentityPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateEmailIdentityPolicyResponse' :: CreateEmailIdentityPolicyResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus