{-# 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.ListSubscriptionsByTopic
(
ListSubscriptionsByTopic (..),
newListSubscriptionsByTopic,
listSubscriptionsByTopic_nextToken,
listSubscriptionsByTopic_topicArn,
ListSubscriptionsByTopicResponse (..),
newListSubscriptionsByTopicResponse,
listSubscriptionsByTopicResponse_nextToken,
listSubscriptionsByTopicResponse_subscriptions,
listSubscriptionsByTopicResponse_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.SNS.Types
data ListSubscriptionsByTopic = ListSubscriptionsByTopic'
{
ListSubscriptionsByTopic -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSubscriptionsByTopic -> Text
topicArn :: Prelude.Text
}
deriving (ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
$c/= :: ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
== :: ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
$c== :: ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
Prelude.Eq, ReadPrec [ListSubscriptionsByTopic]
ReadPrec ListSubscriptionsByTopic
Int -> ReadS ListSubscriptionsByTopic
ReadS [ListSubscriptionsByTopic]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSubscriptionsByTopic]
$creadListPrec :: ReadPrec [ListSubscriptionsByTopic]
readPrec :: ReadPrec ListSubscriptionsByTopic
$creadPrec :: ReadPrec ListSubscriptionsByTopic
readList :: ReadS [ListSubscriptionsByTopic]
$creadList :: ReadS [ListSubscriptionsByTopic]
readsPrec :: Int -> ReadS ListSubscriptionsByTopic
$creadsPrec :: Int -> ReadS ListSubscriptionsByTopic
Prelude.Read, Int -> ListSubscriptionsByTopic -> ShowS
[ListSubscriptionsByTopic] -> ShowS
ListSubscriptionsByTopic -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSubscriptionsByTopic] -> ShowS
$cshowList :: [ListSubscriptionsByTopic] -> ShowS
show :: ListSubscriptionsByTopic -> String
$cshow :: ListSubscriptionsByTopic -> String
showsPrec :: Int -> ListSubscriptionsByTopic -> ShowS
$cshowsPrec :: Int -> ListSubscriptionsByTopic -> ShowS
Prelude.Show, forall x.
Rep ListSubscriptionsByTopic x -> ListSubscriptionsByTopic
forall x.
ListSubscriptionsByTopic -> Rep ListSubscriptionsByTopic x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSubscriptionsByTopic x -> ListSubscriptionsByTopic
$cfrom :: forall x.
ListSubscriptionsByTopic -> Rep ListSubscriptionsByTopic x
Prelude.Generic)
newListSubscriptionsByTopic ::
Prelude.Text ->
ListSubscriptionsByTopic
newListSubscriptionsByTopic :: Text -> ListSubscriptionsByTopic
newListSubscriptionsByTopic Text
pTopicArn_ =
ListSubscriptionsByTopic'
{ $sel:nextToken:ListSubscriptionsByTopic' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:topicArn:ListSubscriptionsByTopic' :: Text
topicArn = Text
pTopicArn_
}
listSubscriptionsByTopic_nextToken :: Lens.Lens' ListSubscriptionsByTopic (Prelude.Maybe Prelude.Text)
listSubscriptionsByTopic_nextToken :: Lens' ListSubscriptionsByTopic (Maybe Text)
listSubscriptionsByTopic_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopic' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSubscriptionsByTopic' :: ListSubscriptionsByTopic -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSubscriptionsByTopic
s@ListSubscriptionsByTopic' {} Maybe Text
a -> ListSubscriptionsByTopic
s {$sel:nextToken:ListSubscriptionsByTopic' :: Maybe Text
nextToken = Maybe Text
a} :: ListSubscriptionsByTopic)
listSubscriptionsByTopic_topicArn :: Lens.Lens' ListSubscriptionsByTopic Prelude.Text
listSubscriptionsByTopic_topicArn :: Lens' ListSubscriptionsByTopic Text
listSubscriptionsByTopic_topicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopic' {Text
topicArn :: Text
$sel:topicArn:ListSubscriptionsByTopic' :: ListSubscriptionsByTopic -> Text
topicArn} -> Text
topicArn) (\s :: ListSubscriptionsByTopic
s@ListSubscriptionsByTopic' {} Text
a -> ListSubscriptionsByTopic
s {$sel:topicArn:ListSubscriptionsByTopic' :: Text
topicArn = Text
a} :: ListSubscriptionsByTopic)
instance Core.AWSPager ListSubscriptionsByTopic where
page :: ListSubscriptionsByTopic
-> AWSResponse ListSubscriptionsByTopic
-> Maybe ListSubscriptionsByTopic
page ListSubscriptionsByTopic
rq AWSResponse ListSubscriptionsByTopic
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListSubscriptionsByTopic
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSubscriptionsByTopicResponse (Maybe Text)
listSubscriptionsByTopicResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListSubscriptionsByTopic
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSubscriptionsByTopicResponse (Maybe [Subscription])
listSubscriptionsByTopicResponse_subscriptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListSubscriptionsByTopic
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListSubscriptionsByTopic (Maybe Text)
listSubscriptionsByTopic_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSubscriptionsByTopic
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSubscriptionsByTopicResponse (Maybe Text)
listSubscriptionsByTopicResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListSubscriptionsByTopic where
type
AWSResponse ListSubscriptionsByTopic =
ListSubscriptionsByTopicResponse
request :: (Service -> Service)
-> ListSubscriptionsByTopic -> Request ListSubscriptionsByTopic
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListSubscriptionsByTopic
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListSubscriptionsByTopic)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"ListSubscriptionsByTopicResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe [Subscription] -> Int -> ListSubscriptionsByTopicResponse
ListSubscriptionsByTopicResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Subscriptions"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
)
forall (f :: * -> *) a b. Applicative f => 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 ListSubscriptionsByTopic where
hashWithSalt :: Int -> ListSubscriptionsByTopic -> Int
hashWithSalt Int
_salt ListSubscriptionsByTopic' {Maybe Text
Text
topicArn :: Text
nextToken :: Maybe Text
$sel:topicArn:ListSubscriptionsByTopic' :: ListSubscriptionsByTopic -> Text
$sel:nextToken:ListSubscriptionsByTopic' :: ListSubscriptionsByTopic -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
topicArn
instance Prelude.NFData ListSubscriptionsByTopic where
rnf :: ListSubscriptionsByTopic -> ()
rnf ListSubscriptionsByTopic' {Maybe Text
Text
topicArn :: Text
nextToken :: Maybe Text
$sel:topicArn:ListSubscriptionsByTopic' :: ListSubscriptionsByTopic -> Text
$sel:nextToken:ListSubscriptionsByTopic' :: ListSubscriptionsByTopic -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
topicArn
instance Data.ToHeaders ListSubscriptionsByTopic where
toHeaders :: ListSubscriptionsByTopic -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListSubscriptionsByTopic where
toPath :: ListSubscriptionsByTopic -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListSubscriptionsByTopic where
toQuery :: ListSubscriptionsByTopic -> QueryString
toQuery ListSubscriptionsByTopic' {Maybe Text
Text
topicArn :: Text
nextToken :: Maybe Text
$sel:topicArn:ListSubscriptionsByTopic' :: ListSubscriptionsByTopic -> Text
$sel:nextToken:ListSubscriptionsByTopic' :: ListSubscriptionsByTopic -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListSubscriptionsByTopic" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
ByteString
"TopicArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
topicArn
]
data ListSubscriptionsByTopicResponse = ListSubscriptionsByTopicResponse'
{
ListSubscriptionsByTopicResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSubscriptionsByTopicResponse -> Maybe [Subscription]
subscriptions :: Prelude.Maybe [Subscription],
ListSubscriptionsByTopicResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
$c/= :: ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
== :: ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
$c== :: ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
Prelude.Eq, ReadPrec [ListSubscriptionsByTopicResponse]
ReadPrec ListSubscriptionsByTopicResponse
Int -> ReadS ListSubscriptionsByTopicResponse
ReadS [ListSubscriptionsByTopicResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSubscriptionsByTopicResponse]
$creadListPrec :: ReadPrec [ListSubscriptionsByTopicResponse]
readPrec :: ReadPrec ListSubscriptionsByTopicResponse
$creadPrec :: ReadPrec ListSubscriptionsByTopicResponse
readList :: ReadS [ListSubscriptionsByTopicResponse]
$creadList :: ReadS [ListSubscriptionsByTopicResponse]
readsPrec :: Int -> ReadS ListSubscriptionsByTopicResponse
$creadsPrec :: Int -> ReadS ListSubscriptionsByTopicResponse
Prelude.Read, Int -> ListSubscriptionsByTopicResponse -> ShowS
[ListSubscriptionsByTopicResponse] -> ShowS
ListSubscriptionsByTopicResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSubscriptionsByTopicResponse] -> ShowS
$cshowList :: [ListSubscriptionsByTopicResponse] -> ShowS
show :: ListSubscriptionsByTopicResponse -> String
$cshow :: ListSubscriptionsByTopicResponse -> String
showsPrec :: Int -> ListSubscriptionsByTopicResponse -> ShowS
$cshowsPrec :: Int -> ListSubscriptionsByTopicResponse -> ShowS
Prelude.Show, forall x.
Rep ListSubscriptionsByTopicResponse x
-> ListSubscriptionsByTopicResponse
forall x.
ListSubscriptionsByTopicResponse
-> Rep ListSubscriptionsByTopicResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSubscriptionsByTopicResponse x
-> ListSubscriptionsByTopicResponse
$cfrom :: forall x.
ListSubscriptionsByTopicResponse
-> Rep ListSubscriptionsByTopicResponse x
Prelude.Generic)
newListSubscriptionsByTopicResponse ::
Prelude.Int ->
ListSubscriptionsByTopicResponse
newListSubscriptionsByTopicResponse :: Int -> ListSubscriptionsByTopicResponse
newListSubscriptionsByTopicResponse Int
pHttpStatus_ =
ListSubscriptionsByTopicResponse'
{ $sel:nextToken:ListSubscriptionsByTopicResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:subscriptions:ListSubscriptionsByTopicResponse' :: Maybe [Subscription]
subscriptions = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListSubscriptionsByTopicResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listSubscriptionsByTopicResponse_nextToken :: Lens.Lens' ListSubscriptionsByTopicResponse (Prelude.Maybe Prelude.Text)
listSubscriptionsByTopicResponse_nextToken :: Lens' ListSubscriptionsByTopicResponse (Maybe Text)
listSubscriptionsByTopicResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopicResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSubscriptionsByTopicResponse' :: ListSubscriptionsByTopicResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSubscriptionsByTopicResponse
s@ListSubscriptionsByTopicResponse' {} Maybe Text
a -> ListSubscriptionsByTopicResponse
s {$sel:nextToken:ListSubscriptionsByTopicResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSubscriptionsByTopicResponse)
listSubscriptionsByTopicResponse_subscriptions :: Lens.Lens' ListSubscriptionsByTopicResponse (Prelude.Maybe [Subscription])
listSubscriptionsByTopicResponse_subscriptions :: Lens' ListSubscriptionsByTopicResponse (Maybe [Subscription])
listSubscriptionsByTopicResponse_subscriptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopicResponse' {Maybe [Subscription]
subscriptions :: Maybe [Subscription]
$sel:subscriptions:ListSubscriptionsByTopicResponse' :: ListSubscriptionsByTopicResponse -> Maybe [Subscription]
subscriptions} -> Maybe [Subscription]
subscriptions) (\s :: ListSubscriptionsByTopicResponse
s@ListSubscriptionsByTopicResponse' {} Maybe [Subscription]
a -> ListSubscriptionsByTopicResponse
s {$sel:subscriptions:ListSubscriptionsByTopicResponse' :: Maybe [Subscription]
subscriptions = Maybe [Subscription]
a} :: ListSubscriptionsByTopicResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listSubscriptionsByTopicResponse_httpStatus :: Lens.Lens' ListSubscriptionsByTopicResponse Prelude.Int
listSubscriptionsByTopicResponse_httpStatus :: Lens' ListSubscriptionsByTopicResponse Int
listSubscriptionsByTopicResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopicResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSubscriptionsByTopicResponse' :: ListSubscriptionsByTopicResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSubscriptionsByTopicResponse
s@ListSubscriptionsByTopicResponse' {} Int
a -> ListSubscriptionsByTopicResponse
s {$sel:httpStatus:ListSubscriptionsByTopicResponse' :: Int
httpStatus = Int
a} :: ListSubscriptionsByTopicResponse)
instance
Prelude.NFData
ListSubscriptionsByTopicResponse
where
rnf :: ListSubscriptionsByTopicResponse -> ()
rnf ListSubscriptionsByTopicResponse' {Int
Maybe [Subscription]
Maybe Text
httpStatus :: Int
subscriptions :: Maybe [Subscription]
nextToken :: Maybe Text
$sel:httpStatus:ListSubscriptionsByTopicResponse' :: ListSubscriptionsByTopicResponse -> Int
$sel:subscriptions:ListSubscriptionsByTopicResponse' :: ListSubscriptionsByTopicResponse -> Maybe [Subscription]
$sel:nextToken:ListSubscriptionsByTopicResponse' :: ListSubscriptionsByTopicResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Subscription]
subscriptions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus