{-# 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.RobOMaker.ListWorldTemplates
(
ListWorldTemplates (..),
newListWorldTemplates,
listWorldTemplates_maxResults,
listWorldTemplates_nextToken,
ListWorldTemplatesResponse (..),
newListWorldTemplatesResponse,
listWorldTemplatesResponse_nextToken,
listWorldTemplatesResponse_templateSummaries,
listWorldTemplatesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.RobOMaker.Types
data ListWorldTemplates = ListWorldTemplates'
{
ListWorldTemplates -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
ListWorldTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListWorldTemplates -> ListWorldTemplates -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorldTemplates -> ListWorldTemplates -> Bool
$c/= :: ListWorldTemplates -> ListWorldTemplates -> Bool
== :: ListWorldTemplates -> ListWorldTemplates -> Bool
$c== :: ListWorldTemplates -> ListWorldTemplates -> Bool
Prelude.Eq, ReadPrec [ListWorldTemplates]
ReadPrec ListWorldTemplates
Int -> ReadS ListWorldTemplates
ReadS [ListWorldTemplates]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorldTemplates]
$creadListPrec :: ReadPrec [ListWorldTemplates]
readPrec :: ReadPrec ListWorldTemplates
$creadPrec :: ReadPrec ListWorldTemplates
readList :: ReadS [ListWorldTemplates]
$creadList :: ReadS [ListWorldTemplates]
readsPrec :: Int -> ReadS ListWorldTemplates
$creadsPrec :: Int -> ReadS ListWorldTemplates
Prelude.Read, Int -> ListWorldTemplates -> ShowS
[ListWorldTemplates] -> ShowS
ListWorldTemplates -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorldTemplates] -> ShowS
$cshowList :: [ListWorldTemplates] -> ShowS
show :: ListWorldTemplates -> String
$cshow :: ListWorldTemplates -> String
showsPrec :: Int -> ListWorldTemplates -> ShowS
$cshowsPrec :: Int -> ListWorldTemplates -> ShowS
Prelude.Show, forall x. Rep ListWorldTemplates x -> ListWorldTemplates
forall x. ListWorldTemplates -> Rep ListWorldTemplates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWorldTemplates x -> ListWorldTemplates
$cfrom :: forall x. ListWorldTemplates -> Rep ListWorldTemplates x
Prelude.Generic)
newListWorldTemplates ::
ListWorldTemplates
newListWorldTemplates :: ListWorldTemplates
newListWorldTemplates =
ListWorldTemplates'
{ $sel:maxResults:ListWorldTemplates' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListWorldTemplates' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listWorldTemplates_maxResults :: Lens.Lens' ListWorldTemplates (Prelude.Maybe Prelude.Int)
listWorldTemplates_maxResults :: Lens' ListWorldTemplates (Maybe Int)
listWorldTemplates_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorldTemplates' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListWorldTemplates' :: ListWorldTemplates -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListWorldTemplates
s@ListWorldTemplates' {} Maybe Int
a -> ListWorldTemplates
s {$sel:maxResults:ListWorldTemplates' :: Maybe Int
maxResults = Maybe Int
a} :: ListWorldTemplates)
listWorldTemplates_nextToken :: Lens.Lens' ListWorldTemplates (Prelude.Maybe Prelude.Text)
listWorldTemplates_nextToken :: Lens' ListWorldTemplates (Maybe Text)
listWorldTemplates_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorldTemplates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorldTemplates' :: ListWorldTemplates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorldTemplates
s@ListWorldTemplates' {} Maybe Text
a -> ListWorldTemplates
s {$sel:nextToken:ListWorldTemplates' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorldTemplates)
instance Core.AWSPager ListWorldTemplates where
page :: ListWorldTemplates
-> AWSResponse ListWorldTemplates -> Maybe ListWorldTemplates
page ListWorldTemplates
rq AWSResponse ListWorldTemplates
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListWorldTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorldTemplatesResponse (Maybe Text)
listWorldTemplatesResponse_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 ListWorldTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorldTemplatesResponse (Maybe [TemplateSummary])
listWorldTemplatesResponse_templateSummaries
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.$ ListWorldTemplates
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListWorldTemplates (Maybe Text)
listWorldTemplates_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListWorldTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorldTemplatesResponse (Maybe Text)
listWorldTemplatesResponse_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 ListWorldTemplates where
type
AWSResponse ListWorldTemplates =
ListWorldTemplatesResponse
request :: (Service -> Service)
-> ListWorldTemplates -> Request ListWorldTemplates
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListWorldTemplates
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListWorldTemplates)))
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 [TemplateSummary] -> Int -> ListWorldTemplatesResponse
ListWorldTemplatesResponse'
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
"templateSummaries"
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 ListWorldTemplates where
hashWithSalt :: Int -> ListWorldTemplates -> Int
hashWithSalt Int
_salt ListWorldTemplates' {Maybe Int
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:nextToken:ListWorldTemplates' :: ListWorldTemplates -> Maybe Text
$sel:maxResults:ListWorldTemplates' :: ListWorldTemplates -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListWorldTemplates where
rnf :: ListWorldTemplates -> ()
rnf ListWorldTemplates' {Maybe Int
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:nextToken:ListWorldTemplates' :: ListWorldTemplates -> Maybe Text
$sel:maxResults:ListWorldTemplates' :: ListWorldTemplates -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListWorldTemplates where
toHeaders :: ListWorldTemplates -> 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.ToJSON ListWorldTemplates where
toJSON :: ListWorldTemplates -> Value
toJSON ListWorldTemplates' {Maybe Int
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:nextToken:ListWorldTemplates' :: ListWorldTemplates -> Maybe Text
$sel:maxResults:ListWorldTemplates' :: ListWorldTemplates -> Maybe Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
(Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListWorldTemplates where
toPath :: ListWorldTemplates -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/listWorldTemplates"
instance Data.ToQuery ListWorldTemplates where
toQuery :: ListWorldTemplates -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListWorldTemplatesResponse = ListWorldTemplatesResponse'
{
ListWorldTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorldTemplatesResponse -> Maybe [TemplateSummary]
templateSummaries :: Prelude.Maybe [TemplateSummary],
ListWorldTemplatesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListWorldTemplatesResponse -> ListWorldTemplatesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorldTemplatesResponse -> ListWorldTemplatesResponse -> Bool
$c/= :: ListWorldTemplatesResponse -> ListWorldTemplatesResponse -> Bool
== :: ListWorldTemplatesResponse -> ListWorldTemplatesResponse -> Bool
$c== :: ListWorldTemplatesResponse -> ListWorldTemplatesResponse -> Bool
Prelude.Eq, ReadPrec [ListWorldTemplatesResponse]
ReadPrec ListWorldTemplatesResponse
Int -> ReadS ListWorldTemplatesResponse
ReadS [ListWorldTemplatesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorldTemplatesResponse]
$creadListPrec :: ReadPrec [ListWorldTemplatesResponse]
readPrec :: ReadPrec ListWorldTemplatesResponse
$creadPrec :: ReadPrec ListWorldTemplatesResponse
readList :: ReadS [ListWorldTemplatesResponse]
$creadList :: ReadS [ListWorldTemplatesResponse]
readsPrec :: Int -> ReadS ListWorldTemplatesResponse
$creadsPrec :: Int -> ReadS ListWorldTemplatesResponse
Prelude.Read, Int -> ListWorldTemplatesResponse -> ShowS
[ListWorldTemplatesResponse] -> ShowS
ListWorldTemplatesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorldTemplatesResponse] -> ShowS
$cshowList :: [ListWorldTemplatesResponse] -> ShowS
show :: ListWorldTemplatesResponse -> String
$cshow :: ListWorldTemplatesResponse -> String
showsPrec :: Int -> ListWorldTemplatesResponse -> ShowS
$cshowsPrec :: Int -> ListWorldTemplatesResponse -> ShowS
Prelude.Show, forall x.
Rep ListWorldTemplatesResponse x -> ListWorldTemplatesResponse
forall x.
ListWorldTemplatesResponse -> Rep ListWorldTemplatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListWorldTemplatesResponse x -> ListWorldTemplatesResponse
$cfrom :: forall x.
ListWorldTemplatesResponse -> Rep ListWorldTemplatesResponse x
Prelude.Generic)
newListWorldTemplatesResponse ::
Prelude.Int ->
ListWorldTemplatesResponse
newListWorldTemplatesResponse :: Int -> ListWorldTemplatesResponse
newListWorldTemplatesResponse Int
pHttpStatus_ =
ListWorldTemplatesResponse'
{ $sel:nextToken:ListWorldTemplatesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:templateSummaries:ListWorldTemplatesResponse' :: Maybe [TemplateSummary]
templateSummaries = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListWorldTemplatesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listWorldTemplatesResponse_nextToken :: Lens.Lens' ListWorldTemplatesResponse (Prelude.Maybe Prelude.Text)
listWorldTemplatesResponse_nextToken :: Lens' ListWorldTemplatesResponse (Maybe Text)
listWorldTemplatesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorldTemplatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorldTemplatesResponse' :: ListWorldTemplatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorldTemplatesResponse
s@ListWorldTemplatesResponse' {} Maybe Text
a -> ListWorldTemplatesResponse
s {$sel:nextToken:ListWorldTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorldTemplatesResponse)
listWorldTemplatesResponse_templateSummaries :: Lens.Lens' ListWorldTemplatesResponse (Prelude.Maybe [TemplateSummary])
listWorldTemplatesResponse_templateSummaries :: Lens' ListWorldTemplatesResponse (Maybe [TemplateSummary])
listWorldTemplatesResponse_templateSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorldTemplatesResponse' {Maybe [TemplateSummary]
templateSummaries :: Maybe [TemplateSummary]
$sel:templateSummaries:ListWorldTemplatesResponse' :: ListWorldTemplatesResponse -> Maybe [TemplateSummary]
templateSummaries} -> Maybe [TemplateSummary]
templateSummaries) (\s :: ListWorldTemplatesResponse
s@ListWorldTemplatesResponse' {} Maybe [TemplateSummary]
a -> ListWorldTemplatesResponse
s {$sel:templateSummaries:ListWorldTemplatesResponse' :: Maybe [TemplateSummary]
templateSummaries = Maybe [TemplateSummary]
a} :: ListWorldTemplatesResponse) 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
listWorldTemplatesResponse_httpStatus :: Lens.Lens' ListWorldTemplatesResponse Prelude.Int
listWorldTemplatesResponse_httpStatus :: Lens' ListWorldTemplatesResponse Int
listWorldTemplatesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorldTemplatesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListWorldTemplatesResponse' :: ListWorldTemplatesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListWorldTemplatesResponse
s@ListWorldTemplatesResponse' {} Int
a -> ListWorldTemplatesResponse
s {$sel:httpStatus:ListWorldTemplatesResponse' :: Int
httpStatus = Int
a} :: ListWorldTemplatesResponse)
instance Prelude.NFData ListWorldTemplatesResponse where
rnf :: ListWorldTemplatesResponse -> ()
rnf ListWorldTemplatesResponse' {Int
Maybe [TemplateSummary]
Maybe Text
httpStatus :: Int
templateSummaries :: Maybe [TemplateSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListWorldTemplatesResponse' :: ListWorldTemplatesResponse -> Int
$sel:templateSummaries:ListWorldTemplatesResponse' :: ListWorldTemplatesResponse -> Maybe [TemplateSummary]
$sel:nextToken:ListWorldTemplatesResponse' :: ListWorldTemplatesResponse -> 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 [TemplateSummary]
templateSummaries
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus