{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IoT.ListTopicRules
(
ListTopicRules (..),
newListTopicRules,
listTopicRules_maxResults,
listTopicRules_nextToken,
listTopicRules_ruleDisabled,
listTopicRules_topic,
ListTopicRulesResponse (..),
newListTopicRulesResponse,
listTopicRulesResponse_nextToken,
listTopicRulesResponse_rules,
listTopicRulesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListTopicRules = ListTopicRules'
{
ListTopicRules -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListTopicRules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTopicRules -> Maybe Bool
ruleDisabled :: Prelude.Maybe Prelude.Bool,
ListTopicRules -> Maybe Text
topic :: Prelude.Maybe Prelude.Text
}
deriving (ListTopicRules -> ListTopicRules -> Bool
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]
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
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. 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)
newListTopicRules ::
ListTopicRules
newListTopicRules :: ListTopicRules
newListTopicRules =
ListTopicRules'
{ $sel:maxResults:ListTopicRules' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListTopicRules' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:ruleDisabled:ListTopicRules' :: Maybe Bool
ruleDisabled = forall a. Maybe a
Prelude.Nothing,
$sel:topic:ListTopicRules' :: Maybe Text
topic = forall a. Maybe a
Prelude.Nothing
}
listTopicRules_maxResults :: Lens.Lens' ListTopicRules (Prelude.Maybe Prelude.Natural)
listTopicRules_maxResults :: Lens' ListTopicRules (Maybe Natural)
listTopicRules_maxResults = 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)
listTopicRules_nextToken :: Lens.Lens' ListTopicRules (Prelude.Maybe Prelude.Text)
listTopicRules_nextToken :: Lens' ListTopicRules (Maybe Text)
listTopicRules_nextToken = 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)
listTopicRules_ruleDisabled :: Lens.Lens' ListTopicRules (Prelude.Maybe Prelude.Bool)
listTopicRules_ruleDisabled :: Lens' ListTopicRules (Maybe Bool)
listTopicRules_ruleDisabled = 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)
listTopicRules_topic :: Lens.Lens' ListTopicRules (Prelude.Maybe Prelude.Text)
listTopicRules_topic :: Lens' ListTopicRules (Maybe Text)
listTopicRules_topic = 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)
instance Core.AWSPager ListTopicRules where
page :: ListTopicRules
-> AWSResponse ListTopicRules -> Maybe ListTopicRules
page ListTopicRules
rq AWSResponse ListTopicRules
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListTopicRules
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTopicRulesResponse (Maybe Text)
listTopicRulesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListTopicRules
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTopicRulesResponse (Maybe [TopicRuleListItem])
listTopicRulesResponse_rules
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListTopicRules
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListTopicRules (Maybe Text)
listTopicRules_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTopicRules
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTopicRulesResponse (Maybe Text)
listTopicRulesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListTopicRules where
type
AWSResponse ListTopicRules =
ListTopicRulesResponse
request :: (Service -> Service) -> ListTopicRules -> Request ListTopicRules
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListTopicRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTopicRules)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Maybe [TopicRuleListItem] -> Int -> ListTopicRulesResponse
ListTopicRulesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"rules" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListTopicRules where
hashWithSalt :: Int -> ListTopicRules -> Int
hashWithSalt Int
_salt ListTopicRules' {Maybe Bool
Maybe Natural
Maybe Text
topic :: Maybe Text
ruleDisabled :: Maybe Bool
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:topic:ListTopicRules' :: ListTopicRules -> Maybe Text
$sel:ruleDisabled:ListTopicRules' :: ListTopicRules -> Maybe Bool
$sel:nextToken:ListTopicRules' :: ListTopicRules -> Maybe Text
$sel:maxResults:ListTopicRules' :: ListTopicRules -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
ruleDisabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
topic
instance Prelude.NFData ListTopicRules where
rnf :: ListTopicRules -> ()
rnf ListTopicRules' {Maybe Bool
Maybe Natural
Maybe Text
topic :: Maybe Text
ruleDisabled :: Maybe Bool
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:topic:ListTopicRules' :: ListTopicRules -> Maybe Text
$sel:ruleDisabled:ListTopicRules' :: ListTopicRules -> Maybe Bool
$sel:nextToken:ListTopicRules' :: ListTopicRules -> Maybe Text
$sel:maxResults:ListTopicRules' :: ListTopicRules -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
ruleDisabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
topic
instance Data.ToHeaders ListTopicRules where
toHeaders :: ListTopicRules -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListTopicRules where
toPath :: ListTopicRules -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/rules"
instance Data.ToQuery ListTopicRules where
toQuery :: ListTopicRules -> QueryString
toQuery ListTopicRules' {Maybe Bool
Maybe Natural
Maybe Text
topic :: Maybe Text
ruleDisabled :: Maybe Bool
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:topic:ListTopicRules' :: ListTopicRules -> Maybe Text
$sel:ruleDisabled:ListTopicRules' :: ListTopicRules -> Maybe Bool
$sel:nextToken:ListTopicRules' :: ListTopicRules -> Maybe Text
$sel:maxResults:ListTopicRules' :: ListTopicRules -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
ByteString
"ruleDisabled" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
ruleDisabled,
ByteString
"topic" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
topic
]
data ListTopicRulesResponse = ListTopicRulesResponse'
{
ListTopicRulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTopicRulesResponse -> Maybe [TopicRuleListItem]
rules :: Prelude.Maybe [TopicRuleListItem],
ListTopicRulesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListTopicRulesResponse -> ListTopicRulesResponse -> Bool
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]
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
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. 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)
newListTopicRulesResponse ::
Prelude.Int ->
ListTopicRulesResponse
newListTopicRulesResponse :: Int -> ListTopicRulesResponse
newListTopicRulesResponse Int
pHttpStatus_ =
ListTopicRulesResponse'
{ $sel:nextToken:ListTopicRulesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:rules:ListTopicRulesResponse' :: Maybe [TopicRuleListItem]
rules = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListTopicRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listTopicRulesResponse_nextToken :: Lens.Lens' ListTopicRulesResponse (Prelude.Maybe Prelude.Text)
listTopicRulesResponse_nextToken :: Lens' ListTopicRulesResponse (Maybe Text)
listTopicRulesResponse_nextToken = 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)
listTopicRulesResponse_rules :: Lens.Lens' ListTopicRulesResponse (Prelude.Maybe [TopicRuleListItem])
listTopicRulesResponse_rules :: Lens' ListTopicRulesResponse (Maybe [TopicRuleListItem])
listTopicRulesResponse_rules = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listTopicRulesResponse_httpStatus :: Lens.Lens' ListTopicRulesResponse Prelude.Int
listTopicRulesResponse_httpStatus :: Lens' ListTopicRulesResponse Int
listTopicRulesResponse_httpStatus = 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 where
rnf :: ListTopicRulesResponse -> ()
rnf ListTopicRulesResponse' {Int
Maybe [TopicRuleListItem]
Maybe Text
httpStatus :: Int
rules :: Maybe [TopicRuleListItem]
nextToken :: Maybe Text
$sel:httpStatus:ListTopicRulesResponse' :: ListTopicRulesResponse -> Int
$sel:rules:ListTopicRulesResponse' :: ListTopicRulesResponse -> Maybe [TopicRuleListItem]
$sel:nextToken:ListTopicRulesResponse' :: ListTopicRulesResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TopicRuleListItem]
rules
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus