{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.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

-- | 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
/= :: 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]
(Int -> ReadS ListSubscriptionsByTopic)
-> ReadS [ListSubscriptionsByTopic]
-> ReadPrec ListSubscriptionsByTopic
-> ReadPrec [ListSubscriptionsByTopic]
-> Read 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
(Int -> ListSubscriptionsByTopic -> ShowS)
-> (ListSubscriptionsByTopic -> String)
-> ([ListSubscriptionsByTopic] -> ShowS)
-> Show ListSubscriptionsByTopic
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.
 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
$cto :: forall x.
Rep ListSubscriptionsByTopic x -> ListSubscriptionsByTopic
$cfrom :: forall x.
ListSubscriptionsByTopic -> Rep ListSubscriptionsByTopic x
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' :: Maybe Text -> Text -> ListSubscriptionsByTopic
ListSubscriptionsByTopic'
    { $sel:nextToken:ListSubscriptionsByTopic' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:topicArn:ListSubscriptionsByTopic' :: Text
topicArn = Text
pTopicArn_
    }

-- | Token returned by the previous @ListSubscriptionsByTopic@ request.
listSubscriptionsByTopic_nextToken :: Lens.Lens' ListSubscriptionsByTopic (Prelude.Maybe Prelude.Text)
listSubscriptionsByTopic_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSubscriptionsByTopic -> f ListSubscriptionsByTopic
listSubscriptionsByTopic_nextToken = (ListSubscriptionsByTopic -> Maybe Text)
-> (ListSubscriptionsByTopic
    -> Maybe Text -> ListSubscriptionsByTopic)
-> Lens
     ListSubscriptionsByTopic
     ListSubscriptionsByTopic
     (Maybe Text)
     (Maybe Text)
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)

-- | The ARN of the topic for which you wish to find subscriptions.
listSubscriptionsByTopic_topicArn :: Lens.Lens' ListSubscriptionsByTopic Prelude.Text
listSubscriptionsByTopic_topicArn :: (Text -> f Text)
-> ListSubscriptionsByTopic -> f ListSubscriptionsByTopic
listSubscriptionsByTopic_topicArn = (ListSubscriptionsByTopic -> Text)
-> (ListSubscriptionsByTopic -> Text -> ListSubscriptionsByTopic)
-> Lens ListSubscriptionsByTopic ListSubscriptionsByTopic Text Text
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
    | 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 b. Prism (Maybe a) (Maybe b) a b
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 b. Prism (Maybe a) (Maybe b) a b
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
  ListSubscriptionsByTopic
  (Maybe Text)
  (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 b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListSubscriptionsByTopic where
  type
    AWSResponse ListSubscriptionsByTopic =
      ListSubscriptionsByTopicResponse
  request :: ListSubscriptionsByTopic -> Request ListSubscriptionsByTopic
request = Service
-> ListSubscriptionsByTopic -> Request ListSubscriptionsByTopic
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListSubscriptionsByTopic
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSubscriptionsByTopic)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListSubscriptionsByTopic))
-> Logger
-> Service
-> Proxy ListSubscriptionsByTopic
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSubscriptionsByTopic)))
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
"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)
Core..@? Text
"NextToken")
            Either
  String
  (Maybe [Subscription] -> Int -> ListSubscriptionsByTopicResponse)
-> Either String (Maybe [Subscription])
-> Either String (Int -> ListSubscriptionsByTopicResponse)
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)
Core..@? 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 (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]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> ListSubscriptionsByTopicResponse)
-> Either String Int
-> Either String ListSubscriptionsByTopicResponse
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 ListSubscriptionsByTopic

instance Prelude.NFData ListSubscriptionsByTopic

instance Core.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 Core.ToPath ListSubscriptionsByTopic where
  toPath :: ListSubscriptionsByTopic -> ByteString
toPath = ByteString -> ListSubscriptionsByTopic -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.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
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ListSubscriptionsByTopic" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"TopicArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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
/= :: 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]
(Int -> ReadS ListSubscriptionsByTopicResponse)
-> ReadS [ListSubscriptionsByTopicResponse]
-> ReadPrec ListSubscriptionsByTopicResponse
-> ReadPrec [ListSubscriptionsByTopicResponse]
-> Read 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
(Int -> ListSubscriptionsByTopicResponse -> ShowS)
-> (ListSubscriptionsByTopicResponse -> String)
-> ([ListSubscriptionsByTopicResponse] -> ShowS)
-> Show ListSubscriptionsByTopicResponse
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.
 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
$cto :: forall x.
Rep ListSubscriptionsByTopicResponse x
-> ListSubscriptionsByTopicResponse
$cfrom :: forall x.
ListSubscriptionsByTopicResponse
-> Rep ListSubscriptionsByTopicResponse x
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' :: Maybe Text
-> Maybe [Subscription] -> Int -> ListSubscriptionsByTopicResponse
ListSubscriptionsByTopicResponse'
    { $sel:nextToken:ListSubscriptionsByTopicResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subscriptions:ListSubscriptionsByTopicResponse' :: Maybe [Subscription]
subscriptions = Maybe [Subscription]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSubscriptionsByTopicResponse' :: 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 :: (Maybe Text -> f (Maybe Text))
-> ListSubscriptionsByTopicResponse
-> f ListSubscriptionsByTopicResponse
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 :: 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)

-- | A list of subscriptions.
listSubscriptionsByTopicResponse_subscriptions :: Lens.Lens' ListSubscriptionsByTopicResponse (Prelude.Maybe [Subscription])
listSubscriptionsByTopicResponse_subscriptions :: (Maybe [Subscription] -> f (Maybe [Subscription]))
-> ListSubscriptionsByTopicResponse
-> f ListSubscriptionsByTopicResponse
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 :: 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) ((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
Lens.coerced

-- | The response's http status code.
listSubscriptionsByTopicResponse_httpStatus :: Lens.Lens' ListSubscriptionsByTopicResponse Prelude.Int
listSubscriptionsByTopicResponse_httpStatus :: (Int -> f Int)
-> ListSubscriptionsByTopicResponse
-> f ListSubscriptionsByTopicResponse
listSubscriptionsByTopicResponse_httpStatus = (ListSubscriptionsByTopicResponse -> Int)
-> (ListSubscriptionsByTopicResponse
    -> Int -> ListSubscriptionsByTopicResponse)
-> Lens
     ListSubscriptionsByTopicResponse
     ListSubscriptionsByTopicResponse
     Int
     Int
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