{-# 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.UpdateEmailIdentityPolicy
(
UpdateEmailIdentityPolicy (..),
newUpdateEmailIdentityPolicy,
updateEmailIdentityPolicy_emailIdentity,
updateEmailIdentityPolicy_policyName,
updateEmailIdentityPolicy_policy,
UpdateEmailIdentityPolicyResponse (..),
newUpdateEmailIdentityPolicyResponse,
updateEmailIdentityPolicyResponse_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 UpdateEmailIdentityPolicy = UpdateEmailIdentityPolicy'
{
UpdateEmailIdentityPolicy -> Text
emailIdentity :: Prelude.Text,
UpdateEmailIdentityPolicy -> Text
policyName :: Prelude.Text,
UpdateEmailIdentityPolicy -> Text
policy :: Prelude.Text
}
deriving (UpdateEmailIdentityPolicy -> UpdateEmailIdentityPolicy -> Bool
(UpdateEmailIdentityPolicy -> UpdateEmailIdentityPolicy -> Bool)
-> (UpdateEmailIdentityPolicy -> UpdateEmailIdentityPolicy -> Bool)
-> Eq UpdateEmailIdentityPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEmailIdentityPolicy -> UpdateEmailIdentityPolicy -> Bool
$c/= :: UpdateEmailIdentityPolicy -> UpdateEmailIdentityPolicy -> Bool
== :: UpdateEmailIdentityPolicy -> UpdateEmailIdentityPolicy -> Bool
$c== :: UpdateEmailIdentityPolicy -> UpdateEmailIdentityPolicy -> Bool
Prelude.Eq, ReadPrec [UpdateEmailIdentityPolicy]
ReadPrec UpdateEmailIdentityPolicy
Int -> ReadS UpdateEmailIdentityPolicy
ReadS [UpdateEmailIdentityPolicy]
(Int -> ReadS UpdateEmailIdentityPolicy)
-> ReadS [UpdateEmailIdentityPolicy]
-> ReadPrec UpdateEmailIdentityPolicy
-> ReadPrec [UpdateEmailIdentityPolicy]
-> Read UpdateEmailIdentityPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEmailIdentityPolicy]
$creadListPrec :: ReadPrec [UpdateEmailIdentityPolicy]
readPrec :: ReadPrec UpdateEmailIdentityPolicy
$creadPrec :: ReadPrec UpdateEmailIdentityPolicy
readList :: ReadS [UpdateEmailIdentityPolicy]
$creadList :: ReadS [UpdateEmailIdentityPolicy]
readsPrec :: Int -> ReadS UpdateEmailIdentityPolicy
$creadsPrec :: Int -> ReadS UpdateEmailIdentityPolicy
Prelude.Read, Int -> UpdateEmailIdentityPolicy -> ShowS
[UpdateEmailIdentityPolicy] -> ShowS
UpdateEmailIdentityPolicy -> String
(Int -> UpdateEmailIdentityPolicy -> ShowS)
-> (UpdateEmailIdentityPolicy -> String)
-> ([UpdateEmailIdentityPolicy] -> ShowS)
-> Show UpdateEmailIdentityPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEmailIdentityPolicy] -> ShowS
$cshowList :: [UpdateEmailIdentityPolicy] -> ShowS
show :: UpdateEmailIdentityPolicy -> String
$cshow :: UpdateEmailIdentityPolicy -> String
showsPrec :: Int -> UpdateEmailIdentityPolicy -> ShowS
$cshowsPrec :: Int -> UpdateEmailIdentityPolicy -> ShowS
Prelude.Show, (forall x.
UpdateEmailIdentityPolicy -> Rep UpdateEmailIdentityPolicy x)
-> (forall x.
Rep UpdateEmailIdentityPolicy x -> UpdateEmailIdentityPolicy)
-> Generic UpdateEmailIdentityPolicy
forall x.
Rep UpdateEmailIdentityPolicy x -> UpdateEmailIdentityPolicy
forall x.
UpdateEmailIdentityPolicy -> Rep UpdateEmailIdentityPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateEmailIdentityPolicy x -> UpdateEmailIdentityPolicy
$cfrom :: forall x.
UpdateEmailIdentityPolicy -> Rep UpdateEmailIdentityPolicy x
Prelude.Generic)
newUpdateEmailIdentityPolicy ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
UpdateEmailIdentityPolicy
newUpdateEmailIdentityPolicy :: Text -> Text -> Text -> UpdateEmailIdentityPolicy
newUpdateEmailIdentityPolicy
Text
pEmailIdentity_
Text
pPolicyName_
Text
pPolicy_ =
UpdateEmailIdentityPolicy' :: Text -> Text -> Text -> UpdateEmailIdentityPolicy
UpdateEmailIdentityPolicy'
{ $sel:emailIdentity:UpdateEmailIdentityPolicy' :: Text
emailIdentity =
Text
pEmailIdentity_,
$sel:policyName:UpdateEmailIdentityPolicy' :: Text
policyName = Text
pPolicyName_,
$sel:policy:UpdateEmailIdentityPolicy' :: Text
policy = Text
pPolicy_
}
updateEmailIdentityPolicy_emailIdentity :: Lens.Lens' UpdateEmailIdentityPolicy Prelude.Text
updateEmailIdentityPolicy_emailIdentity :: (Text -> f Text)
-> UpdateEmailIdentityPolicy -> f UpdateEmailIdentityPolicy
updateEmailIdentityPolicy_emailIdentity = (UpdateEmailIdentityPolicy -> Text)
-> (UpdateEmailIdentityPolicy -> Text -> UpdateEmailIdentityPolicy)
-> Lens
UpdateEmailIdentityPolicy UpdateEmailIdentityPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmailIdentityPolicy' {Text
emailIdentity :: Text
$sel:emailIdentity:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> Text
emailIdentity} -> Text
emailIdentity) (\s :: UpdateEmailIdentityPolicy
s@UpdateEmailIdentityPolicy' {} Text
a -> UpdateEmailIdentityPolicy
s {$sel:emailIdentity:UpdateEmailIdentityPolicy' :: Text
emailIdentity = Text
a} :: UpdateEmailIdentityPolicy)
updateEmailIdentityPolicy_policyName :: Lens.Lens' UpdateEmailIdentityPolicy Prelude.Text
updateEmailIdentityPolicy_policyName :: (Text -> f Text)
-> UpdateEmailIdentityPolicy -> f UpdateEmailIdentityPolicy
updateEmailIdentityPolicy_policyName = (UpdateEmailIdentityPolicy -> Text)
-> (UpdateEmailIdentityPolicy -> Text -> UpdateEmailIdentityPolicy)
-> Lens
UpdateEmailIdentityPolicy UpdateEmailIdentityPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmailIdentityPolicy' {Text
policyName :: Text
$sel:policyName:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> Text
policyName} -> Text
policyName) (\s :: UpdateEmailIdentityPolicy
s@UpdateEmailIdentityPolicy' {} Text
a -> UpdateEmailIdentityPolicy
s {$sel:policyName:UpdateEmailIdentityPolicy' :: Text
policyName = Text
a} :: UpdateEmailIdentityPolicy)
updateEmailIdentityPolicy_policy :: Lens.Lens' UpdateEmailIdentityPolicy Prelude.Text
updateEmailIdentityPolicy_policy :: (Text -> f Text)
-> UpdateEmailIdentityPolicy -> f UpdateEmailIdentityPolicy
updateEmailIdentityPolicy_policy = (UpdateEmailIdentityPolicy -> Text)
-> (UpdateEmailIdentityPolicy -> Text -> UpdateEmailIdentityPolicy)
-> Lens
UpdateEmailIdentityPolicy UpdateEmailIdentityPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmailIdentityPolicy' {Text
policy :: Text
$sel:policy:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> Text
policy} -> Text
policy) (\s :: UpdateEmailIdentityPolicy
s@UpdateEmailIdentityPolicy' {} Text
a -> UpdateEmailIdentityPolicy
s {$sel:policy:UpdateEmailIdentityPolicy' :: Text
policy = Text
a} :: UpdateEmailIdentityPolicy)
instance Core.AWSRequest UpdateEmailIdentityPolicy where
type
AWSResponse UpdateEmailIdentityPolicy =
UpdateEmailIdentityPolicyResponse
request :: UpdateEmailIdentityPolicy -> Request UpdateEmailIdentityPolicy
request = Service
-> UpdateEmailIdentityPolicy -> Request UpdateEmailIdentityPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateEmailIdentityPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateEmailIdentityPolicy)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateEmailIdentityPolicy))
-> Logger
-> Service
-> Proxy UpdateEmailIdentityPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateEmailIdentityPolicy)))
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 -> UpdateEmailIdentityPolicyResponse
UpdateEmailIdentityPolicyResponse'
(Int -> UpdateEmailIdentityPolicyResponse)
-> Either String Int
-> Either String UpdateEmailIdentityPolicyResponse
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 UpdateEmailIdentityPolicy
instance Prelude.NFData UpdateEmailIdentityPolicy
instance Core.ToHeaders UpdateEmailIdentityPolicy where
toHeaders :: UpdateEmailIdentityPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateEmailIdentityPolicy -> 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 UpdateEmailIdentityPolicy where
toJSON :: UpdateEmailIdentityPolicy -> Value
toJSON UpdateEmailIdentityPolicy' {Text
policy :: Text
policyName :: Text
emailIdentity :: Text
$sel:policy:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> Text
$sel:policyName:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> Text
$sel:emailIdentity:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> 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 UpdateEmailIdentityPolicy where
toPath :: UpdateEmailIdentityPolicy -> ByteString
toPath UpdateEmailIdentityPolicy' {Text
policy :: Text
policyName :: Text
emailIdentity :: Text
$sel:policy:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> Text
$sel:policyName:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> Text
$sel:emailIdentity:UpdateEmailIdentityPolicy' :: UpdateEmailIdentityPolicy -> 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 UpdateEmailIdentityPolicy where
toQuery :: UpdateEmailIdentityPolicy -> QueryString
toQuery = QueryString -> UpdateEmailIdentityPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateEmailIdentityPolicyResponse = UpdateEmailIdentityPolicyResponse'
{
UpdateEmailIdentityPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateEmailIdentityPolicyResponse
-> UpdateEmailIdentityPolicyResponse -> Bool
(UpdateEmailIdentityPolicyResponse
-> UpdateEmailIdentityPolicyResponse -> Bool)
-> (UpdateEmailIdentityPolicyResponse
-> UpdateEmailIdentityPolicyResponse -> Bool)
-> Eq UpdateEmailIdentityPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEmailIdentityPolicyResponse
-> UpdateEmailIdentityPolicyResponse -> Bool
$c/= :: UpdateEmailIdentityPolicyResponse
-> UpdateEmailIdentityPolicyResponse -> Bool
== :: UpdateEmailIdentityPolicyResponse
-> UpdateEmailIdentityPolicyResponse -> Bool
$c== :: UpdateEmailIdentityPolicyResponse
-> UpdateEmailIdentityPolicyResponse -> Bool
Prelude.Eq, ReadPrec [UpdateEmailIdentityPolicyResponse]
ReadPrec UpdateEmailIdentityPolicyResponse
Int -> ReadS UpdateEmailIdentityPolicyResponse
ReadS [UpdateEmailIdentityPolicyResponse]
(Int -> ReadS UpdateEmailIdentityPolicyResponse)
-> ReadS [UpdateEmailIdentityPolicyResponse]
-> ReadPrec UpdateEmailIdentityPolicyResponse
-> ReadPrec [UpdateEmailIdentityPolicyResponse]
-> Read UpdateEmailIdentityPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEmailIdentityPolicyResponse]
$creadListPrec :: ReadPrec [UpdateEmailIdentityPolicyResponse]
readPrec :: ReadPrec UpdateEmailIdentityPolicyResponse
$creadPrec :: ReadPrec UpdateEmailIdentityPolicyResponse
readList :: ReadS [UpdateEmailIdentityPolicyResponse]
$creadList :: ReadS [UpdateEmailIdentityPolicyResponse]
readsPrec :: Int -> ReadS UpdateEmailIdentityPolicyResponse
$creadsPrec :: Int -> ReadS UpdateEmailIdentityPolicyResponse
Prelude.Read, Int -> UpdateEmailIdentityPolicyResponse -> ShowS
[UpdateEmailIdentityPolicyResponse] -> ShowS
UpdateEmailIdentityPolicyResponse -> String
(Int -> UpdateEmailIdentityPolicyResponse -> ShowS)
-> (UpdateEmailIdentityPolicyResponse -> String)
-> ([UpdateEmailIdentityPolicyResponse] -> ShowS)
-> Show UpdateEmailIdentityPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEmailIdentityPolicyResponse] -> ShowS
$cshowList :: [UpdateEmailIdentityPolicyResponse] -> ShowS
show :: UpdateEmailIdentityPolicyResponse -> String
$cshow :: UpdateEmailIdentityPolicyResponse -> String
showsPrec :: Int -> UpdateEmailIdentityPolicyResponse -> ShowS
$cshowsPrec :: Int -> UpdateEmailIdentityPolicyResponse -> ShowS
Prelude.Show, (forall x.
UpdateEmailIdentityPolicyResponse
-> Rep UpdateEmailIdentityPolicyResponse x)
-> (forall x.
Rep UpdateEmailIdentityPolicyResponse x
-> UpdateEmailIdentityPolicyResponse)
-> Generic UpdateEmailIdentityPolicyResponse
forall x.
Rep UpdateEmailIdentityPolicyResponse x
-> UpdateEmailIdentityPolicyResponse
forall x.
UpdateEmailIdentityPolicyResponse
-> Rep UpdateEmailIdentityPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateEmailIdentityPolicyResponse x
-> UpdateEmailIdentityPolicyResponse
$cfrom :: forall x.
UpdateEmailIdentityPolicyResponse
-> Rep UpdateEmailIdentityPolicyResponse x
Prelude.Generic)
newUpdateEmailIdentityPolicyResponse ::
Prelude.Int ->
UpdateEmailIdentityPolicyResponse
newUpdateEmailIdentityPolicyResponse :: Int -> UpdateEmailIdentityPolicyResponse
newUpdateEmailIdentityPolicyResponse Int
pHttpStatus_ =
UpdateEmailIdentityPolicyResponse' :: Int -> UpdateEmailIdentityPolicyResponse
UpdateEmailIdentityPolicyResponse'
{ $sel:httpStatus:UpdateEmailIdentityPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateEmailIdentityPolicyResponse_httpStatus :: Lens.Lens' UpdateEmailIdentityPolicyResponse Prelude.Int
updateEmailIdentityPolicyResponse_httpStatus :: (Int -> f Int)
-> UpdateEmailIdentityPolicyResponse
-> f UpdateEmailIdentityPolicyResponse
updateEmailIdentityPolicyResponse_httpStatus = (UpdateEmailIdentityPolicyResponse -> Int)
-> (UpdateEmailIdentityPolicyResponse
-> Int -> UpdateEmailIdentityPolicyResponse)
-> Lens
UpdateEmailIdentityPolicyResponse
UpdateEmailIdentityPolicyResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmailIdentityPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateEmailIdentityPolicyResponse' :: UpdateEmailIdentityPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateEmailIdentityPolicyResponse
s@UpdateEmailIdentityPolicyResponse' {} Int
a -> UpdateEmailIdentityPolicyResponse
s {$sel:httpStatus:UpdateEmailIdentityPolicyResponse' :: Int
httpStatus = Int
a} :: UpdateEmailIdentityPolicyResponse)
instance
Prelude.NFData
UpdateEmailIdentityPolicyResponse