{-# 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.QuickSight.ListTemplates
(
ListTemplates (..),
newListTemplates,
listTemplates_maxResults,
listTemplates_nextToken,
listTemplates_awsAccountId,
ListTemplatesResponse (..),
newListTemplatesResponse,
listTemplatesResponse_nextToken,
listTemplatesResponse_requestId,
listTemplatesResponse_templateSummaryList,
listTemplatesResponse_status,
)
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 Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListTemplates = ListTemplates'
{
ListTemplates -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTemplates -> Text
awsAccountId :: Prelude.Text
}
deriving (ListTemplates -> ListTemplates -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTemplates -> ListTemplates -> Bool
$c/= :: ListTemplates -> ListTemplates -> Bool
== :: ListTemplates -> ListTemplates -> Bool
$c== :: ListTemplates -> ListTemplates -> Bool
Prelude.Eq, ReadPrec [ListTemplates]
ReadPrec ListTemplates
Int -> ReadS ListTemplates
ReadS [ListTemplates]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTemplates]
$creadListPrec :: ReadPrec [ListTemplates]
readPrec :: ReadPrec ListTemplates
$creadPrec :: ReadPrec ListTemplates
readList :: ReadS [ListTemplates]
$creadList :: ReadS [ListTemplates]
readsPrec :: Int -> ReadS ListTemplates
$creadsPrec :: Int -> ReadS ListTemplates
Prelude.Read, Int -> ListTemplates -> ShowS
[ListTemplates] -> ShowS
ListTemplates -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTemplates] -> ShowS
$cshowList :: [ListTemplates] -> ShowS
show :: ListTemplates -> String
$cshow :: ListTemplates -> String
showsPrec :: Int -> ListTemplates -> ShowS
$cshowsPrec :: Int -> ListTemplates -> ShowS
Prelude.Show, forall x. Rep ListTemplates x -> ListTemplates
forall x. ListTemplates -> Rep ListTemplates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTemplates x -> ListTemplates
$cfrom :: forall x. ListTemplates -> Rep ListTemplates x
Prelude.Generic)
newListTemplates ::
Prelude.Text ->
ListTemplates
newListTemplates :: Text -> ListTemplates
newListTemplates Text
pAwsAccountId_ =
ListTemplates'
{ $sel:maxResults:ListTemplates' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListTemplates' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:awsAccountId:ListTemplates' :: Text
awsAccountId = Text
pAwsAccountId_
}
listTemplates_maxResults :: Lens.Lens' ListTemplates (Prelude.Maybe Prelude.Natural)
listTemplates_maxResults :: Lens' ListTemplates (Maybe Natural)
listTemplates_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplates' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListTemplates' :: ListTemplates -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListTemplates
s@ListTemplates' {} Maybe Natural
a -> ListTemplates
s {$sel:maxResults:ListTemplates' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListTemplates)
listTemplates_nextToken :: Lens.Lens' ListTemplates (Prelude.Maybe Prelude.Text)
listTemplates_nextToken :: Lens' ListTemplates (Maybe Text)
listTemplates_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTemplates
s@ListTemplates' {} Maybe Text
a -> ListTemplates
s {$sel:nextToken:ListTemplates' :: Maybe Text
nextToken = Maybe Text
a} :: ListTemplates)
listTemplates_awsAccountId :: Lens.Lens' ListTemplates Prelude.Text
listTemplates_awsAccountId :: Lens' ListTemplates Text
listTemplates_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplates' {Text
awsAccountId :: Text
$sel:awsAccountId:ListTemplates' :: ListTemplates -> Text
awsAccountId} -> Text
awsAccountId) (\s :: ListTemplates
s@ListTemplates' {} Text
a -> ListTemplates
s {$sel:awsAccountId:ListTemplates' :: Text
awsAccountId = Text
a} :: ListTemplates)
instance Core.AWSPager ListTemplates where
page :: ListTemplates -> AWSResponse ListTemplates -> Maybe ListTemplates
page ListTemplates
rq AWSResponse ListTemplates
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_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 ListTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTemplatesResponse (Maybe [TemplateSummary])
listTemplatesResponse_templateSummaryList
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.$ ListTemplates
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListTemplates (Maybe Text)
listTemplates_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_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 ListTemplates where
type
AWSResponse ListTemplates =
ListTemplatesResponse
request :: (Service -> Service) -> ListTemplates -> Request ListTemplates
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 ListTemplates
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTemplates)))
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 Text
-> Maybe [TemplateSummary]
-> Int
-> ListTemplatesResponse
ListTemplatesResponse'
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
"RequestId")
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
"TemplateSummaryList"
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 ListTemplates where
hashWithSalt :: Int -> ListTemplates -> Int
hashWithSalt Int
_salt ListTemplates' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:awsAccountId:ListTemplates' :: ListTemplates -> Text
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
$sel:maxResults:ListTemplates' :: ListTemplates -> 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` Text
awsAccountId
instance Prelude.NFData ListTemplates where
rnf :: ListTemplates -> ()
rnf ListTemplates' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:awsAccountId:ListTemplates' :: ListTemplates -> Text
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
$sel:maxResults:ListTemplates' :: ListTemplates -> 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 Text
awsAccountId
instance Data.ToHeaders ListTemplates where
toHeaders :: ListTemplates -> 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.0" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListTemplates where
toPath :: ListTemplates -> ByteString
toPath ListTemplates' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:awsAccountId:ListTemplates' :: ListTemplates -> Text
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
$sel:maxResults:ListTemplates' :: ListTemplates -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/accounts/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
awsAccountId, ByteString
"/templates"]
instance Data.ToQuery ListTemplates where
toQuery :: ListTemplates -> QueryString
toQuery ListTemplates' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:awsAccountId:ListTemplates' :: ListTemplates -> Text
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
$sel:maxResults:ListTemplates' :: ListTemplates -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"max-result" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"next-token" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListTemplatesResponse = ListTemplatesResponse'
{
ListTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTemplatesResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
ListTemplatesResponse -> Maybe [TemplateSummary]
templateSummaryList :: Prelude.Maybe [TemplateSummary],
ListTemplatesResponse -> Int
status :: Prelude.Int
}
deriving (ListTemplatesResponse -> ListTemplatesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTemplatesResponse -> ListTemplatesResponse -> Bool
$c/= :: ListTemplatesResponse -> ListTemplatesResponse -> Bool
== :: ListTemplatesResponse -> ListTemplatesResponse -> Bool
$c== :: ListTemplatesResponse -> ListTemplatesResponse -> Bool
Prelude.Eq, ReadPrec [ListTemplatesResponse]
ReadPrec ListTemplatesResponse
Int -> ReadS ListTemplatesResponse
ReadS [ListTemplatesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTemplatesResponse]
$creadListPrec :: ReadPrec [ListTemplatesResponse]
readPrec :: ReadPrec ListTemplatesResponse
$creadPrec :: ReadPrec ListTemplatesResponse
readList :: ReadS [ListTemplatesResponse]
$creadList :: ReadS [ListTemplatesResponse]
readsPrec :: Int -> ReadS ListTemplatesResponse
$creadsPrec :: Int -> ReadS ListTemplatesResponse
Prelude.Read, Int -> ListTemplatesResponse -> ShowS
[ListTemplatesResponse] -> ShowS
ListTemplatesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTemplatesResponse] -> ShowS
$cshowList :: [ListTemplatesResponse] -> ShowS
show :: ListTemplatesResponse -> String
$cshow :: ListTemplatesResponse -> String
showsPrec :: Int -> ListTemplatesResponse -> ShowS
$cshowsPrec :: Int -> ListTemplatesResponse -> ShowS
Prelude.Show, forall x. Rep ListTemplatesResponse x -> ListTemplatesResponse
forall x. ListTemplatesResponse -> Rep ListTemplatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTemplatesResponse x -> ListTemplatesResponse
$cfrom :: forall x. ListTemplatesResponse -> Rep ListTemplatesResponse x
Prelude.Generic)
newListTemplatesResponse ::
Prelude.Int ->
ListTemplatesResponse
newListTemplatesResponse :: Int -> ListTemplatesResponse
newListTemplatesResponse Int
pStatus_ =
ListTemplatesResponse'
{ $sel:nextToken:ListTemplatesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:requestId:ListTemplatesResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
$sel:templateSummaryList:ListTemplatesResponse' :: Maybe [TemplateSummary]
templateSummaryList = forall a. Maybe a
Prelude.Nothing,
$sel:status:ListTemplatesResponse' :: Int
status = Int
pStatus_
}
listTemplatesResponse_nextToken :: Lens.Lens' ListTemplatesResponse (Prelude.Maybe Prelude.Text)
listTemplatesResponse_nextToken :: Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTemplatesResponse' :: ListTemplatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTemplatesResponse
s@ListTemplatesResponse' {} Maybe Text
a -> ListTemplatesResponse
s {$sel:nextToken:ListTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTemplatesResponse)
listTemplatesResponse_requestId :: Lens.Lens' ListTemplatesResponse (Prelude.Maybe Prelude.Text)
listTemplatesResponse_requestId :: Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplatesResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:ListTemplatesResponse' :: ListTemplatesResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: ListTemplatesResponse
s@ListTemplatesResponse' {} Maybe Text
a -> ListTemplatesResponse
s {$sel:requestId:ListTemplatesResponse' :: Maybe Text
requestId = Maybe Text
a} :: ListTemplatesResponse)
listTemplatesResponse_templateSummaryList :: Lens.Lens' ListTemplatesResponse (Prelude.Maybe [TemplateSummary])
listTemplatesResponse_templateSummaryList :: Lens' ListTemplatesResponse (Maybe [TemplateSummary])
listTemplatesResponse_templateSummaryList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplatesResponse' {Maybe [TemplateSummary]
templateSummaryList :: Maybe [TemplateSummary]
$sel:templateSummaryList:ListTemplatesResponse' :: ListTemplatesResponse -> Maybe [TemplateSummary]
templateSummaryList} -> Maybe [TemplateSummary]
templateSummaryList) (\s :: ListTemplatesResponse
s@ListTemplatesResponse' {} Maybe [TemplateSummary]
a -> ListTemplatesResponse
s {$sel:templateSummaryList:ListTemplatesResponse' :: Maybe [TemplateSummary]
templateSummaryList = Maybe [TemplateSummary]
a} :: ListTemplatesResponse) 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
listTemplatesResponse_status :: Lens.Lens' ListTemplatesResponse Prelude.Int
listTemplatesResponse_status :: Lens' ListTemplatesResponse Int
listTemplatesResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplatesResponse' {Int
status :: Int
$sel:status:ListTemplatesResponse' :: ListTemplatesResponse -> Int
status} -> Int
status) (\s :: ListTemplatesResponse
s@ListTemplatesResponse' {} Int
a -> ListTemplatesResponse
s {$sel:status:ListTemplatesResponse' :: Int
status = Int
a} :: ListTemplatesResponse)
instance Prelude.NFData ListTemplatesResponse where
rnf :: ListTemplatesResponse -> ()
rnf ListTemplatesResponse' {Int
Maybe [TemplateSummary]
Maybe Text
status :: Int
templateSummaryList :: Maybe [TemplateSummary]
requestId :: Maybe Text
nextToken :: Maybe Text
$sel:status:ListTemplatesResponse' :: ListTemplatesResponse -> Int
$sel:templateSummaryList:ListTemplatesResponse' :: ListTemplatesResponse -> Maybe [TemplateSummary]
$sel:requestId:ListTemplatesResponse' :: ListTemplatesResponse -> Maybe Text
$sel:nextToken:ListTemplatesResponse' :: ListTemplatesResponse -> 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 Text
requestId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TemplateSummary]
templateSummaryList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
status