{-# 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.ListProvisioningTemplates
(
ListProvisioningTemplates (..),
newListProvisioningTemplates,
listProvisioningTemplates_maxResults,
listProvisioningTemplates_nextToken,
ListProvisioningTemplatesResponse (..),
newListProvisioningTemplatesResponse,
listProvisioningTemplatesResponse_nextToken,
listProvisioningTemplatesResponse_templates,
listProvisioningTemplatesResponse_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 ListProvisioningTemplates = ListProvisioningTemplates'
{
ListProvisioningTemplates -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProvisioningTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListProvisioningTemplates -> ListProvisioningTemplates -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisioningTemplates -> ListProvisioningTemplates -> Bool
$c/= :: ListProvisioningTemplates -> ListProvisioningTemplates -> Bool
== :: ListProvisioningTemplates -> ListProvisioningTemplates -> Bool
$c== :: ListProvisioningTemplates -> ListProvisioningTemplates -> Bool
Prelude.Eq, ReadPrec [ListProvisioningTemplates]
ReadPrec ListProvisioningTemplates
Int -> ReadS ListProvisioningTemplates
ReadS [ListProvisioningTemplates]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisioningTemplates]
$creadListPrec :: ReadPrec [ListProvisioningTemplates]
readPrec :: ReadPrec ListProvisioningTemplates
$creadPrec :: ReadPrec ListProvisioningTemplates
readList :: ReadS [ListProvisioningTemplates]
$creadList :: ReadS [ListProvisioningTemplates]
readsPrec :: Int -> ReadS ListProvisioningTemplates
$creadsPrec :: Int -> ReadS ListProvisioningTemplates
Prelude.Read, Int -> ListProvisioningTemplates -> ShowS
[ListProvisioningTemplates] -> ShowS
ListProvisioningTemplates -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisioningTemplates] -> ShowS
$cshowList :: [ListProvisioningTemplates] -> ShowS
show :: ListProvisioningTemplates -> String
$cshow :: ListProvisioningTemplates -> String
showsPrec :: Int -> ListProvisioningTemplates -> ShowS
$cshowsPrec :: Int -> ListProvisioningTemplates -> ShowS
Prelude.Show, forall x.
Rep ListProvisioningTemplates x -> ListProvisioningTemplates
forall x.
ListProvisioningTemplates -> Rep ListProvisioningTemplates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProvisioningTemplates x -> ListProvisioningTemplates
$cfrom :: forall x.
ListProvisioningTemplates -> Rep ListProvisioningTemplates x
Prelude.Generic)
newListProvisioningTemplates ::
ListProvisioningTemplates
newListProvisioningTemplates :: ListProvisioningTemplates
newListProvisioningTemplates =
ListProvisioningTemplates'
{ $sel:maxResults:ListProvisioningTemplates' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProvisioningTemplates' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listProvisioningTemplates_maxResults :: Lens.Lens' ListProvisioningTemplates (Prelude.Maybe Prelude.Natural)
listProvisioningTemplates_maxResults :: Lens' ListProvisioningTemplates (Maybe Natural)
listProvisioningTemplates_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplates' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProvisioningTemplates' :: ListProvisioningTemplates -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProvisioningTemplates
s@ListProvisioningTemplates' {} Maybe Natural
a -> ListProvisioningTemplates
s {$sel:maxResults:ListProvisioningTemplates' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProvisioningTemplates)
listProvisioningTemplates_nextToken :: Lens.Lens' ListProvisioningTemplates (Prelude.Maybe Prelude.Text)
listProvisioningTemplates_nextToken :: Lens' ListProvisioningTemplates (Maybe Text)
listProvisioningTemplates_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProvisioningTemplates' :: ListProvisioningTemplates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProvisioningTemplates
s@ListProvisioningTemplates' {} Maybe Text
a -> ListProvisioningTemplates
s {$sel:nextToken:ListProvisioningTemplates' :: Maybe Text
nextToken = Maybe Text
a} :: ListProvisioningTemplates)
instance Core.AWSPager ListProvisioningTemplates where
page :: ListProvisioningTemplates
-> AWSResponse ListProvisioningTemplates
-> Maybe ListProvisioningTemplates
page ListProvisioningTemplates
rq AWSResponse ListProvisioningTemplates
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListProvisioningTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProvisioningTemplatesResponse (Maybe Text)
listProvisioningTemplatesResponse_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 ListProvisioningTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
ListProvisioningTemplatesResponse
(Maybe [ProvisioningTemplateSummary])
listProvisioningTemplatesResponse_templates
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.$ ListProvisioningTemplates
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListProvisioningTemplates (Maybe Text)
listProvisioningTemplates_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListProvisioningTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProvisioningTemplatesResponse (Maybe Text)
listProvisioningTemplatesResponse_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 ListProvisioningTemplates where
type
AWSResponse ListProvisioningTemplates =
ListProvisioningTemplatesResponse
request :: (Service -> Service)
-> ListProvisioningTemplates -> Request ListProvisioningTemplates
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 ListProvisioningTemplates
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProvisioningTemplates)))
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 [ProvisioningTemplateSummary]
-> Int
-> ListProvisioningTemplatesResponse
ListProvisioningTemplatesResponse'
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
"templates" 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 ListProvisioningTemplates where
hashWithSalt :: Int -> ListProvisioningTemplates -> Int
hashWithSalt Int
_salt ListProvisioningTemplates' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListProvisioningTemplates' :: ListProvisioningTemplates -> Maybe Text
$sel:maxResults:ListProvisioningTemplates' :: ListProvisioningTemplates -> 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
instance Prelude.NFData ListProvisioningTemplates where
rnf :: ListProvisioningTemplates -> ()
rnf ListProvisioningTemplates' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListProvisioningTemplates' :: ListProvisioningTemplates -> Maybe Text
$sel:maxResults:ListProvisioningTemplates' :: ListProvisioningTemplates -> 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
instance Data.ToHeaders ListProvisioningTemplates where
toHeaders :: ListProvisioningTemplates -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListProvisioningTemplates where
toPath :: ListProvisioningTemplates -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/provisioning-templates"
instance Data.ToQuery ListProvisioningTemplates where
toQuery :: ListProvisioningTemplates -> QueryString
toQuery ListProvisioningTemplates' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListProvisioningTemplates' :: ListProvisioningTemplates -> Maybe Text
$sel:maxResults:ListProvisioningTemplates' :: ListProvisioningTemplates -> 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
]
data ListProvisioningTemplatesResponse = ListProvisioningTemplatesResponse'
{
ListProvisioningTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProvisioningTemplatesResponse
-> Maybe [ProvisioningTemplateSummary]
templates :: Prelude.Maybe [ProvisioningTemplateSummary],
ListProvisioningTemplatesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListProvisioningTemplatesResponse
-> ListProvisioningTemplatesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisioningTemplatesResponse
-> ListProvisioningTemplatesResponse -> Bool
$c/= :: ListProvisioningTemplatesResponse
-> ListProvisioningTemplatesResponse -> Bool
== :: ListProvisioningTemplatesResponse
-> ListProvisioningTemplatesResponse -> Bool
$c== :: ListProvisioningTemplatesResponse
-> ListProvisioningTemplatesResponse -> Bool
Prelude.Eq, ReadPrec [ListProvisioningTemplatesResponse]
ReadPrec ListProvisioningTemplatesResponse
Int -> ReadS ListProvisioningTemplatesResponse
ReadS [ListProvisioningTemplatesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisioningTemplatesResponse]
$creadListPrec :: ReadPrec [ListProvisioningTemplatesResponse]
readPrec :: ReadPrec ListProvisioningTemplatesResponse
$creadPrec :: ReadPrec ListProvisioningTemplatesResponse
readList :: ReadS [ListProvisioningTemplatesResponse]
$creadList :: ReadS [ListProvisioningTemplatesResponse]
readsPrec :: Int -> ReadS ListProvisioningTemplatesResponse
$creadsPrec :: Int -> ReadS ListProvisioningTemplatesResponse
Prelude.Read, Int -> ListProvisioningTemplatesResponse -> ShowS
[ListProvisioningTemplatesResponse] -> ShowS
ListProvisioningTemplatesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisioningTemplatesResponse] -> ShowS
$cshowList :: [ListProvisioningTemplatesResponse] -> ShowS
show :: ListProvisioningTemplatesResponse -> String
$cshow :: ListProvisioningTemplatesResponse -> String
showsPrec :: Int -> ListProvisioningTemplatesResponse -> ShowS
$cshowsPrec :: Int -> ListProvisioningTemplatesResponse -> ShowS
Prelude.Show, forall x.
Rep ListProvisioningTemplatesResponse x
-> ListProvisioningTemplatesResponse
forall x.
ListProvisioningTemplatesResponse
-> Rep ListProvisioningTemplatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProvisioningTemplatesResponse x
-> ListProvisioningTemplatesResponse
$cfrom :: forall x.
ListProvisioningTemplatesResponse
-> Rep ListProvisioningTemplatesResponse x
Prelude.Generic)
newListProvisioningTemplatesResponse ::
Prelude.Int ->
ListProvisioningTemplatesResponse
newListProvisioningTemplatesResponse :: Int -> ListProvisioningTemplatesResponse
newListProvisioningTemplatesResponse Int
pHttpStatus_ =
ListProvisioningTemplatesResponse'
{ $sel:nextToken:ListProvisioningTemplatesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:templates:ListProvisioningTemplatesResponse' :: Maybe [ProvisioningTemplateSummary]
templates = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProvisioningTemplatesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listProvisioningTemplatesResponse_nextToken :: Lens.Lens' ListProvisioningTemplatesResponse (Prelude.Maybe Prelude.Text)
listProvisioningTemplatesResponse_nextToken :: Lens' ListProvisioningTemplatesResponse (Maybe Text)
listProvisioningTemplatesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProvisioningTemplatesResponse' :: ListProvisioningTemplatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProvisioningTemplatesResponse
s@ListProvisioningTemplatesResponse' {} Maybe Text
a -> ListProvisioningTemplatesResponse
s {$sel:nextToken:ListProvisioningTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProvisioningTemplatesResponse)
listProvisioningTemplatesResponse_templates :: Lens.Lens' ListProvisioningTemplatesResponse (Prelude.Maybe [ProvisioningTemplateSummary])
listProvisioningTemplatesResponse_templates :: Lens'
ListProvisioningTemplatesResponse
(Maybe [ProvisioningTemplateSummary])
listProvisioningTemplatesResponse_templates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplatesResponse' {Maybe [ProvisioningTemplateSummary]
templates :: Maybe [ProvisioningTemplateSummary]
$sel:templates:ListProvisioningTemplatesResponse' :: ListProvisioningTemplatesResponse
-> Maybe [ProvisioningTemplateSummary]
templates} -> Maybe [ProvisioningTemplateSummary]
templates) (\s :: ListProvisioningTemplatesResponse
s@ListProvisioningTemplatesResponse' {} Maybe [ProvisioningTemplateSummary]
a -> ListProvisioningTemplatesResponse
s {$sel:templates:ListProvisioningTemplatesResponse' :: Maybe [ProvisioningTemplateSummary]
templates = Maybe [ProvisioningTemplateSummary]
a} :: ListProvisioningTemplatesResponse) 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
listProvisioningTemplatesResponse_httpStatus :: Lens.Lens' ListProvisioningTemplatesResponse Prelude.Int
listProvisioningTemplatesResponse_httpStatus :: Lens' ListProvisioningTemplatesResponse Int
listProvisioningTemplatesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplatesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListProvisioningTemplatesResponse' :: ListProvisioningTemplatesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListProvisioningTemplatesResponse
s@ListProvisioningTemplatesResponse' {} Int
a -> ListProvisioningTemplatesResponse
s {$sel:httpStatus:ListProvisioningTemplatesResponse' :: Int
httpStatus = Int
a} :: ListProvisioningTemplatesResponse)
instance
Prelude.NFData
ListProvisioningTemplatesResponse
where
rnf :: ListProvisioningTemplatesResponse -> ()
rnf ListProvisioningTemplatesResponse' {Int
Maybe [ProvisioningTemplateSummary]
Maybe Text
httpStatus :: Int
templates :: Maybe [ProvisioningTemplateSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListProvisioningTemplatesResponse' :: ListProvisioningTemplatesResponse -> Int
$sel:templates:ListProvisioningTemplatesResponse' :: ListProvisioningTemplatesResponse
-> Maybe [ProvisioningTemplateSummary]
$sel:nextToken:ListProvisioningTemplatesResponse' :: ListProvisioningTemplatesResponse -> 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 [ProvisioningTemplateSummary]
templates
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus