{-# 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.Greengrass.ListSubscriptionDefinitions
(
ListSubscriptionDefinitions (..),
newListSubscriptionDefinitions,
listSubscriptionDefinitions_maxResults,
listSubscriptionDefinitions_nextToken,
ListSubscriptionDefinitionsResponse (..),
newListSubscriptionDefinitionsResponse,
listSubscriptionDefinitionsResponse_definitions,
listSubscriptionDefinitionsResponse_nextToken,
listSubscriptionDefinitionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Greengrass.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListSubscriptionDefinitions = ListSubscriptionDefinitions'
{
ListSubscriptionDefinitions -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text,
ListSubscriptionDefinitions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListSubscriptionDefinitions -> ListSubscriptionDefinitions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSubscriptionDefinitions -> ListSubscriptionDefinitions -> Bool
$c/= :: ListSubscriptionDefinitions -> ListSubscriptionDefinitions -> Bool
== :: ListSubscriptionDefinitions -> ListSubscriptionDefinitions -> Bool
$c== :: ListSubscriptionDefinitions -> ListSubscriptionDefinitions -> Bool
Prelude.Eq, ReadPrec [ListSubscriptionDefinitions]
ReadPrec ListSubscriptionDefinitions
Int -> ReadS ListSubscriptionDefinitions
ReadS [ListSubscriptionDefinitions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSubscriptionDefinitions]
$creadListPrec :: ReadPrec [ListSubscriptionDefinitions]
readPrec :: ReadPrec ListSubscriptionDefinitions
$creadPrec :: ReadPrec ListSubscriptionDefinitions
readList :: ReadS [ListSubscriptionDefinitions]
$creadList :: ReadS [ListSubscriptionDefinitions]
readsPrec :: Int -> ReadS ListSubscriptionDefinitions
$creadsPrec :: Int -> ReadS ListSubscriptionDefinitions
Prelude.Read, Int -> ListSubscriptionDefinitions -> ShowS
[ListSubscriptionDefinitions] -> ShowS
ListSubscriptionDefinitions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSubscriptionDefinitions] -> ShowS
$cshowList :: [ListSubscriptionDefinitions] -> ShowS
show :: ListSubscriptionDefinitions -> String
$cshow :: ListSubscriptionDefinitions -> String
showsPrec :: Int -> ListSubscriptionDefinitions -> ShowS
$cshowsPrec :: Int -> ListSubscriptionDefinitions -> ShowS
Prelude.Show, forall x.
Rep ListSubscriptionDefinitions x -> ListSubscriptionDefinitions
forall x.
ListSubscriptionDefinitions -> Rep ListSubscriptionDefinitions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSubscriptionDefinitions x -> ListSubscriptionDefinitions
$cfrom :: forall x.
ListSubscriptionDefinitions -> Rep ListSubscriptionDefinitions x
Prelude.Generic)
newListSubscriptionDefinitions ::
ListSubscriptionDefinitions
newListSubscriptionDefinitions :: ListSubscriptionDefinitions
newListSubscriptionDefinitions =
ListSubscriptionDefinitions'
{ $sel:maxResults:ListSubscriptionDefinitions' :: Maybe Text
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListSubscriptionDefinitions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listSubscriptionDefinitions_maxResults :: Lens.Lens' ListSubscriptionDefinitions (Prelude.Maybe Prelude.Text)
listSubscriptionDefinitions_maxResults :: Lens' ListSubscriptionDefinitions (Maybe Text)
listSubscriptionDefinitions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitions' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:ListSubscriptionDefinitions' :: ListSubscriptionDefinitions -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: ListSubscriptionDefinitions
s@ListSubscriptionDefinitions' {} Maybe Text
a -> ListSubscriptionDefinitions
s {$sel:maxResults:ListSubscriptionDefinitions' :: Maybe Text
maxResults = Maybe Text
a} :: ListSubscriptionDefinitions)
listSubscriptionDefinitions_nextToken :: Lens.Lens' ListSubscriptionDefinitions (Prelude.Maybe Prelude.Text)
listSubscriptionDefinitions_nextToken :: Lens' ListSubscriptionDefinitions (Maybe Text)
listSubscriptionDefinitions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSubscriptionDefinitions' :: ListSubscriptionDefinitions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSubscriptionDefinitions
s@ListSubscriptionDefinitions' {} Maybe Text
a -> ListSubscriptionDefinitions
s {$sel:nextToken:ListSubscriptionDefinitions' :: Maybe Text
nextToken = Maybe Text
a} :: ListSubscriptionDefinitions)
instance Core.AWSPager ListSubscriptionDefinitions where
page :: ListSubscriptionDefinitions
-> AWSResponse ListSubscriptionDefinitions
-> Maybe ListSubscriptionDefinitions
page ListSubscriptionDefinitions
rq AWSResponse ListSubscriptionDefinitions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListSubscriptionDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSubscriptionDefinitionsResponse (Maybe Text)
listSubscriptionDefinitionsResponse_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 ListSubscriptionDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
ListSubscriptionDefinitionsResponse (Maybe [DefinitionInformation])
listSubscriptionDefinitionsResponse_definitions
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.$ ListSubscriptionDefinitions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListSubscriptionDefinitions (Maybe Text)
listSubscriptionDefinitions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSubscriptionDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSubscriptionDefinitionsResponse (Maybe Text)
listSubscriptionDefinitionsResponse_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 ListSubscriptionDefinitions where
type
AWSResponse ListSubscriptionDefinitions =
ListSubscriptionDefinitionsResponse
request :: (Service -> Service)
-> ListSubscriptionDefinitions
-> Request ListSubscriptionDefinitions
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 ListSubscriptionDefinitions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListSubscriptionDefinitions)))
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 [DefinitionInformation]
-> Maybe Text -> Int -> ListSubscriptionDefinitionsResponse
ListSubscriptionDefinitionsResponse'
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
"Definitions" 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.<*> (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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListSubscriptionDefinitions where
hashWithSalt :: Int -> ListSubscriptionDefinitions -> Int
hashWithSalt Int
_salt ListSubscriptionDefinitions' {Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:nextToken:ListSubscriptionDefinitions' :: ListSubscriptionDefinitions -> Maybe Text
$sel:maxResults:ListSubscriptionDefinitions' :: ListSubscriptionDefinitions -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListSubscriptionDefinitions where
rnf :: ListSubscriptionDefinitions -> ()
rnf ListSubscriptionDefinitions' {Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:nextToken:ListSubscriptionDefinitions' :: ListSubscriptionDefinitions -> Maybe Text
$sel:maxResults:ListSubscriptionDefinitions' :: ListSubscriptionDefinitions -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListSubscriptionDefinitions where
toHeaders :: ListSubscriptionDefinitions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListSubscriptionDefinitions where
toPath :: ListSubscriptionDefinitions -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const
ByteString
"/greengrass/definition/subscriptions"
instance Data.ToQuery ListSubscriptionDefinitions where
toQuery :: ListSubscriptionDefinitions -> QueryString
toQuery ListSubscriptionDefinitions' {Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:nextToken:ListSubscriptionDefinitions' :: ListSubscriptionDefinitions -> Maybe Text
$sel:maxResults:ListSubscriptionDefinitions' :: ListSubscriptionDefinitions -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
maxResults,
ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListSubscriptionDefinitionsResponse = ListSubscriptionDefinitionsResponse'
{
ListSubscriptionDefinitionsResponse
-> Maybe [DefinitionInformation]
definitions :: Prelude.Maybe [DefinitionInformation],
ListSubscriptionDefinitionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSubscriptionDefinitionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListSubscriptionDefinitionsResponse
-> ListSubscriptionDefinitionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSubscriptionDefinitionsResponse
-> ListSubscriptionDefinitionsResponse -> Bool
$c/= :: ListSubscriptionDefinitionsResponse
-> ListSubscriptionDefinitionsResponse -> Bool
== :: ListSubscriptionDefinitionsResponse
-> ListSubscriptionDefinitionsResponse -> Bool
$c== :: ListSubscriptionDefinitionsResponse
-> ListSubscriptionDefinitionsResponse -> Bool
Prelude.Eq, ReadPrec [ListSubscriptionDefinitionsResponse]
ReadPrec ListSubscriptionDefinitionsResponse
Int -> ReadS ListSubscriptionDefinitionsResponse
ReadS [ListSubscriptionDefinitionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSubscriptionDefinitionsResponse]
$creadListPrec :: ReadPrec [ListSubscriptionDefinitionsResponse]
readPrec :: ReadPrec ListSubscriptionDefinitionsResponse
$creadPrec :: ReadPrec ListSubscriptionDefinitionsResponse
readList :: ReadS [ListSubscriptionDefinitionsResponse]
$creadList :: ReadS [ListSubscriptionDefinitionsResponse]
readsPrec :: Int -> ReadS ListSubscriptionDefinitionsResponse
$creadsPrec :: Int -> ReadS ListSubscriptionDefinitionsResponse
Prelude.Read, Int -> ListSubscriptionDefinitionsResponse -> ShowS
[ListSubscriptionDefinitionsResponse] -> ShowS
ListSubscriptionDefinitionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSubscriptionDefinitionsResponse] -> ShowS
$cshowList :: [ListSubscriptionDefinitionsResponse] -> ShowS
show :: ListSubscriptionDefinitionsResponse -> String
$cshow :: ListSubscriptionDefinitionsResponse -> String
showsPrec :: Int -> ListSubscriptionDefinitionsResponse -> ShowS
$cshowsPrec :: Int -> ListSubscriptionDefinitionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListSubscriptionDefinitionsResponse x
-> ListSubscriptionDefinitionsResponse
forall x.
ListSubscriptionDefinitionsResponse
-> Rep ListSubscriptionDefinitionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSubscriptionDefinitionsResponse x
-> ListSubscriptionDefinitionsResponse
$cfrom :: forall x.
ListSubscriptionDefinitionsResponse
-> Rep ListSubscriptionDefinitionsResponse x
Prelude.Generic)
newListSubscriptionDefinitionsResponse ::
Prelude.Int ->
ListSubscriptionDefinitionsResponse
newListSubscriptionDefinitionsResponse :: Int -> ListSubscriptionDefinitionsResponse
newListSubscriptionDefinitionsResponse Int
pHttpStatus_ =
ListSubscriptionDefinitionsResponse'
{ $sel:definitions:ListSubscriptionDefinitionsResponse' :: Maybe [DefinitionInformation]
definitions =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListSubscriptionDefinitionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListSubscriptionDefinitionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listSubscriptionDefinitionsResponse_definitions :: Lens.Lens' ListSubscriptionDefinitionsResponse (Prelude.Maybe [DefinitionInformation])
listSubscriptionDefinitionsResponse_definitions :: Lens'
ListSubscriptionDefinitionsResponse (Maybe [DefinitionInformation])
listSubscriptionDefinitionsResponse_definitions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitionsResponse' {Maybe [DefinitionInformation]
definitions :: Maybe [DefinitionInformation]
$sel:definitions:ListSubscriptionDefinitionsResponse' :: ListSubscriptionDefinitionsResponse
-> Maybe [DefinitionInformation]
definitions} -> Maybe [DefinitionInformation]
definitions) (\s :: ListSubscriptionDefinitionsResponse
s@ListSubscriptionDefinitionsResponse' {} Maybe [DefinitionInformation]
a -> ListSubscriptionDefinitionsResponse
s {$sel:definitions:ListSubscriptionDefinitionsResponse' :: Maybe [DefinitionInformation]
definitions = Maybe [DefinitionInformation]
a} :: ListSubscriptionDefinitionsResponse) 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
listSubscriptionDefinitionsResponse_nextToken :: Lens.Lens' ListSubscriptionDefinitionsResponse (Prelude.Maybe Prelude.Text)
listSubscriptionDefinitionsResponse_nextToken :: Lens' ListSubscriptionDefinitionsResponse (Maybe Text)
listSubscriptionDefinitionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSubscriptionDefinitionsResponse' :: ListSubscriptionDefinitionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSubscriptionDefinitionsResponse
s@ListSubscriptionDefinitionsResponse' {} Maybe Text
a -> ListSubscriptionDefinitionsResponse
s {$sel:nextToken:ListSubscriptionDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSubscriptionDefinitionsResponse)
listSubscriptionDefinitionsResponse_httpStatus :: Lens.Lens' ListSubscriptionDefinitionsResponse Prelude.Int
listSubscriptionDefinitionsResponse_httpStatus :: Lens' ListSubscriptionDefinitionsResponse Int
listSubscriptionDefinitionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSubscriptionDefinitionsResponse' :: ListSubscriptionDefinitionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSubscriptionDefinitionsResponse
s@ListSubscriptionDefinitionsResponse' {} Int
a -> ListSubscriptionDefinitionsResponse
s {$sel:httpStatus:ListSubscriptionDefinitionsResponse' :: Int
httpStatus = Int
a} :: ListSubscriptionDefinitionsResponse)
instance
Prelude.NFData
ListSubscriptionDefinitionsResponse
where
rnf :: ListSubscriptionDefinitionsResponse -> ()
rnf ListSubscriptionDefinitionsResponse' {Int
Maybe [DefinitionInformation]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
definitions :: Maybe [DefinitionInformation]
$sel:httpStatus:ListSubscriptionDefinitionsResponse' :: ListSubscriptionDefinitionsResponse -> Int
$sel:nextToken:ListSubscriptionDefinitionsResponse' :: ListSubscriptionDefinitionsResponse -> Maybe Text
$sel:definitions:ListSubscriptionDefinitionsResponse' :: ListSubscriptionDefinitionsResponse
-> Maybe [DefinitionInformation]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DefinitionInformation]
definitions
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 Int
httpStatus