{-# 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.SNS.ConfirmSubscription
(
ConfirmSubscription (..),
newConfirmSubscription,
confirmSubscription_authenticateOnUnsubscribe,
confirmSubscription_topicArn,
confirmSubscription_token,
ConfirmSubscriptionResponse (..),
newConfirmSubscriptionResponse,
confirmSubscriptionResponse_subscriptionArn,
confirmSubscriptionResponse_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.SNS.Types
data ConfirmSubscription = ConfirmSubscription'
{
ConfirmSubscription -> Maybe Text
authenticateOnUnsubscribe :: Prelude.Maybe Prelude.Text,
ConfirmSubscription -> Text
topicArn :: Prelude.Text,
ConfirmSubscription -> Text
token :: Prelude.Text
}
deriving (ConfirmSubscription -> ConfirmSubscription -> Bool
(ConfirmSubscription -> ConfirmSubscription -> Bool)
-> (ConfirmSubscription -> ConfirmSubscription -> Bool)
-> Eq ConfirmSubscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmSubscription -> ConfirmSubscription -> Bool
$c/= :: ConfirmSubscription -> ConfirmSubscription -> Bool
== :: ConfirmSubscription -> ConfirmSubscription -> Bool
$c== :: ConfirmSubscription -> ConfirmSubscription -> Bool
Prelude.Eq, ReadPrec [ConfirmSubscription]
ReadPrec ConfirmSubscription
Int -> ReadS ConfirmSubscription
ReadS [ConfirmSubscription]
(Int -> ReadS ConfirmSubscription)
-> ReadS [ConfirmSubscription]
-> ReadPrec ConfirmSubscription
-> ReadPrec [ConfirmSubscription]
-> Read ConfirmSubscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfirmSubscription]
$creadListPrec :: ReadPrec [ConfirmSubscription]
readPrec :: ReadPrec ConfirmSubscription
$creadPrec :: ReadPrec ConfirmSubscription
readList :: ReadS [ConfirmSubscription]
$creadList :: ReadS [ConfirmSubscription]
readsPrec :: Int -> ReadS ConfirmSubscription
$creadsPrec :: Int -> ReadS ConfirmSubscription
Prelude.Read, Int -> ConfirmSubscription -> ShowS
[ConfirmSubscription] -> ShowS
ConfirmSubscription -> String
(Int -> ConfirmSubscription -> ShowS)
-> (ConfirmSubscription -> String)
-> ([ConfirmSubscription] -> ShowS)
-> Show ConfirmSubscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmSubscription] -> ShowS
$cshowList :: [ConfirmSubscription] -> ShowS
show :: ConfirmSubscription -> String
$cshow :: ConfirmSubscription -> String
showsPrec :: Int -> ConfirmSubscription -> ShowS
$cshowsPrec :: Int -> ConfirmSubscription -> ShowS
Prelude.Show, (forall x. ConfirmSubscription -> Rep ConfirmSubscription x)
-> (forall x. Rep ConfirmSubscription x -> ConfirmSubscription)
-> Generic ConfirmSubscription
forall x. Rep ConfirmSubscription x -> ConfirmSubscription
forall x. ConfirmSubscription -> Rep ConfirmSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfirmSubscription x -> ConfirmSubscription
$cfrom :: forall x. ConfirmSubscription -> Rep ConfirmSubscription x
Prelude.Generic)
newConfirmSubscription ::
Prelude.Text ->
Prelude.Text ->
ConfirmSubscription
newConfirmSubscription :: Text -> Text -> ConfirmSubscription
newConfirmSubscription Text
pTopicArn_ Text
pToken_ =
ConfirmSubscription' :: Maybe Text -> Text -> Text -> ConfirmSubscription
ConfirmSubscription'
{ $sel:authenticateOnUnsubscribe:ConfirmSubscription' :: Maybe Text
authenticateOnUnsubscribe =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:topicArn:ConfirmSubscription' :: Text
topicArn = Text
pTopicArn_,
$sel:token:ConfirmSubscription' :: Text
token = Text
pToken_
}
confirmSubscription_authenticateOnUnsubscribe :: Lens.Lens' ConfirmSubscription (Prelude.Maybe Prelude.Text)
confirmSubscription_authenticateOnUnsubscribe :: (Maybe Text -> f (Maybe Text))
-> ConfirmSubscription -> f ConfirmSubscription
confirmSubscription_authenticateOnUnsubscribe = (ConfirmSubscription -> Maybe Text)
-> (ConfirmSubscription -> Maybe Text -> ConfirmSubscription)
-> Lens
ConfirmSubscription ConfirmSubscription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSubscription' {Maybe Text
authenticateOnUnsubscribe :: Maybe Text
$sel:authenticateOnUnsubscribe:ConfirmSubscription' :: ConfirmSubscription -> Maybe Text
authenticateOnUnsubscribe} -> Maybe Text
authenticateOnUnsubscribe) (\s :: ConfirmSubscription
s@ConfirmSubscription' {} Maybe Text
a -> ConfirmSubscription
s {$sel:authenticateOnUnsubscribe:ConfirmSubscription' :: Maybe Text
authenticateOnUnsubscribe = Maybe Text
a} :: ConfirmSubscription)
confirmSubscription_topicArn :: Lens.Lens' ConfirmSubscription Prelude.Text
confirmSubscription_topicArn :: (Text -> f Text) -> ConfirmSubscription -> f ConfirmSubscription
confirmSubscription_topicArn = (ConfirmSubscription -> Text)
-> (ConfirmSubscription -> Text -> ConfirmSubscription)
-> Lens ConfirmSubscription ConfirmSubscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSubscription' {Text
topicArn :: Text
$sel:topicArn:ConfirmSubscription' :: ConfirmSubscription -> Text
topicArn} -> Text
topicArn) (\s :: ConfirmSubscription
s@ConfirmSubscription' {} Text
a -> ConfirmSubscription
s {$sel:topicArn:ConfirmSubscription' :: Text
topicArn = Text
a} :: ConfirmSubscription)
confirmSubscription_token :: Lens.Lens' ConfirmSubscription Prelude.Text
confirmSubscription_token :: (Text -> f Text) -> ConfirmSubscription -> f ConfirmSubscription
confirmSubscription_token = (ConfirmSubscription -> Text)
-> (ConfirmSubscription -> Text -> ConfirmSubscription)
-> Lens ConfirmSubscription ConfirmSubscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSubscription' {Text
token :: Text
$sel:token:ConfirmSubscription' :: ConfirmSubscription -> Text
token} -> Text
token) (\s :: ConfirmSubscription
s@ConfirmSubscription' {} Text
a -> ConfirmSubscription
s {$sel:token:ConfirmSubscription' :: Text
token = Text
a} :: ConfirmSubscription)
instance Core.AWSRequest ConfirmSubscription where
type
AWSResponse ConfirmSubscription =
ConfirmSubscriptionResponse
request :: ConfirmSubscription -> Request ConfirmSubscription
request = Service -> ConfirmSubscription -> Request ConfirmSubscription
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy ConfirmSubscription
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ConfirmSubscription)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse ConfirmSubscription))
-> Logger
-> Service
-> Proxy ConfirmSubscription
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ConfirmSubscription)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"ConfirmSubscriptionResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Int -> ConfirmSubscriptionResponse
ConfirmSubscriptionResponse'
(Maybe Text -> Int -> ConfirmSubscriptionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ConfirmSubscriptionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SubscriptionArn")
Either String (Int -> ConfirmSubscriptionResponse)
-> Either String Int -> Either String ConfirmSubscriptionResponse
forall (f :: * -> *) a b. Applicative f => 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 ConfirmSubscription
instance Prelude.NFData ConfirmSubscription
instance Core.ToHeaders ConfirmSubscription where
toHeaders :: ConfirmSubscription -> ResponseHeaders
toHeaders = ResponseHeaders -> ConfirmSubscription -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ConfirmSubscription where
toPath :: ConfirmSubscription -> ByteString
toPath = ByteString -> ConfirmSubscription -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ConfirmSubscription where
toQuery :: ConfirmSubscription -> QueryString
toQuery ConfirmSubscription' {Maybe Text
Text
token :: Text
topicArn :: Text
authenticateOnUnsubscribe :: Maybe Text
$sel:token:ConfirmSubscription' :: ConfirmSubscription -> Text
$sel:topicArn:ConfirmSubscription' :: ConfirmSubscription -> Text
$sel:authenticateOnUnsubscribe:ConfirmSubscription' :: ConfirmSubscription -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ConfirmSubscription" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
ByteString
"AuthenticateOnUnsubscribe"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
authenticateOnUnsubscribe,
ByteString
"TopicArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
topicArn,
ByteString
"Token" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
token
]
data ConfirmSubscriptionResponse = ConfirmSubscriptionResponse'
{
ConfirmSubscriptionResponse -> Maybe Text
subscriptionArn :: Prelude.Maybe Prelude.Text,
ConfirmSubscriptionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ConfirmSubscriptionResponse -> ConfirmSubscriptionResponse -> Bool
(ConfirmSubscriptionResponse
-> ConfirmSubscriptionResponse -> Bool)
-> (ConfirmSubscriptionResponse
-> ConfirmSubscriptionResponse -> Bool)
-> Eq ConfirmSubscriptionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmSubscriptionResponse -> ConfirmSubscriptionResponse -> Bool
$c/= :: ConfirmSubscriptionResponse -> ConfirmSubscriptionResponse -> Bool
== :: ConfirmSubscriptionResponse -> ConfirmSubscriptionResponse -> Bool
$c== :: ConfirmSubscriptionResponse -> ConfirmSubscriptionResponse -> Bool
Prelude.Eq, ReadPrec [ConfirmSubscriptionResponse]
ReadPrec ConfirmSubscriptionResponse
Int -> ReadS ConfirmSubscriptionResponse
ReadS [ConfirmSubscriptionResponse]
(Int -> ReadS ConfirmSubscriptionResponse)
-> ReadS [ConfirmSubscriptionResponse]
-> ReadPrec ConfirmSubscriptionResponse
-> ReadPrec [ConfirmSubscriptionResponse]
-> Read ConfirmSubscriptionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfirmSubscriptionResponse]
$creadListPrec :: ReadPrec [ConfirmSubscriptionResponse]
readPrec :: ReadPrec ConfirmSubscriptionResponse
$creadPrec :: ReadPrec ConfirmSubscriptionResponse
readList :: ReadS [ConfirmSubscriptionResponse]
$creadList :: ReadS [ConfirmSubscriptionResponse]
readsPrec :: Int -> ReadS ConfirmSubscriptionResponse
$creadsPrec :: Int -> ReadS ConfirmSubscriptionResponse
Prelude.Read, Int -> ConfirmSubscriptionResponse -> ShowS
[ConfirmSubscriptionResponse] -> ShowS
ConfirmSubscriptionResponse -> String
(Int -> ConfirmSubscriptionResponse -> ShowS)
-> (ConfirmSubscriptionResponse -> String)
-> ([ConfirmSubscriptionResponse] -> ShowS)
-> Show ConfirmSubscriptionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmSubscriptionResponse] -> ShowS
$cshowList :: [ConfirmSubscriptionResponse] -> ShowS
show :: ConfirmSubscriptionResponse -> String
$cshow :: ConfirmSubscriptionResponse -> String
showsPrec :: Int -> ConfirmSubscriptionResponse -> ShowS
$cshowsPrec :: Int -> ConfirmSubscriptionResponse -> ShowS
Prelude.Show, (forall x.
ConfirmSubscriptionResponse -> Rep ConfirmSubscriptionResponse x)
-> (forall x.
Rep ConfirmSubscriptionResponse x -> ConfirmSubscriptionResponse)
-> Generic ConfirmSubscriptionResponse
forall x.
Rep ConfirmSubscriptionResponse x -> ConfirmSubscriptionResponse
forall x.
ConfirmSubscriptionResponse -> Rep ConfirmSubscriptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConfirmSubscriptionResponse x -> ConfirmSubscriptionResponse
$cfrom :: forall x.
ConfirmSubscriptionResponse -> Rep ConfirmSubscriptionResponse x
Prelude.Generic)
newConfirmSubscriptionResponse ::
Prelude.Int ->
ConfirmSubscriptionResponse
newConfirmSubscriptionResponse :: Int -> ConfirmSubscriptionResponse
newConfirmSubscriptionResponse Int
pHttpStatus_ =
ConfirmSubscriptionResponse' :: Maybe Text -> Int -> ConfirmSubscriptionResponse
ConfirmSubscriptionResponse'
{ $sel:subscriptionArn:ConfirmSubscriptionResponse' :: Maybe Text
subscriptionArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ConfirmSubscriptionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
confirmSubscriptionResponse_subscriptionArn :: Lens.Lens' ConfirmSubscriptionResponse (Prelude.Maybe Prelude.Text)
confirmSubscriptionResponse_subscriptionArn :: (Maybe Text -> f (Maybe Text))
-> ConfirmSubscriptionResponse -> f ConfirmSubscriptionResponse
confirmSubscriptionResponse_subscriptionArn = (ConfirmSubscriptionResponse -> Maybe Text)
-> (ConfirmSubscriptionResponse
-> Maybe Text -> ConfirmSubscriptionResponse)
-> Lens
ConfirmSubscriptionResponse
ConfirmSubscriptionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSubscriptionResponse' {Maybe Text
subscriptionArn :: Maybe Text
$sel:subscriptionArn:ConfirmSubscriptionResponse' :: ConfirmSubscriptionResponse -> Maybe Text
subscriptionArn} -> Maybe Text
subscriptionArn) (\s :: ConfirmSubscriptionResponse
s@ConfirmSubscriptionResponse' {} Maybe Text
a -> ConfirmSubscriptionResponse
s {$sel:subscriptionArn:ConfirmSubscriptionResponse' :: Maybe Text
subscriptionArn = Maybe Text
a} :: ConfirmSubscriptionResponse)
confirmSubscriptionResponse_httpStatus :: Lens.Lens' ConfirmSubscriptionResponse Prelude.Int
confirmSubscriptionResponse_httpStatus :: (Int -> f Int)
-> ConfirmSubscriptionResponse -> f ConfirmSubscriptionResponse
confirmSubscriptionResponse_httpStatus = (ConfirmSubscriptionResponse -> Int)
-> (ConfirmSubscriptionResponse
-> Int -> ConfirmSubscriptionResponse)
-> Lens
ConfirmSubscriptionResponse ConfirmSubscriptionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSubscriptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:ConfirmSubscriptionResponse' :: ConfirmSubscriptionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ConfirmSubscriptionResponse
s@ConfirmSubscriptionResponse' {} Int
a -> ConfirmSubscriptionResponse
s {$sel:httpStatus:ConfirmSubscriptionResponse' :: Int
httpStatus = Int
a} :: ConfirmSubscriptionResponse)
instance Prelude.NFData ConfirmSubscriptionResponse