{-# 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.IoTData.ListRetainedMessages
-- 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)
--
-- Lists summary information about the retained messages stored for the
-- account.
--
-- This action returns only the topic names of the retained messages. It
-- doesn\'t return any message payloads. Although this action doesn\'t
-- return a message payload, it can still incur messaging costs.
--
-- To get the message payload of a retained message, call
-- <https://docs.aws.amazon.com/iot/latest/developerguide/API_iotdata_GetRetainedMessage.html GetRetainedMessage>
-- with the topic name of the retained message.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiotfleethubfordevicemanagement.html#awsiotfleethubfordevicemanagement-actions-as-permissions ListRetainedMessages>
-- action.
--
-- For more information about messaging costs, see
-- <http://aws.amazon.com/iot-core/pricing/#Messaging IoT Core pricing - Messaging>.
--
-- This operation returns paginated results.
module Amazonka.IoTData.ListRetainedMessages
  ( -- * Creating a Request
    ListRetainedMessages (..),
    newListRetainedMessages,

    -- * Request Lenses
    listRetainedMessages_nextToken,
    listRetainedMessages_maxResults,

    -- * Destructuring the Response
    ListRetainedMessagesResponse (..),
    newListRetainedMessagesResponse,

    -- * Response Lenses
    listRetainedMessagesResponse_retainedTopics,
    listRetainedMessagesResponse_nextToken,
    listRetainedMessagesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTData.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListRetainedMessages' smart constructor.
data ListRetainedMessages = ListRetainedMessages'
  { -- | To retrieve the next set of results, the @nextToken@ value from a
    -- previous response; otherwise __null__ to receive the first set of
    -- results.
    ListRetainedMessages -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return at one time.
    ListRetainedMessages -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListRetainedMessages -> ListRetainedMessages -> Bool
(ListRetainedMessages -> ListRetainedMessages -> Bool)
-> (ListRetainedMessages -> ListRetainedMessages -> Bool)
-> Eq ListRetainedMessages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRetainedMessages -> ListRetainedMessages -> Bool
$c/= :: ListRetainedMessages -> ListRetainedMessages -> Bool
== :: ListRetainedMessages -> ListRetainedMessages -> Bool
$c== :: ListRetainedMessages -> ListRetainedMessages -> Bool
Prelude.Eq, ReadPrec [ListRetainedMessages]
ReadPrec ListRetainedMessages
Int -> ReadS ListRetainedMessages
ReadS [ListRetainedMessages]
(Int -> ReadS ListRetainedMessages)
-> ReadS [ListRetainedMessages]
-> ReadPrec ListRetainedMessages
-> ReadPrec [ListRetainedMessages]
-> Read ListRetainedMessages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRetainedMessages]
$creadListPrec :: ReadPrec [ListRetainedMessages]
readPrec :: ReadPrec ListRetainedMessages
$creadPrec :: ReadPrec ListRetainedMessages
readList :: ReadS [ListRetainedMessages]
$creadList :: ReadS [ListRetainedMessages]
readsPrec :: Int -> ReadS ListRetainedMessages
$creadsPrec :: Int -> ReadS ListRetainedMessages
Prelude.Read, Int -> ListRetainedMessages -> ShowS
[ListRetainedMessages] -> ShowS
ListRetainedMessages -> String
(Int -> ListRetainedMessages -> ShowS)
-> (ListRetainedMessages -> String)
-> ([ListRetainedMessages] -> ShowS)
-> Show ListRetainedMessages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRetainedMessages] -> ShowS
$cshowList :: [ListRetainedMessages] -> ShowS
show :: ListRetainedMessages -> String
$cshow :: ListRetainedMessages -> String
showsPrec :: Int -> ListRetainedMessages -> ShowS
$cshowsPrec :: Int -> ListRetainedMessages -> ShowS
Prelude.Show, (forall x. ListRetainedMessages -> Rep ListRetainedMessages x)
-> (forall x. Rep ListRetainedMessages x -> ListRetainedMessages)
-> Generic ListRetainedMessages
forall x. Rep ListRetainedMessages x -> ListRetainedMessages
forall x. ListRetainedMessages -> Rep ListRetainedMessages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRetainedMessages x -> ListRetainedMessages
$cfrom :: forall x. ListRetainedMessages -> Rep ListRetainedMessages x
Prelude.Generic)

-- |
-- Create a value of 'ListRetainedMessages' 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', 'listRetainedMessages_nextToken' - To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
--
-- 'maxResults', 'listRetainedMessages_maxResults' - The maximum number of results to return at one time.
newListRetainedMessages ::
  ListRetainedMessages
newListRetainedMessages :: ListRetainedMessages
newListRetainedMessages =
  ListRetainedMessages' :: Maybe Text -> Maybe Natural -> ListRetainedMessages
ListRetainedMessages'
    { $sel:nextToken:ListRetainedMessages' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListRetainedMessages' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
listRetainedMessages_nextToken :: Lens.Lens' ListRetainedMessages (Prelude.Maybe Prelude.Text)
listRetainedMessages_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRetainedMessages -> f ListRetainedMessages
listRetainedMessages_nextToken = (ListRetainedMessages -> Maybe Text)
-> (ListRetainedMessages -> Maybe Text -> ListRetainedMessages)
-> Lens
     ListRetainedMessages ListRetainedMessages (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRetainedMessages' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRetainedMessages' :: ListRetainedMessages -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRetainedMessages
s@ListRetainedMessages' {} Maybe Text
a -> ListRetainedMessages
s {$sel:nextToken:ListRetainedMessages' :: Maybe Text
nextToken = Maybe Text
a} :: ListRetainedMessages)

-- | The maximum number of results to return at one time.
listRetainedMessages_maxResults :: Lens.Lens' ListRetainedMessages (Prelude.Maybe Prelude.Natural)
listRetainedMessages_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListRetainedMessages -> f ListRetainedMessages
listRetainedMessages_maxResults = (ListRetainedMessages -> Maybe Natural)
-> (ListRetainedMessages -> Maybe Natural -> ListRetainedMessages)
-> Lens
     ListRetainedMessages
     ListRetainedMessages
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRetainedMessages' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListRetainedMessages' :: ListRetainedMessages -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListRetainedMessages
s@ListRetainedMessages' {} Maybe Natural
a -> ListRetainedMessages
s {$sel:maxResults:ListRetainedMessages' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListRetainedMessages)

instance Core.AWSPager ListRetainedMessages where
  page :: ListRetainedMessages
-> AWSResponse ListRetainedMessages -> Maybe ListRetainedMessages
page ListRetainedMessages
rq AWSResponse ListRetainedMessages
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRetainedMessages
ListRetainedMessagesResponse
rs
            ListRetainedMessagesResponse
-> Getting (First Text) ListRetainedMessagesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRetainedMessagesResponse
-> Const (First Text) ListRetainedMessagesResponse
Lens' ListRetainedMessagesResponse (Maybe Text)
listRetainedMessagesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRetainedMessagesResponse
 -> Const (First Text) ListRetainedMessagesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRetainedMessagesResponse 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 ListRetainedMessages
forall a. Maybe a
Prelude.Nothing
    | Maybe [RetainedMessageSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRetainedMessages
ListRetainedMessagesResponse
rs
            ListRetainedMessagesResponse
-> Getting
     (First [RetainedMessageSummary])
     ListRetainedMessagesResponse
     [RetainedMessageSummary]
-> Maybe [RetainedMessageSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RetainedMessageSummary]
 -> Const
      (First [RetainedMessageSummary]) (Maybe [RetainedMessageSummary]))
-> ListRetainedMessagesResponse
-> Const
     (First [RetainedMessageSummary]) ListRetainedMessagesResponse
Lens' ListRetainedMessagesResponse (Maybe [RetainedMessageSummary])
listRetainedMessagesResponse_retainedTopics
              ((Maybe [RetainedMessageSummary]
  -> Const
       (First [RetainedMessageSummary]) (Maybe [RetainedMessageSummary]))
 -> ListRetainedMessagesResponse
 -> Const
      (First [RetainedMessageSummary]) ListRetainedMessagesResponse)
-> (([RetainedMessageSummary]
     -> Const (First [RetainedMessageSummary]) [RetainedMessageSummary])
    -> Maybe [RetainedMessageSummary]
    -> Const
         (First [RetainedMessageSummary]) (Maybe [RetainedMessageSummary]))
-> Getting
     (First [RetainedMessageSummary])
     ListRetainedMessagesResponse
     [RetainedMessageSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RetainedMessageSummary]
 -> Const (First [RetainedMessageSummary]) [RetainedMessageSummary])
-> Maybe [RetainedMessageSummary]
-> Const
     (First [RetainedMessageSummary]) (Maybe [RetainedMessageSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRetainedMessages
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListRetainedMessages -> Maybe ListRetainedMessages
forall a. a -> Maybe a
Prelude.Just (ListRetainedMessages -> Maybe ListRetainedMessages)
-> ListRetainedMessages -> Maybe ListRetainedMessages
forall a b. (a -> b) -> a -> b
Prelude.$
        ListRetainedMessages
rq
          ListRetainedMessages
-> (ListRetainedMessages -> ListRetainedMessages)
-> ListRetainedMessages
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListRetainedMessages -> Identity ListRetainedMessages
Lens
  ListRetainedMessages ListRetainedMessages (Maybe Text) (Maybe Text)
listRetainedMessages_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListRetainedMessages -> Identity ListRetainedMessages)
-> Maybe Text -> ListRetainedMessages -> ListRetainedMessages
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRetainedMessages
ListRetainedMessagesResponse
rs
          ListRetainedMessagesResponse
-> Getting (First Text) ListRetainedMessagesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRetainedMessagesResponse
-> Const (First Text) ListRetainedMessagesResponse
Lens' ListRetainedMessagesResponse (Maybe Text)
listRetainedMessagesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRetainedMessagesResponse
 -> Const (First Text) ListRetainedMessagesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRetainedMessagesResponse 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 ListRetainedMessages where
  type
    AWSResponse ListRetainedMessages =
      ListRetainedMessagesResponse
  request :: ListRetainedMessages -> Request ListRetainedMessages
request = Service -> ListRetainedMessages -> Request ListRetainedMessages
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListRetainedMessages
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRetainedMessages)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListRetainedMessages))
-> Logger
-> Service
-> Proxy ListRetainedMessages
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRetainedMessages)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [RetainedMessageSummary]
-> Maybe Text -> Int -> ListRetainedMessagesResponse
ListRetainedMessagesResponse'
            (Maybe [RetainedMessageSummary]
 -> Maybe Text -> Int -> ListRetainedMessagesResponse)
-> Either String (Maybe [RetainedMessageSummary])
-> Either
     String (Maybe Text -> Int -> ListRetainedMessagesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [RetainedMessageSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"retainedTopics" Either String (Maybe (Maybe [RetainedMessageSummary]))
-> Maybe [RetainedMessageSummary]
-> Either String (Maybe [RetainedMessageSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RetainedMessageSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListRetainedMessagesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListRetainedMessagesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Int -> ListRetainedMessagesResponse)
-> Either String Int -> Either String ListRetainedMessagesResponse
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 ListRetainedMessages

instance Prelude.NFData ListRetainedMessages

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

instance Core.ToPath ListRetainedMessages where
  toPath :: ListRetainedMessages -> ByteString
toPath = ByteString -> ListRetainedMessages -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/retainedMessage"

instance Core.ToQuery ListRetainedMessages where
  toQuery :: ListRetainedMessages -> QueryString
toQuery ListRetainedMessages' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListRetainedMessages' :: ListRetainedMessages -> Maybe Natural
$sel:nextToken:ListRetainedMessages' :: ListRetainedMessages -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListRetainedMessagesResponse' smart constructor.
data ListRetainedMessagesResponse = ListRetainedMessagesResponse'
  { -- | A summary list the account\'s retained messages. The information
    -- returned doesn\'t include the message payloads of the retained messages.
    ListRetainedMessagesResponse -> Maybe [RetainedMessageSummary]
retainedTopics :: Prelude.Maybe [RetainedMessageSummary],
    -- | The token for the next set of results, or null if there are no
    -- additional results.
    ListRetainedMessagesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListRetainedMessagesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListRetainedMessagesResponse
-> ListRetainedMessagesResponse -> Bool
(ListRetainedMessagesResponse
 -> ListRetainedMessagesResponse -> Bool)
-> (ListRetainedMessagesResponse
    -> ListRetainedMessagesResponse -> Bool)
-> Eq ListRetainedMessagesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRetainedMessagesResponse
-> ListRetainedMessagesResponse -> Bool
$c/= :: ListRetainedMessagesResponse
-> ListRetainedMessagesResponse -> Bool
== :: ListRetainedMessagesResponse
-> ListRetainedMessagesResponse -> Bool
$c== :: ListRetainedMessagesResponse
-> ListRetainedMessagesResponse -> Bool
Prelude.Eq, ReadPrec [ListRetainedMessagesResponse]
ReadPrec ListRetainedMessagesResponse
Int -> ReadS ListRetainedMessagesResponse
ReadS [ListRetainedMessagesResponse]
(Int -> ReadS ListRetainedMessagesResponse)
-> ReadS [ListRetainedMessagesResponse]
-> ReadPrec ListRetainedMessagesResponse
-> ReadPrec [ListRetainedMessagesResponse]
-> Read ListRetainedMessagesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRetainedMessagesResponse]
$creadListPrec :: ReadPrec [ListRetainedMessagesResponse]
readPrec :: ReadPrec ListRetainedMessagesResponse
$creadPrec :: ReadPrec ListRetainedMessagesResponse
readList :: ReadS [ListRetainedMessagesResponse]
$creadList :: ReadS [ListRetainedMessagesResponse]
readsPrec :: Int -> ReadS ListRetainedMessagesResponse
$creadsPrec :: Int -> ReadS ListRetainedMessagesResponse
Prelude.Read, Int -> ListRetainedMessagesResponse -> ShowS
[ListRetainedMessagesResponse] -> ShowS
ListRetainedMessagesResponse -> String
(Int -> ListRetainedMessagesResponse -> ShowS)
-> (ListRetainedMessagesResponse -> String)
-> ([ListRetainedMessagesResponse] -> ShowS)
-> Show ListRetainedMessagesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRetainedMessagesResponse] -> ShowS
$cshowList :: [ListRetainedMessagesResponse] -> ShowS
show :: ListRetainedMessagesResponse -> String
$cshow :: ListRetainedMessagesResponse -> String
showsPrec :: Int -> ListRetainedMessagesResponse -> ShowS
$cshowsPrec :: Int -> ListRetainedMessagesResponse -> ShowS
Prelude.Show, (forall x.
 ListRetainedMessagesResponse -> Rep ListRetainedMessagesResponse x)
-> (forall x.
    Rep ListRetainedMessagesResponse x -> ListRetainedMessagesResponse)
-> Generic ListRetainedMessagesResponse
forall x.
Rep ListRetainedMessagesResponse x -> ListRetainedMessagesResponse
forall x.
ListRetainedMessagesResponse -> Rep ListRetainedMessagesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRetainedMessagesResponse x -> ListRetainedMessagesResponse
$cfrom :: forall x.
ListRetainedMessagesResponse -> Rep ListRetainedMessagesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRetainedMessagesResponse' 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:
--
-- 'retainedTopics', 'listRetainedMessagesResponse_retainedTopics' - A summary list the account\'s retained messages. The information
-- returned doesn\'t include the message payloads of the retained messages.
--
-- 'nextToken', 'listRetainedMessagesResponse_nextToken' - The token for the next set of results, or null if there are no
-- additional results.
--
-- 'httpStatus', 'listRetainedMessagesResponse_httpStatus' - The response's http status code.
newListRetainedMessagesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRetainedMessagesResponse
newListRetainedMessagesResponse :: Int -> ListRetainedMessagesResponse
newListRetainedMessagesResponse Int
pHttpStatus_ =
  ListRetainedMessagesResponse' :: Maybe [RetainedMessageSummary]
-> Maybe Text -> Int -> ListRetainedMessagesResponse
ListRetainedMessagesResponse'
    { $sel:retainedTopics:ListRetainedMessagesResponse' :: Maybe [RetainedMessageSummary]
retainedTopics =
        Maybe [RetainedMessageSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRetainedMessagesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRetainedMessagesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A summary list the account\'s retained messages. The information
-- returned doesn\'t include the message payloads of the retained messages.
listRetainedMessagesResponse_retainedTopics :: Lens.Lens' ListRetainedMessagesResponse (Prelude.Maybe [RetainedMessageSummary])
listRetainedMessagesResponse_retainedTopics :: (Maybe [RetainedMessageSummary]
 -> f (Maybe [RetainedMessageSummary]))
-> ListRetainedMessagesResponse -> f ListRetainedMessagesResponse
listRetainedMessagesResponse_retainedTopics = (ListRetainedMessagesResponse -> Maybe [RetainedMessageSummary])
-> (ListRetainedMessagesResponse
    -> Maybe [RetainedMessageSummary] -> ListRetainedMessagesResponse)
-> Lens'
     ListRetainedMessagesResponse (Maybe [RetainedMessageSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRetainedMessagesResponse' {Maybe [RetainedMessageSummary]
retainedTopics :: Maybe [RetainedMessageSummary]
$sel:retainedTopics:ListRetainedMessagesResponse' :: ListRetainedMessagesResponse -> Maybe [RetainedMessageSummary]
retainedTopics} -> Maybe [RetainedMessageSummary]
retainedTopics) (\s :: ListRetainedMessagesResponse
s@ListRetainedMessagesResponse' {} Maybe [RetainedMessageSummary]
a -> ListRetainedMessagesResponse
s {$sel:retainedTopics:ListRetainedMessagesResponse' :: Maybe [RetainedMessageSummary]
retainedTopics = Maybe [RetainedMessageSummary]
a} :: ListRetainedMessagesResponse) ((Maybe [RetainedMessageSummary]
  -> f (Maybe [RetainedMessageSummary]))
 -> ListRetainedMessagesResponse -> f ListRetainedMessagesResponse)
-> ((Maybe [RetainedMessageSummary]
     -> f (Maybe [RetainedMessageSummary]))
    -> Maybe [RetainedMessageSummary]
    -> f (Maybe [RetainedMessageSummary]))
-> (Maybe [RetainedMessageSummary]
    -> f (Maybe [RetainedMessageSummary]))
-> ListRetainedMessagesResponse
-> f ListRetainedMessagesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RetainedMessageSummary]
  [RetainedMessageSummary]
  [RetainedMessageSummary]
  [RetainedMessageSummary]
-> Iso
     (Maybe [RetainedMessageSummary])
     (Maybe [RetainedMessageSummary])
     (Maybe [RetainedMessageSummary])
     (Maybe [RetainedMessageSummary])
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
  [RetainedMessageSummary]
  [RetainedMessageSummary]
  [RetainedMessageSummary]
  [RetainedMessageSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of results, or null if there are no
-- additional results.
listRetainedMessagesResponse_nextToken :: Lens.Lens' ListRetainedMessagesResponse (Prelude.Maybe Prelude.Text)
listRetainedMessagesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRetainedMessagesResponse -> f ListRetainedMessagesResponse
listRetainedMessagesResponse_nextToken = (ListRetainedMessagesResponse -> Maybe Text)
-> (ListRetainedMessagesResponse
    -> Maybe Text -> ListRetainedMessagesResponse)
-> Lens' ListRetainedMessagesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRetainedMessagesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRetainedMessagesResponse' :: ListRetainedMessagesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRetainedMessagesResponse
s@ListRetainedMessagesResponse' {} Maybe Text
a -> ListRetainedMessagesResponse
s {$sel:nextToken:ListRetainedMessagesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRetainedMessagesResponse)

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

instance Prelude.NFData ListRetainedMessagesResponse