{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QuickSight.ListTemplates
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all the templates in the current Amazon QuickSight account.
--
-- This operation returns paginated results.
module Amazonka.QuickSight.ListTemplates
  ( -- * Creating a Request
    ListTemplates (..),
    newListTemplates,

    -- * Request Lenses
    listTemplates_nextToken,
    listTemplates_maxResults,
    listTemplates_awsAccountId,

    -- * Destructuring the Response
    ListTemplatesResponse (..),
    newListTemplatesResponse,

    -- * Response Lenses
    listTemplatesResponse_requestId,
    listTemplatesResponse_templateSummaryList,
    listTemplatesResponse_nextToken,
    listTemplatesResponse_status,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListTemplates' smart constructor.
data ListTemplates = ListTemplates'
  { -- | The token for the next set of results, or null if there are no more
    -- results.
    ListTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to be returned per request.
    ListTemplates -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the Amazon Web Services account that contains the templates
    -- that you\'re listing.
    ListTemplates -> Text
awsAccountId :: Prelude.Text
  }
  deriving (ListTemplates -> ListTemplates -> Bool
(ListTemplates -> ListTemplates -> Bool)
-> (ListTemplates -> ListTemplates -> Bool) -> Eq ListTemplates
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]
(Int -> ReadS ListTemplates)
-> ReadS [ListTemplates]
-> ReadPrec ListTemplates
-> ReadPrec [ListTemplates]
-> Read 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
(Int -> ListTemplates -> ShowS)
-> (ListTemplates -> String)
-> ([ListTemplates] -> ShowS)
-> Show ListTemplates
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. ListTemplates -> Rep ListTemplates x)
-> (forall x. Rep ListTemplates x -> ListTemplates)
-> Generic ListTemplates
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)

-- |
-- Create a value of 'ListTemplates' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listTemplates_nextToken' - The token for the next set of results, or null if there are no more
-- results.
--
-- 'maxResults', 'listTemplates_maxResults' - The maximum number of results to be returned per request.
--
-- 'awsAccountId', 'listTemplates_awsAccountId' - The ID of the Amazon Web Services account that contains the templates
-- that you\'re listing.
newListTemplates ::
  -- | 'awsAccountId'
  Prelude.Text ->
  ListTemplates
newListTemplates :: Text -> ListTemplates
newListTemplates Text
pAwsAccountId_ =
  ListTemplates' :: Maybe Text -> Maybe Natural -> Text -> ListTemplates
ListTemplates'
    { $sel:nextToken:ListTemplates' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListTemplates' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:awsAccountId:ListTemplates' :: Text
awsAccountId = Text
pAwsAccountId_
    }

-- | The token for the next set of results, or null if there are no more
-- results.
listTemplates_nextToken :: Lens.Lens' ListTemplates (Prelude.Maybe Prelude.Text)
listTemplates_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListTemplates -> f ListTemplates
listTemplates_nextToken = (ListTemplates -> Maybe Text)
-> (ListTemplates -> Maybe Text -> ListTemplates)
-> Lens ListTemplates ListTemplates (Maybe Text) (Maybe Text)
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)

-- | The maximum number of results to be returned per request.
listTemplates_maxResults :: Lens.Lens' ListTemplates (Prelude.Maybe Prelude.Natural)
listTemplates_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListTemplates -> f ListTemplates
listTemplates_maxResults = (ListTemplates -> Maybe Natural)
-> (ListTemplates -> Maybe Natural -> ListTemplates)
-> Lens ListTemplates ListTemplates (Maybe Natural) (Maybe Natural)
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)

-- | The ID of the Amazon Web Services account that contains the templates
-- that you\'re listing.
listTemplates_awsAccountId :: Lens.Lens' ListTemplates Prelude.Text
listTemplates_awsAccountId :: (Text -> f Text) -> ListTemplates -> f ListTemplates
listTemplates_awsAccountId = (ListTemplates -> Text)
-> (ListTemplates -> Text -> ListTemplates)
-> Lens ListTemplates ListTemplates Text Text
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
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTemplates
ListTemplatesResponse
rs
            ListTemplatesResponse
-> Getting (First Text) ListTemplatesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTemplatesResponse
-> Const (First Text) ListTemplatesResponse
Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTemplatesResponse
 -> Const (First Text) ListTemplatesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTemplatesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListTemplates
forall a. Maybe a
Prelude.Nothing
    | Maybe [TemplateSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTemplates
ListTemplatesResponse
rs
            ListTemplatesResponse
-> Getting
     (First [TemplateSummary]) ListTemplatesResponse [TemplateSummary]
-> Maybe [TemplateSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [TemplateSummary]
 -> Const (First [TemplateSummary]) (Maybe [TemplateSummary]))
-> ListTemplatesResponse
-> Const (First [TemplateSummary]) ListTemplatesResponse
Lens' ListTemplatesResponse (Maybe [TemplateSummary])
listTemplatesResponse_templateSummaryList
              ((Maybe [TemplateSummary]
  -> Const (First [TemplateSummary]) (Maybe [TemplateSummary]))
 -> ListTemplatesResponse
 -> Const (First [TemplateSummary]) ListTemplatesResponse)
-> (([TemplateSummary]
     -> Const (First [TemplateSummary]) [TemplateSummary])
    -> Maybe [TemplateSummary]
    -> Const (First [TemplateSummary]) (Maybe [TemplateSummary]))
-> Getting
     (First [TemplateSummary]) ListTemplatesResponse [TemplateSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TemplateSummary]
 -> Const (First [TemplateSummary]) [TemplateSummary])
-> Maybe [TemplateSummary]
-> Const (First [TemplateSummary]) (Maybe [TemplateSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListTemplates
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListTemplates -> Maybe ListTemplates
forall a. a -> Maybe a
Prelude.Just (ListTemplates -> Maybe ListTemplates)
-> ListTemplates -> Maybe ListTemplates
forall a b. (a -> b) -> a -> b
Prelude.$
        ListTemplates
rq
          ListTemplates -> (ListTemplates -> ListTemplates) -> ListTemplates
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListTemplates -> Identity ListTemplates
Lens ListTemplates ListTemplates (Maybe Text) (Maybe Text)
listTemplates_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListTemplates -> Identity ListTemplates)
-> Maybe Text -> ListTemplates -> ListTemplates
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTemplates
ListTemplatesResponse
rs
          ListTemplatesResponse
-> Getting (First Text) ListTemplatesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTemplatesResponse
-> Const (First Text) ListTemplatesResponse
Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTemplatesResponse
 -> Const (First Text) ListTemplatesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTemplatesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListTemplates where
  type
    AWSResponse ListTemplates =
      ListTemplatesResponse
  request :: ListTemplates -> Request ListTemplates
request = Service -> ListTemplates -> Request ListTemplates
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListTemplates
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTemplates)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListTemplates))
-> Logger
-> Service
-> Proxy ListTemplates
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTemplates)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [TemplateSummary]
-> Maybe Text
-> Int
-> ListTemplatesResponse
ListTemplatesResponse'
            (Maybe Text
 -> Maybe [TemplateSummary]
 -> Maybe Text
 -> Int
 -> ListTemplatesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [TemplateSummary]
      -> Maybe Text -> Int -> ListTemplatesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RequestId")
            Either
  String
  (Maybe [TemplateSummary]
   -> Maybe Text -> Int -> ListTemplatesResponse)
-> Either String (Maybe [TemplateSummary])
-> Either String (Maybe Text -> Int -> ListTemplatesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [TemplateSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TemplateSummaryList"
                            Either String (Maybe (Maybe [TemplateSummary]))
-> Maybe [TemplateSummary]
-> Either String (Maybe [TemplateSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [TemplateSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> ListTemplatesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListTemplatesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> ListTemplatesResponse)
-> Either String Int -> Either String ListTemplatesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListTemplates

instance Prelude.NFData ListTemplates

instance Core.ToHeaders ListTemplates where
  toHeaders :: ListTemplates -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListTemplates -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath ListTemplates where
  toPath :: ListTemplates -> ByteString
toPath ListTemplates' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:awsAccountId:ListTemplates' :: ListTemplates -> Text
$sel:maxResults:ListTemplates' :: ListTemplates -> Maybe Natural
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/accounts/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId, ByteString
"/templates"]

instance Core.ToQuery ListTemplates where
  toQuery :: ListTemplates -> QueryString
toQuery ListTemplates' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:awsAccountId:ListTemplates' :: ListTemplates -> Text
$sel:maxResults:ListTemplates' :: ListTemplates -> Maybe Natural
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"max-result" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListTemplatesResponse' smart constructor.
data ListTemplatesResponse = ListTemplatesResponse'
  { -- | The Amazon Web Services request ID for this operation.
    ListTemplatesResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | A structure containing information about the templates in the list.
    ListTemplatesResponse -> Maybe [TemplateSummary]
templateSummaryList :: Prelude.Maybe [TemplateSummary],
    -- | The token for the next set of results, or null if there are no more
    -- results.
    ListTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    ListTemplatesResponse -> Int
status :: Prelude.Int
  }
  deriving (ListTemplatesResponse -> ListTemplatesResponse -> Bool
(ListTemplatesResponse -> ListTemplatesResponse -> Bool)
-> (ListTemplatesResponse -> ListTemplatesResponse -> Bool)
-> Eq ListTemplatesResponse
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]
(Int -> ReadS ListTemplatesResponse)
-> ReadS [ListTemplatesResponse]
-> ReadPrec ListTemplatesResponse
-> ReadPrec [ListTemplatesResponse]
-> Read 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
(Int -> ListTemplatesResponse -> ShowS)
-> (ListTemplatesResponse -> String)
-> ([ListTemplatesResponse] -> ShowS)
-> Show ListTemplatesResponse
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. ListTemplatesResponse -> Rep ListTemplatesResponse x)
-> (forall x. Rep ListTemplatesResponse x -> ListTemplatesResponse)
-> Generic ListTemplatesResponse
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)

-- |
-- Create a value of 'ListTemplatesResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'requestId', 'listTemplatesResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'templateSummaryList', 'listTemplatesResponse_templateSummaryList' - A structure containing information about the templates in the list.
--
-- 'nextToken', 'listTemplatesResponse_nextToken' - The token for the next set of results, or null if there are no more
-- results.
--
-- 'status', 'listTemplatesResponse_status' - The HTTP status of the request.
newListTemplatesResponse ::
  -- | 'status'
  Prelude.Int ->
  ListTemplatesResponse
newListTemplatesResponse :: Int -> ListTemplatesResponse
newListTemplatesResponse Int
pStatus_ =
  ListTemplatesResponse' :: Maybe Text
-> Maybe [TemplateSummary]
-> Maybe Text
-> Int
-> ListTemplatesResponse
ListTemplatesResponse'
    { $sel:requestId:ListTemplatesResponse' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateSummaryList:ListTemplatesResponse' :: Maybe [TemplateSummary]
templateSummaryList = Maybe [TemplateSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListTemplatesResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Web Services request ID for this operation.
listTemplatesResponse_requestId :: Lens.Lens' ListTemplatesResponse (Prelude.Maybe Prelude.Text)
listTemplatesResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> ListTemplatesResponse -> f ListTemplatesResponse
listTemplatesResponse_requestId = (ListTemplatesResponse -> Maybe Text)
-> (ListTemplatesResponse -> Maybe Text -> ListTemplatesResponse)
-> Lens' ListTemplatesResponse (Maybe Text)
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)

-- | A structure containing information about the templates in the list.
listTemplatesResponse_templateSummaryList :: Lens.Lens' ListTemplatesResponse (Prelude.Maybe [TemplateSummary])
listTemplatesResponse_templateSummaryList :: (Maybe [TemplateSummary] -> f (Maybe [TemplateSummary]))
-> ListTemplatesResponse -> f ListTemplatesResponse
listTemplatesResponse_templateSummaryList = (ListTemplatesResponse -> Maybe [TemplateSummary])
-> (ListTemplatesResponse
    -> Maybe [TemplateSummary] -> ListTemplatesResponse)
-> Lens' ListTemplatesResponse (Maybe [TemplateSummary])
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) ((Maybe [TemplateSummary] -> f (Maybe [TemplateSummary]))
 -> ListTemplatesResponse -> f ListTemplatesResponse)
-> ((Maybe [TemplateSummary] -> f (Maybe [TemplateSummary]))
    -> Maybe [TemplateSummary] -> f (Maybe [TemplateSummary]))
-> (Maybe [TemplateSummary] -> f (Maybe [TemplateSummary]))
-> ListTemplatesResponse
-> f ListTemplatesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TemplateSummary]
  [TemplateSummary]
  [TemplateSummary]
  [TemplateSummary]
-> Iso
     (Maybe [TemplateSummary])
     (Maybe [TemplateSummary])
     (Maybe [TemplateSummary])
     (Maybe [TemplateSummary])
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 AnIso
  [TemplateSummary]
  [TemplateSummary]
  [TemplateSummary]
  [TemplateSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of results, or null if there are no more
-- results.
listTemplatesResponse_nextToken :: Lens.Lens' ListTemplatesResponse (Prelude.Maybe Prelude.Text)
listTemplatesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListTemplatesResponse -> f ListTemplatesResponse
listTemplatesResponse_nextToken = (ListTemplatesResponse -> Maybe Text)
-> (ListTemplatesResponse -> Maybe Text -> ListTemplatesResponse)
-> Lens' ListTemplatesResponse (Maybe Text)
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)

-- | The HTTP status of the request.
listTemplatesResponse_status :: Lens.Lens' ListTemplatesResponse Prelude.Int
listTemplatesResponse_status :: (Int -> f Int) -> ListTemplatesResponse -> f ListTemplatesResponse
listTemplatesResponse_status = (ListTemplatesResponse -> Int)
-> (ListTemplatesResponse -> Int -> ListTemplatesResponse)
-> Lens ListTemplatesResponse ListTemplatesResponse Int Int
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