{-# 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.IoT.ListTopicRules
-- 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 the rules for the specific topic.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListTopicRules>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListTopicRules
  ( -- * Creating a Request
    ListTopicRules (..),
    newListTopicRules,

    -- * Request Lenses
    listTopicRules_ruleDisabled,
    listTopicRules_topic,
    listTopicRules_nextToken,
    listTopicRules_maxResults,

    -- * Destructuring the Response
    ListTopicRulesResponse (..),
    newListTopicRulesResponse,

    -- * Response Lenses
    listTopicRulesResponse_rules,
    listTopicRulesResponse_nextToken,
    listTopicRulesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.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

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

-- |
-- Create a value of 'ListTopicRules' 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:
--
-- 'ruleDisabled', 'listTopicRules_ruleDisabled' - Specifies whether the rule is disabled.
--
-- 'topic', 'listTopicRules_topic' - The topic.
--
-- 'nextToken', 'listTopicRules_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', 'listTopicRules_maxResults' - The maximum number of results to return.
newListTopicRules ::
  ListTopicRules
newListTopicRules :: ListTopicRules
newListTopicRules =
  ListTopicRules' :: Maybe Bool
-> Maybe Text -> Maybe Text -> Maybe Natural -> ListTopicRules
ListTopicRules'
    { $sel:ruleDisabled:ListTopicRules' :: Maybe Bool
ruleDisabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:topic:ListTopicRules' :: Maybe Text
topic = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTopicRules' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListTopicRules' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether the rule is disabled.
listTopicRules_ruleDisabled :: Lens.Lens' ListTopicRules (Prelude.Maybe Prelude.Bool)
listTopicRules_ruleDisabled :: (Maybe Bool -> f (Maybe Bool))
-> ListTopicRules -> f ListTopicRules
listTopicRules_ruleDisabled = (ListTopicRules -> Maybe Bool)
-> (ListTopicRules -> Maybe Bool -> ListTopicRules)
-> Lens ListTopicRules ListTopicRules (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTopicRules' {Maybe Bool
ruleDisabled :: Maybe Bool
$sel:ruleDisabled:ListTopicRules' :: ListTopicRules -> Maybe Bool
ruleDisabled} -> Maybe Bool
ruleDisabled) (\s :: ListTopicRules
s@ListTopicRules' {} Maybe Bool
a -> ListTopicRules
s {$sel:ruleDisabled:ListTopicRules' :: Maybe Bool
ruleDisabled = Maybe Bool
a} :: ListTopicRules)

-- | The topic.
listTopicRules_topic :: Lens.Lens' ListTopicRules (Prelude.Maybe Prelude.Text)
listTopicRules_topic :: (Maybe Text -> f (Maybe Text))
-> ListTopicRules -> f ListTopicRules
listTopicRules_topic = (ListTopicRules -> Maybe Text)
-> (ListTopicRules -> Maybe Text -> ListTopicRules)
-> Lens ListTopicRules ListTopicRules (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTopicRules' {Maybe Text
topic :: Maybe Text
$sel:topic:ListTopicRules' :: ListTopicRules -> Maybe Text
topic} -> Maybe Text
topic) (\s :: ListTopicRules
s@ListTopicRules' {} Maybe Text
a -> ListTopicRules
s {$sel:topic:ListTopicRules' :: Maybe Text
topic = Maybe Text
a} :: ListTopicRules)

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

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

instance Core.AWSPager ListTopicRules where
  page :: ListTopicRules
-> AWSResponse ListTopicRules -> Maybe ListTopicRules
page ListTopicRules
rq AWSResponse ListTopicRules
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTopicRules
ListTopicRulesResponse
rs
            ListTopicRulesResponse
-> Getting (First Text) ListTopicRulesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTopicRulesResponse
-> Const (First Text) ListTopicRulesResponse
Lens' ListTopicRulesResponse (Maybe Text)
listTopicRulesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTopicRulesResponse
 -> Const (First Text) ListTopicRulesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTopicRulesResponse 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 ListTopicRules
forall a. Maybe a
Prelude.Nothing
    | Maybe [TopicRuleListItem] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTopicRules
ListTopicRulesResponse
rs
            ListTopicRulesResponse
-> Getting
     (First [TopicRuleListItem])
     ListTopicRulesResponse
     [TopicRuleListItem]
-> Maybe [TopicRuleListItem]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [TopicRuleListItem]
 -> Const (First [TopicRuleListItem]) (Maybe [TopicRuleListItem]))
-> ListTopicRulesResponse
-> Const (First [TopicRuleListItem]) ListTopicRulesResponse
Lens' ListTopicRulesResponse (Maybe [TopicRuleListItem])
listTopicRulesResponse_rules ((Maybe [TopicRuleListItem]
  -> Const (First [TopicRuleListItem]) (Maybe [TopicRuleListItem]))
 -> ListTopicRulesResponse
 -> Const (First [TopicRuleListItem]) ListTopicRulesResponse)
-> (([TopicRuleListItem]
     -> Const (First [TopicRuleListItem]) [TopicRuleListItem])
    -> Maybe [TopicRuleListItem]
    -> Const (First [TopicRuleListItem]) (Maybe [TopicRuleListItem]))
-> Getting
     (First [TopicRuleListItem])
     ListTopicRulesResponse
     [TopicRuleListItem]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TopicRuleListItem]
 -> Const (First [TopicRuleListItem]) [TopicRuleListItem])
-> Maybe [TopicRuleListItem]
-> Const (First [TopicRuleListItem]) (Maybe [TopicRuleListItem])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListTopicRules
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListTopicRules -> Maybe ListTopicRules
forall a. a -> Maybe a
Prelude.Just (ListTopicRules -> Maybe ListTopicRules)
-> ListTopicRules -> Maybe ListTopicRules
forall a b. (a -> b) -> a -> b
Prelude.$
        ListTopicRules
rq
          ListTopicRules
-> (ListTopicRules -> ListTopicRules) -> ListTopicRules
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListTopicRules -> Identity ListTopicRules
Lens ListTopicRules ListTopicRules (Maybe Text) (Maybe Text)
listTopicRules_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListTopicRules -> Identity ListTopicRules)
-> Maybe Text -> ListTopicRules -> ListTopicRules
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTopicRules
ListTopicRulesResponse
rs
          ListTopicRulesResponse
-> Getting (First Text) ListTopicRulesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTopicRulesResponse
-> Const (First Text) ListTopicRulesResponse
Lens' ListTopicRulesResponse (Maybe Text)
listTopicRulesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTopicRulesResponse
 -> Const (First Text) ListTopicRulesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTopicRulesResponse 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 ListTopicRules where
  type
    AWSResponse ListTopicRules =
      ListTopicRulesResponse
  request :: ListTopicRules -> Request ListTopicRules
request = Service -> ListTopicRules -> Request ListTopicRules
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListTopicRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTopicRules)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListTopicRules))
-> Logger
-> Service
-> Proxy ListTopicRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTopicRules)))
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 [TopicRuleListItem]
-> Maybe Text -> Int -> ListTopicRulesResponse
ListTopicRulesResponse'
            (Maybe [TopicRuleListItem]
 -> Maybe Text -> Int -> ListTopicRulesResponse)
-> Either String (Maybe [TopicRuleListItem])
-> Either String (Maybe Text -> Int -> ListTopicRulesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [TopicRuleListItem]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"rules" Either String (Maybe (Maybe [TopicRuleListItem]))
-> Maybe [TopicRuleListItem]
-> Either String (Maybe [TopicRuleListItem])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [TopicRuleListItem]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListTopicRulesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListTopicRulesResponse)
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 -> ListTopicRulesResponse)
-> Either String Int -> Either String ListTopicRulesResponse
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 ListTopicRules

instance Prelude.NFData ListTopicRules

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

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

instance Core.ToQuery ListTopicRules where
  toQuery :: ListTopicRules -> QueryString
toQuery ListTopicRules' {Maybe Bool
Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
topic :: Maybe Text
ruleDisabled :: Maybe Bool
$sel:maxResults:ListTopicRules' :: ListTopicRules -> Maybe Natural
$sel:nextToken:ListTopicRules' :: ListTopicRules -> Maybe Text
$sel:topic:ListTopicRules' :: ListTopicRules -> Maybe Text
$sel:ruleDisabled:ListTopicRules' :: ListTopicRules -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"ruleDisabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
ruleDisabled,
        ByteString
"topic" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
topic,
        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
      ]

-- | The output from the ListTopicRules operation.
--
-- /See:/ 'newListTopicRulesResponse' smart constructor.
data ListTopicRulesResponse = ListTopicRulesResponse'
  { -- | The rules.
    ListTopicRulesResponse -> Maybe [TopicRuleListItem]
rules :: Prelude.Maybe [TopicRuleListItem],
    -- | The token to use to get the next set of results, or __null__ if there
    -- are no additional results.
    ListTopicRulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListTopicRulesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListTopicRulesResponse -> ListTopicRulesResponse -> Bool
(ListTopicRulesResponse -> ListTopicRulesResponse -> Bool)
-> (ListTopicRulesResponse -> ListTopicRulesResponse -> Bool)
-> Eq ListTopicRulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTopicRulesResponse -> ListTopicRulesResponse -> Bool
$c/= :: ListTopicRulesResponse -> ListTopicRulesResponse -> Bool
== :: ListTopicRulesResponse -> ListTopicRulesResponse -> Bool
$c== :: ListTopicRulesResponse -> ListTopicRulesResponse -> Bool
Prelude.Eq, ReadPrec [ListTopicRulesResponse]
ReadPrec ListTopicRulesResponse
Int -> ReadS ListTopicRulesResponse
ReadS [ListTopicRulesResponse]
(Int -> ReadS ListTopicRulesResponse)
-> ReadS [ListTopicRulesResponse]
-> ReadPrec ListTopicRulesResponse
-> ReadPrec [ListTopicRulesResponse]
-> Read ListTopicRulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTopicRulesResponse]
$creadListPrec :: ReadPrec [ListTopicRulesResponse]
readPrec :: ReadPrec ListTopicRulesResponse
$creadPrec :: ReadPrec ListTopicRulesResponse
readList :: ReadS [ListTopicRulesResponse]
$creadList :: ReadS [ListTopicRulesResponse]
readsPrec :: Int -> ReadS ListTopicRulesResponse
$creadsPrec :: Int -> ReadS ListTopicRulesResponse
Prelude.Read, Int -> ListTopicRulesResponse -> ShowS
[ListTopicRulesResponse] -> ShowS
ListTopicRulesResponse -> String
(Int -> ListTopicRulesResponse -> ShowS)
-> (ListTopicRulesResponse -> String)
-> ([ListTopicRulesResponse] -> ShowS)
-> Show ListTopicRulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTopicRulesResponse] -> ShowS
$cshowList :: [ListTopicRulesResponse] -> ShowS
show :: ListTopicRulesResponse -> String
$cshow :: ListTopicRulesResponse -> String
showsPrec :: Int -> ListTopicRulesResponse -> ShowS
$cshowsPrec :: Int -> ListTopicRulesResponse -> ShowS
Prelude.Show, (forall x. ListTopicRulesResponse -> Rep ListTopicRulesResponse x)
-> (forall x.
    Rep ListTopicRulesResponse x -> ListTopicRulesResponse)
-> Generic ListTopicRulesResponse
forall x. Rep ListTopicRulesResponse x -> ListTopicRulesResponse
forall x. ListTopicRulesResponse -> Rep ListTopicRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTopicRulesResponse x -> ListTopicRulesResponse
$cfrom :: forall x. ListTopicRulesResponse -> Rep ListTopicRulesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListTopicRulesResponse' 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:
--
-- 'rules', 'listTopicRulesResponse_rules' - The rules.
--
-- 'nextToken', 'listTopicRulesResponse_nextToken' - The token to use to get the next set of results, or __null__ if there
-- are no additional results.
--
-- 'httpStatus', 'listTopicRulesResponse_httpStatus' - The response's http status code.
newListTopicRulesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTopicRulesResponse
newListTopicRulesResponse :: Int -> ListTopicRulesResponse
newListTopicRulesResponse Int
pHttpStatus_ =
  ListTopicRulesResponse' :: Maybe [TopicRuleListItem]
-> Maybe Text -> Int -> ListTopicRulesResponse
ListTopicRulesResponse'
    { $sel:rules:ListTopicRulesResponse' :: Maybe [TopicRuleListItem]
rules = Maybe [TopicRuleListItem]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTopicRulesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTopicRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The rules.
listTopicRulesResponse_rules :: Lens.Lens' ListTopicRulesResponse (Prelude.Maybe [TopicRuleListItem])
listTopicRulesResponse_rules :: (Maybe [TopicRuleListItem] -> f (Maybe [TopicRuleListItem]))
-> ListTopicRulesResponse -> f ListTopicRulesResponse
listTopicRulesResponse_rules = (ListTopicRulesResponse -> Maybe [TopicRuleListItem])
-> (ListTopicRulesResponse
    -> Maybe [TopicRuleListItem] -> ListTopicRulesResponse)
-> Lens' ListTopicRulesResponse (Maybe [TopicRuleListItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTopicRulesResponse' {Maybe [TopicRuleListItem]
rules :: Maybe [TopicRuleListItem]
$sel:rules:ListTopicRulesResponse' :: ListTopicRulesResponse -> Maybe [TopicRuleListItem]
rules} -> Maybe [TopicRuleListItem]
rules) (\s :: ListTopicRulesResponse
s@ListTopicRulesResponse' {} Maybe [TopicRuleListItem]
a -> ListTopicRulesResponse
s {$sel:rules:ListTopicRulesResponse' :: Maybe [TopicRuleListItem]
rules = Maybe [TopicRuleListItem]
a} :: ListTopicRulesResponse) ((Maybe [TopicRuleListItem] -> f (Maybe [TopicRuleListItem]))
 -> ListTopicRulesResponse -> f ListTopicRulesResponse)
-> ((Maybe [TopicRuleListItem] -> f (Maybe [TopicRuleListItem]))
    -> Maybe [TopicRuleListItem] -> f (Maybe [TopicRuleListItem]))
-> (Maybe [TopicRuleListItem] -> f (Maybe [TopicRuleListItem]))
-> ListTopicRulesResponse
-> f ListTopicRulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TopicRuleListItem]
  [TopicRuleListItem]
  [TopicRuleListItem]
  [TopicRuleListItem]
-> Iso
     (Maybe [TopicRuleListItem])
     (Maybe [TopicRuleListItem])
     (Maybe [TopicRuleListItem])
     (Maybe [TopicRuleListItem])
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
  [TopicRuleListItem]
  [TopicRuleListItem]
  [TopicRuleListItem]
  [TopicRuleListItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData ListTopicRulesResponse