{-# 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.Lens as Lens
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
(CreateEmailIdentityPolicy -> CreateEmailIdentityPolicy -> Bool)
-> (CreateEmailIdentityPolicy -> CreateEmailIdentityPolicy -> Bool)
-> Eq CreateEmailIdentityPolicy
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]
(Int -> ReadS CreateEmailIdentityPolicy)
-> ReadS [CreateEmailIdentityPolicy]
-> ReadPrec CreateEmailIdentityPolicy
-> ReadPrec [CreateEmailIdentityPolicy]
-> Read 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
(Int -> CreateEmailIdentityPolicy -> ShowS)
-> (CreateEmailIdentityPolicy -> String)
-> ([CreateEmailIdentityPolicy] -> ShowS)
-> Show CreateEmailIdentityPolicy
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.
CreateEmailIdentityPolicy -> Rep CreateEmailIdentityPolicy x)
-> (forall x.
Rep CreateEmailIdentityPolicy x -> CreateEmailIdentityPolicy)
-> Generic CreateEmailIdentityPolicy
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' :: Text -> Text -> Text -> CreateEmailIdentityPolicy
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 :: (Text -> f Text)
-> CreateEmailIdentityPolicy -> f CreateEmailIdentityPolicy
createEmailIdentityPolicy_emailIdentity = (CreateEmailIdentityPolicy -> Text)
-> (CreateEmailIdentityPolicy -> Text -> CreateEmailIdentityPolicy)
-> Lens
CreateEmailIdentityPolicy CreateEmailIdentityPolicy Text Text
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 :: (Text -> f Text)
-> CreateEmailIdentityPolicy -> f CreateEmailIdentityPolicy
createEmailIdentityPolicy_policyName = (CreateEmailIdentityPolicy -> Text)
-> (CreateEmailIdentityPolicy -> Text -> CreateEmailIdentityPolicy)
-> Lens
CreateEmailIdentityPolicy CreateEmailIdentityPolicy Text Text
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 :: (Text -> f Text)
-> CreateEmailIdentityPolicy -> f CreateEmailIdentityPolicy
createEmailIdentityPolicy_policy = (CreateEmailIdentityPolicy -> Text)
-> (CreateEmailIdentityPolicy -> Text -> CreateEmailIdentityPolicy)
-> Lens
CreateEmailIdentityPolicy CreateEmailIdentityPolicy Text Text
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 :: CreateEmailIdentityPolicy -> Request CreateEmailIdentityPolicy
request = Service
-> CreateEmailIdentityPolicy -> Request CreateEmailIdentityPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateEmailIdentityPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateEmailIdentityPolicy)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreateEmailIdentityPolicy))
-> Logger
-> Service
-> Proxy CreateEmailIdentityPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateEmailIdentityPolicy)))
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 -> CreateEmailIdentityPolicyResponse
CreateEmailIdentityPolicyResponse'
(Int -> CreateEmailIdentityPolicyResponse)
-> Either String Int
-> Either String CreateEmailIdentityPolicyResponse
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 CreateEmailIdentityPolicy
instance Prelude.NFData CreateEmailIdentityPolicy
instance Core.ToHeaders CreateEmailIdentityPolicy where
toHeaders :: CreateEmailIdentityPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateEmailIdentityPolicy -> 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 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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Policy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policy)]
)
instance Core.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
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v2/email/identities/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
emailIdentity,
ByteString
"/policies/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
policyName
]
instance Core.ToQuery CreateEmailIdentityPolicy where
toQuery :: CreateEmailIdentityPolicy -> QueryString
toQuery = QueryString -> CreateEmailIdentityPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateEmailIdentityPolicyResponse = CreateEmailIdentityPolicyResponse'
{
CreateEmailIdentityPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateEmailIdentityPolicyResponse
-> CreateEmailIdentityPolicyResponse -> Bool
(CreateEmailIdentityPolicyResponse
-> CreateEmailIdentityPolicyResponse -> Bool)
-> (CreateEmailIdentityPolicyResponse
-> CreateEmailIdentityPolicyResponse -> Bool)
-> Eq CreateEmailIdentityPolicyResponse
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]
(Int -> ReadS CreateEmailIdentityPolicyResponse)
-> ReadS [CreateEmailIdentityPolicyResponse]
-> ReadPrec CreateEmailIdentityPolicyResponse
-> ReadPrec [CreateEmailIdentityPolicyResponse]
-> Read 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
(Int -> CreateEmailIdentityPolicyResponse -> ShowS)
-> (CreateEmailIdentityPolicyResponse -> String)
-> ([CreateEmailIdentityPolicyResponse] -> ShowS)
-> Show CreateEmailIdentityPolicyResponse
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.
CreateEmailIdentityPolicyResponse
-> Rep CreateEmailIdentityPolicyResponse x)
-> (forall x.
Rep CreateEmailIdentityPolicyResponse x
-> CreateEmailIdentityPolicyResponse)
-> Generic CreateEmailIdentityPolicyResponse
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' :: Int -> CreateEmailIdentityPolicyResponse
CreateEmailIdentityPolicyResponse'
{ $sel:httpStatus:CreateEmailIdentityPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createEmailIdentityPolicyResponse_httpStatus :: Lens.Lens' CreateEmailIdentityPolicyResponse Prelude.Int
createEmailIdentityPolicyResponse_httpStatus :: (Int -> f Int)
-> CreateEmailIdentityPolicyResponse
-> f CreateEmailIdentityPolicyResponse
createEmailIdentityPolicyResponse_httpStatus = (CreateEmailIdentityPolicyResponse -> Int)
-> (CreateEmailIdentityPolicyResponse
-> Int -> CreateEmailIdentityPolicyResponse)
-> Lens
CreateEmailIdentityPolicyResponse
CreateEmailIdentityPolicyResponse
Int
Int
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