{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SNS.ListSubscriptionsByTopic
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of the subscriptions to a specific topic. Each call
-- returns a limited list of subscriptions, up to 100. If there are more
-- subscriptions, a @NextToken@ is also returned. Use the @NextToken@
-- parameter in a new @ListSubscriptionsByTopic@ call to get further
-- results.
--
-- This action is throttled at 30 transactions per second (TPS).
--
-- This operation returns paginated results.
module Amazonka.SNS.ListSubscriptionsByTopic
  ( -- * Creating a Request
    ListSubscriptionsByTopic (..),
    newListSubscriptionsByTopic,

    -- * Request Lenses
    listSubscriptionsByTopic_nextToken,
    listSubscriptionsByTopic_topicArn,

    -- * Destructuring the Response
    ListSubscriptionsByTopicResponse (..),
    newListSubscriptionsByTopicResponse,

    -- * Response Lenses
    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

-- | Input for ListSubscriptionsByTopic action.
--
-- /See:/ 'newListSubscriptionsByTopic' smart constructor.
data ListSubscriptionsByTopic = ListSubscriptionsByTopic'
  { -- | Token returned by the previous @ListSubscriptionsByTopic@ request.
    ListSubscriptionsByTopic -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the topic for which you wish to find subscriptions.
    ListSubscriptionsByTopic -> Text
topicArn :: Prelude.Text
  }
  deriving (ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
(ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool)
-> (ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool)
-> Eq ListSubscriptionsByTopic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
== :: ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
$c/= :: ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
/= :: ListSubscriptionsByTopic -> ListSubscriptionsByTopic -> Bool
Prelude.Eq, ReadPrec [ListSubscriptionsByTopic]
ReadPrec ListSubscriptionsByTopic
Int -> ReadS ListSubscriptionsByTopic
ReadS [ListSubscriptionsByTopic]
(Int -> ReadS ListSubscriptionsByTopic)
-> ReadS [ListSubscriptionsByTopic]
-> ReadPrec ListSubscriptionsByTopic
-> ReadPrec [ListSubscriptionsByTopic]
-> Read ListSubscriptionsByTopic
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ListSubscriptionsByTopic
readsPrec :: Int -> ReadS ListSubscriptionsByTopic
$creadList :: ReadS [ListSubscriptionsByTopic]
readList :: ReadS [ListSubscriptionsByTopic]
$creadPrec :: ReadPrec ListSubscriptionsByTopic
readPrec :: ReadPrec ListSubscriptionsByTopic
$creadListPrec :: ReadPrec [ListSubscriptionsByTopic]
readListPrec :: ReadPrec [ListSubscriptionsByTopic]
Prelude.Read, Int -> ListSubscriptionsByTopic -> ShowS
[ListSubscriptionsByTopic] -> ShowS
ListSubscriptionsByTopic -> String
(Int -> ListSubscriptionsByTopic -> ShowS)
-> (ListSubscriptionsByTopic -> String)
-> ([ListSubscriptionsByTopic] -> ShowS)
-> Show ListSubscriptionsByTopic
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListSubscriptionsByTopic -> ShowS
showsPrec :: Int -> ListSubscriptionsByTopic -> ShowS
$cshow :: ListSubscriptionsByTopic -> String
show :: ListSubscriptionsByTopic -> String
$cshowList :: [ListSubscriptionsByTopic] -> ShowS
showList :: [ListSubscriptionsByTopic] -> ShowS
Prelude.Show, (forall x.
 ListSubscriptionsByTopic -> Rep ListSubscriptionsByTopic x)
-> (forall x.
    Rep ListSubscriptionsByTopic x -> ListSubscriptionsByTopic)
-> Generic ListSubscriptionsByTopic
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
$cfrom :: forall x.
ListSubscriptionsByTopic -> Rep ListSubscriptionsByTopic x
from :: forall x.
ListSubscriptionsByTopic -> Rep ListSubscriptionsByTopic x
$cto :: forall x.
Rep ListSubscriptionsByTopic x -> ListSubscriptionsByTopic
to :: forall x.
Rep ListSubscriptionsByTopic x -> ListSubscriptionsByTopic
Prelude.Generic)

-- |
-- Create a value of 'ListSubscriptionsByTopic' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listSubscriptionsByTopic_nextToken' - Token returned by the previous @ListSubscriptionsByTopic@ request.
--
-- 'topicArn', 'listSubscriptionsByTopic_topicArn' - The ARN of the topic for which you wish to find subscriptions.
newListSubscriptionsByTopic ::
  -- | 'topicArn'
  Prelude.Text ->
  ListSubscriptionsByTopic
newListSubscriptionsByTopic :: Text -> ListSubscriptionsByTopic
newListSubscriptionsByTopic Text
pTopicArn_ =
  ListSubscriptionsByTopic'
    { nextToken :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      topicArn :: Text
topicArn = Text
pTopicArn_
    }

-- | Token returned by the previous @ListSubscriptionsByTopic@ request.
listSubscriptionsByTopic_nextToken :: Lens.Lens' ListSubscriptionsByTopic (Prelude.Maybe Prelude.Text)
listSubscriptionsByTopic_nextToken :: Lens' ListSubscriptionsByTopic (Maybe Text)
listSubscriptionsByTopic_nextToken = (ListSubscriptionsByTopic -> Maybe Text)
-> (ListSubscriptionsByTopic
    -> Maybe Text -> ListSubscriptionsByTopic)
-> Lens' ListSubscriptionsByTopic (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopic' {Maybe Text
nextToken :: ListSubscriptionsByTopic -> Maybe Text
nextToken :: Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSubscriptionsByTopic
s@ListSubscriptionsByTopic' {} Maybe Text
a -> ListSubscriptionsByTopic
s {nextToken = a} :: ListSubscriptionsByTopic)

-- | The ARN of the topic for which you wish to find subscriptions.
listSubscriptionsByTopic_topicArn :: Lens.Lens' ListSubscriptionsByTopic Prelude.Text
listSubscriptionsByTopic_topicArn :: Lens' ListSubscriptionsByTopic Text
listSubscriptionsByTopic_topicArn = (ListSubscriptionsByTopic -> Text)
-> (ListSubscriptionsByTopic -> Text -> ListSubscriptionsByTopic)
-> Lens' ListSubscriptionsByTopic Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopic' {Text
topicArn :: ListSubscriptionsByTopic -> Text
topicArn :: Text
topicArn} -> Text
topicArn) (\s :: ListSubscriptionsByTopic
s@ListSubscriptionsByTopic' {} Text
a -> ListSubscriptionsByTopic
s {topicArn = a} :: ListSubscriptionsByTopic)

instance Core.AWSPager ListSubscriptionsByTopic where
  page :: ListSubscriptionsByTopic
-> AWSResponse ListSubscriptionsByTopic
-> Maybe ListSubscriptionsByTopic
page ListSubscriptionsByTopic
rq AWSResponse ListSubscriptionsByTopic
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSubscriptionsByTopic
ListSubscriptionsByTopicResponse
rs
            ListSubscriptionsByTopicResponse
-> Getting (First Text) ListSubscriptionsByTopicResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSubscriptionsByTopicResponse
-> Const (First Text) ListSubscriptionsByTopicResponse
Lens' ListSubscriptionsByTopicResponse (Maybe Text)
listSubscriptionsByTopicResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSubscriptionsByTopicResponse
 -> Const (First Text) ListSubscriptionsByTopicResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSubscriptionsByTopicResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a a' (f :: * -> *).
Applicative f =>
(a -> f a') -> Maybe a -> f (Maybe a')
Lens._Just
        ) =
        Maybe ListSubscriptionsByTopic
forall a. Maybe a
Prelude.Nothing
    | Maybe [Subscription] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSubscriptionsByTopic
ListSubscriptionsByTopicResponse
rs
            ListSubscriptionsByTopicResponse
-> Getting
     (First [Subscription])
     ListSubscriptionsByTopicResponse
     [Subscription]
-> Maybe [Subscription]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Subscription]
 -> Const (First [Subscription]) (Maybe [Subscription]))
-> ListSubscriptionsByTopicResponse
-> Const (First [Subscription]) ListSubscriptionsByTopicResponse
Lens' ListSubscriptionsByTopicResponse (Maybe [Subscription])
listSubscriptionsByTopicResponse_subscriptions
            ((Maybe [Subscription]
  -> Const (First [Subscription]) (Maybe [Subscription]))
 -> ListSubscriptionsByTopicResponse
 -> Const (First [Subscription]) ListSubscriptionsByTopicResponse)
-> (([Subscription] -> Const (First [Subscription]) [Subscription])
    -> Maybe [Subscription]
    -> Const (First [Subscription]) (Maybe [Subscription]))
-> Getting
     (First [Subscription])
     ListSubscriptionsByTopicResponse
     [Subscription]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Subscription] -> Const (First [Subscription]) [Subscription])
-> Maybe [Subscription]
-> Const (First [Subscription]) (Maybe [Subscription])
forall a a' (f :: * -> *).
Applicative f =>
(a -> f a') -> Maybe a -> f (Maybe a')
Lens._Just
        ) =
        Maybe ListSubscriptionsByTopic
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        ListSubscriptionsByTopic -> Maybe ListSubscriptionsByTopic
forall a. a -> Maybe a
Prelude.Just (ListSubscriptionsByTopic -> Maybe ListSubscriptionsByTopic)
-> ListSubscriptionsByTopic -> Maybe ListSubscriptionsByTopic
forall a b. (a -> b) -> a -> b
Prelude.$
          ListSubscriptionsByTopic
rq
            ListSubscriptionsByTopic
-> (ListSubscriptionsByTopic -> ListSubscriptionsByTopic)
-> ListSubscriptionsByTopic
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSubscriptionsByTopic -> Identity ListSubscriptionsByTopic
Lens' ListSubscriptionsByTopic (Maybe Text)
listSubscriptionsByTopic_nextToken
              ((Maybe Text -> Identity (Maybe Text))
 -> ListSubscriptionsByTopic -> Identity ListSubscriptionsByTopic)
-> Maybe Text
-> ListSubscriptionsByTopic
-> ListSubscriptionsByTopic
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSubscriptionsByTopic
ListSubscriptionsByTopicResponse
rs
              ListSubscriptionsByTopicResponse
-> Getting (First Text) ListSubscriptionsByTopicResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSubscriptionsByTopicResponse
-> Const (First Text) ListSubscriptionsByTopicResponse
Lens' ListSubscriptionsByTopicResponse (Maybe Text)
listSubscriptionsByTopicResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSubscriptionsByTopicResponse
 -> Const (First Text) ListSubscriptionsByTopicResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSubscriptionsByTopicResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a a' (f :: * -> *).
Applicative f =>
(a -> f a') -> Maybe a -> f (Maybe a')
Lens._Just

instance Core.AWSRequest ListSubscriptionsByTopic where
  type
    AWSResponse ListSubscriptionsByTopic =
      ListSubscriptionsByTopicResponse
  request :: (Service -> Service)
-> ListSubscriptionsByTopic -> Request ListSubscriptionsByTopic
request Service -> Service
overrides =
    Service
-> ListSubscriptionsByTopic -> Request ListSubscriptionsByTopic
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 =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListSubscriptionsByTopic))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListSubscriptionsByTopic
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSubscriptionsByTopic)))
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'
            (Maybe Text
 -> Maybe [Subscription] -> Int -> ListSubscriptionsByTopicResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [Subscription] -> Int -> ListSubscriptionsByTopicResponse)
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)
Data..@? Text
"NextToken")
            Either
  String
  (Maybe [Subscription] -> Int -> ListSubscriptionsByTopicResponse)
-> Either String (Maybe [Subscription])
-> Either String (Int -> ListSubscriptionsByTopicResponse)
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Subscriptions" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [Subscription]))
-> Either String (Maybe [Subscription])
forall a b.
Either String a -> (a -> Either String b) -> Either String b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Subscription])
-> [Node] -> Either String (Maybe [Subscription])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Subscription]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            Either String (Int -> ListSubscriptionsByTopicResponse)
-> Either String Int
-> Either String ListSubscriptionsByTopicResponse
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall a. a -> Either String a
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 ListSubscriptionsByTopic where
  hashWithSalt :: Int -> ListSubscriptionsByTopic -> Int
hashWithSalt Int
_salt ListSubscriptionsByTopic' {Maybe Text
Text
nextToken :: ListSubscriptionsByTopic -> Maybe Text
topicArn :: ListSubscriptionsByTopic -> Text
nextToken :: Maybe Text
topicArn :: Text
..} =
    Int
_salt
      Int -> Maybe Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
topicArn

instance Prelude.NFData ListSubscriptionsByTopic where
  rnf :: ListSubscriptionsByTopic -> ()
rnf ListSubscriptionsByTopic' {Maybe Text
Text
nextToken :: ListSubscriptionsByTopic -> Maybe Text
topicArn :: ListSubscriptionsByTopic -> Text
nextToken :: Maybe Text
topicArn :: Text
..} =
    Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq`
      Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Text
topicArn

instance Data.ToHeaders ListSubscriptionsByTopic where
  toHeaders :: ListSubscriptionsByTopic -> ResponseHeaders
toHeaders = ResponseHeaders -> ListSubscriptionsByTopic -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ListSubscriptionsByTopic where
  toPath :: ListSubscriptionsByTopic -> ByteString
toPath = ByteString -> ListSubscriptionsByTopic -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ListSubscriptionsByTopic where
  toQuery :: ListSubscriptionsByTopic -> QueryString
toQuery ListSubscriptionsByTopic' {Maybe Text
Text
nextToken :: ListSubscriptionsByTopic -> Maybe Text
topicArn :: ListSubscriptionsByTopic -> Text
nextToken :: Maybe Text
topicArn :: Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListSubscriptionsByTopic" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"TopicArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
topicArn
      ]

-- | Response for ListSubscriptionsByTopic action.
--
-- /See:/ 'newListSubscriptionsByTopicResponse' smart constructor.
data ListSubscriptionsByTopicResponse = ListSubscriptionsByTopicResponse'
  { -- | Token to pass along to the next @ListSubscriptionsByTopic@ request. This
    -- element is returned if there are more subscriptions to retrieve.
    ListSubscriptionsByTopicResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of subscriptions.
    ListSubscriptionsByTopicResponse -> Maybe [Subscription]
subscriptions :: Prelude.Maybe [Subscription],
    -- | The response's http status code.
    ListSubscriptionsByTopicResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
(ListSubscriptionsByTopicResponse
 -> ListSubscriptionsByTopicResponse -> Bool)
-> (ListSubscriptionsByTopicResponse
    -> ListSubscriptionsByTopicResponse -> Bool)
-> Eq ListSubscriptionsByTopicResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
== :: ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
$c/= :: ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
/= :: ListSubscriptionsByTopicResponse
-> ListSubscriptionsByTopicResponse -> Bool
Prelude.Eq, ReadPrec [ListSubscriptionsByTopicResponse]
ReadPrec ListSubscriptionsByTopicResponse
Int -> ReadS ListSubscriptionsByTopicResponse
ReadS [ListSubscriptionsByTopicResponse]
(Int -> ReadS ListSubscriptionsByTopicResponse)
-> ReadS [ListSubscriptionsByTopicResponse]
-> ReadPrec ListSubscriptionsByTopicResponse
-> ReadPrec [ListSubscriptionsByTopicResponse]
-> Read ListSubscriptionsByTopicResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ListSubscriptionsByTopicResponse
readsPrec :: Int -> ReadS ListSubscriptionsByTopicResponse
$creadList :: ReadS [ListSubscriptionsByTopicResponse]
readList :: ReadS [ListSubscriptionsByTopicResponse]
$creadPrec :: ReadPrec ListSubscriptionsByTopicResponse
readPrec :: ReadPrec ListSubscriptionsByTopicResponse
$creadListPrec :: ReadPrec [ListSubscriptionsByTopicResponse]
readListPrec :: ReadPrec [ListSubscriptionsByTopicResponse]
Prelude.Read, Int -> ListSubscriptionsByTopicResponse -> ShowS
[ListSubscriptionsByTopicResponse] -> ShowS
ListSubscriptionsByTopicResponse -> String
(Int -> ListSubscriptionsByTopicResponse -> ShowS)
-> (ListSubscriptionsByTopicResponse -> String)
-> ([ListSubscriptionsByTopicResponse] -> ShowS)
-> Show ListSubscriptionsByTopicResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListSubscriptionsByTopicResponse -> ShowS
showsPrec :: Int -> ListSubscriptionsByTopicResponse -> ShowS
$cshow :: ListSubscriptionsByTopicResponse -> String
show :: ListSubscriptionsByTopicResponse -> String
$cshowList :: [ListSubscriptionsByTopicResponse] -> ShowS
showList :: [ListSubscriptionsByTopicResponse] -> ShowS
Prelude.Show, (forall x.
 ListSubscriptionsByTopicResponse
 -> Rep ListSubscriptionsByTopicResponse x)
-> (forall x.
    Rep ListSubscriptionsByTopicResponse x
    -> ListSubscriptionsByTopicResponse)
-> Generic ListSubscriptionsByTopicResponse
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
$cfrom :: forall x.
ListSubscriptionsByTopicResponse
-> Rep ListSubscriptionsByTopicResponse x
from :: forall x.
ListSubscriptionsByTopicResponse
-> Rep ListSubscriptionsByTopicResponse x
$cto :: forall x.
Rep ListSubscriptionsByTopicResponse x
-> ListSubscriptionsByTopicResponse
to :: forall x.
Rep ListSubscriptionsByTopicResponse x
-> ListSubscriptionsByTopicResponse
Prelude.Generic)

-- |
-- Create a value of 'ListSubscriptionsByTopicResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listSubscriptionsByTopicResponse_nextToken' - Token to pass along to the next @ListSubscriptionsByTopic@ request. This
-- element is returned if there are more subscriptions to retrieve.
--
-- 'subscriptions', 'listSubscriptionsByTopicResponse_subscriptions' - A list of subscriptions.
--
-- 'httpStatus', 'listSubscriptionsByTopicResponse_httpStatus' - The response's http status code.
newListSubscriptionsByTopicResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSubscriptionsByTopicResponse
newListSubscriptionsByTopicResponse :: Int -> ListSubscriptionsByTopicResponse
newListSubscriptionsByTopicResponse Int
pHttpStatus_ =
  ListSubscriptionsByTopicResponse'
    { nextToken :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      subscriptions :: Maybe [Subscription]
subscriptions = Maybe [Subscription]
forall a. Maybe a
Prelude.Nothing,
      httpStatus :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Token to pass along to the next @ListSubscriptionsByTopic@ request. This
-- element is returned if there are more subscriptions to retrieve.
listSubscriptionsByTopicResponse_nextToken :: Lens.Lens' ListSubscriptionsByTopicResponse (Prelude.Maybe Prelude.Text)
listSubscriptionsByTopicResponse_nextToken :: Lens' ListSubscriptionsByTopicResponse (Maybe Text)
listSubscriptionsByTopicResponse_nextToken = (ListSubscriptionsByTopicResponse -> Maybe Text)
-> (ListSubscriptionsByTopicResponse
    -> Maybe Text -> ListSubscriptionsByTopicResponse)
-> Lens' ListSubscriptionsByTopicResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopicResponse' {Maybe Text
nextToken :: ListSubscriptionsByTopicResponse -> Maybe Text
nextToken :: Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSubscriptionsByTopicResponse
s@ListSubscriptionsByTopicResponse' {} Maybe Text
a -> ListSubscriptionsByTopicResponse
s {nextToken = a} :: ListSubscriptionsByTopicResponse)

-- | A list of subscriptions.
listSubscriptionsByTopicResponse_subscriptions :: Lens.Lens' ListSubscriptionsByTopicResponse (Prelude.Maybe [Subscription])
listSubscriptionsByTopicResponse_subscriptions :: Lens' ListSubscriptionsByTopicResponse (Maybe [Subscription])
listSubscriptionsByTopicResponse_subscriptions = (ListSubscriptionsByTopicResponse -> Maybe [Subscription])
-> (ListSubscriptionsByTopicResponse
    -> Maybe [Subscription] -> ListSubscriptionsByTopicResponse)
-> Lens' ListSubscriptionsByTopicResponse (Maybe [Subscription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopicResponse' {Maybe [Subscription]
subscriptions :: ListSubscriptionsByTopicResponse -> Maybe [Subscription]
subscriptions :: Maybe [Subscription]
subscriptions} -> Maybe [Subscription]
subscriptions) (\s :: ListSubscriptionsByTopicResponse
s@ListSubscriptionsByTopicResponse' {} Maybe [Subscription]
a -> ListSubscriptionsByTopicResponse
s {subscriptions = a} :: ListSubscriptionsByTopicResponse) ((Maybe [Subscription] -> f (Maybe [Subscription]))
 -> ListSubscriptionsByTopicResponse
 -> f ListSubscriptionsByTopicResponse)
-> ((Maybe [Subscription] -> f (Maybe [Subscription]))
    -> Maybe [Subscription] -> f (Maybe [Subscription]))
-> (Maybe [Subscription] -> f (Maybe [Subscription]))
-> ListSubscriptionsByTopicResponse
-> f ListSubscriptionsByTopicResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Subscription] [Subscription] [Subscription] [Subscription]
-> Iso
     (Maybe [Subscription])
     (Maybe [Subscription])
     (Maybe [Subscription])
     (Maybe [Subscription])
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 AnIso [Subscription] [Subscription] [Subscription] [Subscription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Iso [Subscription] [Subscription] [Subscription] [Subscription]
Lens.coerced

-- | The response's http status code.
listSubscriptionsByTopicResponse_httpStatus :: Lens.Lens' ListSubscriptionsByTopicResponse Prelude.Int
listSubscriptionsByTopicResponse_httpStatus :: Lens' ListSubscriptionsByTopicResponse Int
listSubscriptionsByTopicResponse_httpStatus = (ListSubscriptionsByTopicResponse -> Int)
-> (ListSubscriptionsByTopicResponse
    -> Int -> ListSubscriptionsByTopicResponse)
-> Lens' ListSubscriptionsByTopicResponse Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionsByTopicResponse' {Int
httpStatus :: ListSubscriptionsByTopicResponse -> Int
httpStatus :: Int
httpStatus} -> Int
httpStatus) (\s :: ListSubscriptionsByTopicResponse
s@ListSubscriptionsByTopicResponse' {} Int
a -> ListSubscriptionsByTopicResponse
s {httpStatus = a} :: ListSubscriptionsByTopicResponse)

instance
  Prelude.NFData
    ListSubscriptionsByTopicResponse
  where
  rnf :: ListSubscriptionsByTopicResponse -> ()
rnf ListSubscriptionsByTopicResponse' {Int
Maybe [Subscription]
Maybe Text
nextToken :: ListSubscriptionsByTopicResponse -> Maybe Text
subscriptions :: ListSubscriptionsByTopicResponse -> Maybe [Subscription]
httpStatus :: ListSubscriptionsByTopicResponse -> Int
nextToken :: Maybe Text
subscriptions :: Maybe [Subscription]
httpStatus :: Int
..} =
    Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq`
      Maybe [Subscription] -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Subscription]
subscriptions () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq`
        Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus