{-# 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.IoT.ListProvisioningTemplateVersions
-- 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)
--
-- A list of fleet provisioning template versions.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListProvisioningTemplateVersions>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListProvisioningTemplateVersions
  ( -- * Creating a Request
    ListProvisioningTemplateVersions (..),
    newListProvisioningTemplateVersions,

    -- * Request Lenses
    listProvisioningTemplateVersions_nextToken,
    listProvisioningTemplateVersions_maxResults,
    listProvisioningTemplateVersions_templateName,

    -- * Destructuring the Response
    ListProvisioningTemplateVersionsResponse (..),
    newListProvisioningTemplateVersionsResponse,

    -- * Response Lenses
    listProvisioningTemplateVersionsResponse_versions,
    listProvisioningTemplateVersionsResponse_nextToken,
    listProvisioningTemplateVersionsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListProvisioningTemplateVersions' smart constructor.
data ListProvisioningTemplateVersions = ListProvisioningTemplateVersions'
  { -- | A token to retrieve the next set of results.
    ListProvisioningTemplateVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return at one time.
    ListProvisioningTemplateVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the fleet provisioning template.
    ListProvisioningTemplateVersions -> Text
templateName :: Prelude.Text
  }
  deriving (ListProvisioningTemplateVersions
-> ListProvisioningTemplateVersions -> Bool
(ListProvisioningTemplateVersions
 -> ListProvisioningTemplateVersions -> Bool)
-> (ListProvisioningTemplateVersions
    -> ListProvisioningTemplateVersions -> Bool)
-> Eq ListProvisioningTemplateVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisioningTemplateVersions
-> ListProvisioningTemplateVersions -> Bool
$c/= :: ListProvisioningTemplateVersions
-> ListProvisioningTemplateVersions -> Bool
== :: ListProvisioningTemplateVersions
-> ListProvisioningTemplateVersions -> Bool
$c== :: ListProvisioningTemplateVersions
-> ListProvisioningTemplateVersions -> Bool
Prelude.Eq, ReadPrec [ListProvisioningTemplateVersions]
ReadPrec ListProvisioningTemplateVersions
Int -> ReadS ListProvisioningTemplateVersions
ReadS [ListProvisioningTemplateVersions]
(Int -> ReadS ListProvisioningTemplateVersions)
-> ReadS [ListProvisioningTemplateVersions]
-> ReadPrec ListProvisioningTemplateVersions
-> ReadPrec [ListProvisioningTemplateVersions]
-> Read ListProvisioningTemplateVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisioningTemplateVersions]
$creadListPrec :: ReadPrec [ListProvisioningTemplateVersions]
readPrec :: ReadPrec ListProvisioningTemplateVersions
$creadPrec :: ReadPrec ListProvisioningTemplateVersions
readList :: ReadS [ListProvisioningTemplateVersions]
$creadList :: ReadS [ListProvisioningTemplateVersions]
readsPrec :: Int -> ReadS ListProvisioningTemplateVersions
$creadsPrec :: Int -> ReadS ListProvisioningTemplateVersions
Prelude.Read, Int -> ListProvisioningTemplateVersions -> ShowS
[ListProvisioningTemplateVersions] -> ShowS
ListProvisioningTemplateVersions -> String
(Int -> ListProvisioningTemplateVersions -> ShowS)
-> (ListProvisioningTemplateVersions -> String)
-> ([ListProvisioningTemplateVersions] -> ShowS)
-> Show ListProvisioningTemplateVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisioningTemplateVersions] -> ShowS
$cshowList :: [ListProvisioningTemplateVersions] -> ShowS
show :: ListProvisioningTemplateVersions -> String
$cshow :: ListProvisioningTemplateVersions -> String
showsPrec :: Int -> ListProvisioningTemplateVersions -> ShowS
$cshowsPrec :: Int -> ListProvisioningTemplateVersions -> ShowS
Prelude.Show, (forall x.
 ListProvisioningTemplateVersions
 -> Rep ListProvisioningTemplateVersions x)
-> (forall x.
    Rep ListProvisioningTemplateVersions x
    -> ListProvisioningTemplateVersions)
-> Generic ListProvisioningTemplateVersions
forall x.
Rep ListProvisioningTemplateVersions x
-> ListProvisioningTemplateVersions
forall x.
ListProvisioningTemplateVersions
-> Rep ListProvisioningTemplateVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProvisioningTemplateVersions x
-> ListProvisioningTemplateVersions
$cfrom :: forall x.
ListProvisioningTemplateVersions
-> Rep ListProvisioningTemplateVersions x
Prelude.Generic)

-- |
-- Create a value of 'ListProvisioningTemplateVersions' 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', 'listProvisioningTemplateVersions_nextToken' - A token to retrieve the next set of results.
--
-- 'maxResults', 'listProvisioningTemplateVersions_maxResults' - The maximum number of results to return at one time.
--
-- 'templateName', 'listProvisioningTemplateVersions_templateName' - The name of the fleet provisioning template.
newListProvisioningTemplateVersions ::
  -- | 'templateName'
  Prelude.Text ->
  ListProvisioningTemplateVersions
newListProvisioningTemplateVersions :: Text -> ListProvisioningTemplateVersions
newListProvisioningTemplateVersions Text
pTemplateName_ =
  ListProvisioningTemplateVersions' :: Maybe Text
-> Maybe Natural -> Text -> ListProvisioningTemplateVersions
ListProvisioningTemplateVersions'
    { $sel:nextToken:ListProvisioningTemplateVersions' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListProvisioningTemplateVersions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:templateName:ListProvisioningTemplateVersions' :: Text
templateName = Text
pTemplateName_
    }

-- | A token to retrieve the next set of results.
listProvisioningTemplateVersions_nextToken :: Lens.Lens' ListProvisioningTemplateVersions (Prelude.Maybe Prelude.Text)
listProvisioningTemplateVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProvisioningTemplateVersions
-> f ListProvisioningTemplateVersions
listProvisioningTemplateVersions_nextToken = (ListProvisioningTemplateVersions -> Maybe Text)
-> (ListProvisioningTemplateVersions
    -> Maybe Text -> ListProvisioningTemplateVersions)
-> Lens
     ListProvisioningTemplateVersions
     ListProvisioningTemplateVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplateVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProvisioningTemplateVersions' :: ListProvisioningTemplateVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProvisioningTemplateVersions
s@ListProvisioningTemplateVersions' {} Maybe Text
a -> ListProvisioningTemplateVersions
s {$sel:nextToken:ListProvisioningTemplateVersions' :: Maybe Text
nextToken = Maybe Text
a} :: ListProvisioningTemplateVersions)

-- | The maximum number of results to return at one time.
listProvisioningTemplateVersions_maxResults :: Lens.Lens' ListProvisioningTemplateVersions (Prelude.Maybe Prelude.Natural)
listProvisioningTemplateVersions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListProvisioningTemplateVersions
-> f ListProvisioningTemplateVersions
listProvisioningTemplateVersions_maxResults = (ListProvisioningTemplateVersions -> Maybe Natural)
-> (ListProvisioningTemplateVersions
    -> Maybe Natural -> ListProvisioningTemplateVersions)
-> Lens
     ListProvisioningTemplateVersions
     ListProvisioningTemplateVersions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplateVersions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProvisioningTemplateVersions' :: ListProvisioningTemplateVersions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProvisioningTemplateVersions
s@ListProvisioningTemplateVersions' {} Maybe Natural
a -> ListProvisioningTemplateVersions
s {$sel:maxResults:ListProvisioningTemplateVersions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProvisioningTemplateVersions)

-- | The name of the fleet provisioning template.
listProvisioningTemplateVersions_templateName :: Lens.Lens' ListProvisioningTemplateVersions Prelude.Text
listProvisioningTemplateVersions_templateName :: (Text -> f Text)
-> ListProvisioningTemplateVersions
-> f ListProvisioningTemplateVersions
listProvisioningTemplateVersions_templateName = (ListProvisioningTemplateVersions -> Text)
-> (ListProvisioningTemplateVersions
    -> Text -> ListProvisioningTemplateVersions)
-> Lens
     ListProvisioningTemplateVersions
     ListProvisioningTemplateVersions
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplateVersions' {Text
templateName :: Text
$sel:templateName:ListProvisioningTemplateVersions' :: ListProvisioningTemplateVersions -> Text
templateName} -> Text
templateName) (\s :: ListProvisioningTemplateVersions
s@ListProvisioningTemplateVersions' {} Text
a -> ListProvisioningTemplateVersions
s {$sel:templateName:ListProvisioningTemplateVersions' :: Text
templateName = Text
a} :: ListProvisioningTemplateVersions)

instance
  Core.AWSPager
    ListProvisioningTemplateVersions
  where
  page :: ListProvisioningTemplateVersions
-> AWSResponse ListProvisioningTemplateVersions
-> Maybe ListProvisioningTemplateVersions
page ListProvisioningTemplateVersions
rq AWSResponse ListProvisioningTemplateVersions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListProvisioningTemplateVersions
ListProvisioningTemplateVersionsResponse
rs
            ListProvisioningTemplateVersionsResponse
-> Getting
     (First Text) ListProvisioningTemplateVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListProvisioningTemplateVersionsResponse
-> Const (First Text) ListProvisioningTemplateVersionsResponse
Lens' ListProvisioningTemplateVersionsResponse (Maybe Text)
listProvisioningTemplateVersionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListProvisioningTemplateVersionsResponse
 -> Const (First Text) ListProvisioningTemplateVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListProvisioningTemplateVersionsResponse 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 ListProvisioningTemplateVersions
forall a. Maybe a
Prelude.Nothing
    | Maybe [ProvisioningTemplateVersionSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListProvisioningTemplateVersions
ListProvisioningTemplateVersionsResponse
rs
            ListProvisioningTemplateVersionsResponse
-> Getting
     (First [ProvisioningTemplateVersionSummary])
     ListProvisioningTemplateVersionsResponse
     [ProvisioningTemplateVersionSummary]
-> Maybe [ProvisioningTemplateVersionSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ProvisioningTemplateVersionSummary]
 -> Const
      (First [ProvisioningTemplateVersionSummary])
      (Maybe [ProvisioningTemplateVersionSummary]))
-> ListProvisioningTemplateVersionsResponse
-> Const
     (First [ProvisioningTemplateVersionSummary])
     ListProvisioningTemplateVersionsResponse
Lens'
  ListProvisioningTemplateVersionsResponse
  (Maybe [ProvisioningTemplateVersionSummary])
listProvisioningTemplateVersionsResponse_versions
              ((Maybe [ProvisioningTemplateVersionSummary]
  -> Const
       (First [ProvisioningTemplateVersionSummary])
       (Maybe [ProvisioningTemplateVersionSummary]))
 -> ListProvisioningTemplateVersionsResponse
 -> Const
      (First [ProvisioningTemplateVersionSummary])
      ListProvisioningTemplateVersionsResponse)
-> (([ProvisioningTemplateVersionSummary]
     -> Const
          (First [ProvisioningTemplateVersionSummary])
          [ProvisioningTemplateVersionSummary])
    -> Maybe [ProvisioningTemplateVersionSummary]
    -> Const
         (First [ProvisioningTemplateVersionSummary])
         (Maybe [ProvisioningTemplateVersionSummary]))
-> Getting
     (First [ProvisioningTemplateVersionSummary])
     ListProvisioningTemplateVersionsResponse
     [ProvisioningTemplateVersionSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ProvisioningTemplateVersionSummary]
 -> Const
      (First [ProvisioningTemplateVersionSummary])
      [ProvisioningTemplateVersionSummary])
-> Maybe [ProvisioningTemplateVersionSummary]
-> Const
     (First [ProvisioningTemplateVersionSummary])
     (Maybe [ProvisioningTemplateVersionSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListProvisioningTemplateVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListProvisioningTemplateVersions
-> Maybe ListProvisioningTemplateVersions
forall a. a -> Maybe a
Prelude.Just (ListProvisioningTemplateVersions
 -> Maybe ListProvisioningTemplateVersions)
-> ListProvisioningTemplateVersions
-> Maybe ListProvisioningTemplateVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListProvisioningTemplateVersions
rq
          ListProvisioningTemplateVersions
-> (ListProvisioningTemplateVersions
    -> ListProvisioningTemplateVersions)
-> ListProvisioningTemplateVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListProvisioningTemplateVersions
-> Identity ListProvisioningTemplateVersions
Lens
  ListProvisioningTemplateVersions
  ListProvisioningTemplateVersions
  (Maybe Text)
  (Maybe Text)
listProvisioningTemplateVersions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListProvisioningTemplateVersions
 -> Identity ListProvisioningTemplateVersions)
-> Maybe Text
-> ListProvisioningTemplateVersions
-> ListProvisioningTemplateVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListProvisioningTemplateVersions
ListProvisioningTemplateVersionsResponse
rs
          ListProvisioningTemplateVersionsResponse
-> Getting
     (First Text) ListProvisioningTemplateVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListProvisioningTemplateVersionsResponse
-> Const (First Text) ListProvisioningTemplateVersionsResponse
Lens' ListProvisioningTemplateVersionsResponse (Maybe Text)
listProvisioningTemplateVersionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListProvisioningTemplateVersionsResponse
 -> Const (First Text) ListProvisioningTemplateVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListProvisioningTemplateVersionsResponse 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
    ListProvisioningTemplateVersions
  where
  type
    AWSResponse ListProvisioningTemplateVersions =
      ListProvisioningTemplateVersionsResponse
  request :: ListProvisioningTemplateVersions
-> Request ListProvisioningTemplateVersions
request = Service
-> ListProvisioningTemplateVersions
-> Request ListProvisioningTemplateVersions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListProvisioningTemplateVersions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListProvisioningTemplateVersions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListProvisioningTemplateVersions))
-> Logger
-> Service
-> Proxy ListProvisioningTemplateVersions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListProvisioningTemplateVersions)))
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 [ProvisioningTemplateVersionSummary]
-> Maybe Text -> Int -> ListProvisioningTemplateVersionsResponse
ListProvisioningTemplateVersionsResponse'
            (Maybe [ProvisioningTemplateVersionSummary]
 -> Maybe Text -> Int -> ListProvisioningTemplateVersionsResponse)
-> Either String (Maybe [ProvisioningTemplateVersionSummary])
-> Either
     String
     (Maybe Text -> Int -> ListProvisioningTemplateVersionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Either
     String (Maybe (Maybe [ProvisioningTemplateVersionSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"versions" Either String (Maybe (Maybe [ProvisioningTemplateVersionSummary]))
-> Maybe [ProvisioningTemplateVersionSummary]
-> Either String (Maybe [ProvisioningTemplateVersionSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ProvisioningTemplateVersionSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text -> Int -> ListProvisioningTemplateVersionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListProvisioningTemplateVersionsResponse)
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 -> ListProvisioningTemplateVersionsResponse)
-> Either String Int
-> Either String ListProvisioningTemplateVersionsResponse
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
    ListProvisioningTemplateVersions

instance
  Prelude.NFData
    ListProvisioningTemplateVersions

instance
  Core.ToHeaders
    ListProvisioningTemplateVersions
  where
  toHeaders :: ListProvisioningTemplateVersions -> ResponseHeaders
toHeaders = ResponseHeaders
-> ListProvisioningTemplateVersions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance
  Core.ToQuery
    ListProvisioningTemplateVersions
  where
  toQuery :: ListProvisioningTemplateVersions -> QueryString
toQuery ListProvisioningTemplateVersions' {Maybe Natural
Maybe Text
Text
templateName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:templateName:ListProvisioningTemplateVersions' :: ListProvisioningTemplateVersions -> Text
$sel:maxResults:ListProvisioningTemplateVersions' :: ListProvisioningTemplateVersions -> Maybe Natural
$sel:nextToken:ListProvisioningTemplateVersions' :: ListProvisioningTemplateVersions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListProvisioningTemplateVersionsResponse' smart constructor.
data ListProvisioningTemplateVersionsResponse = ListProvisioningTemplateVersionsResponse'
  { -- | The list of fleet provisioning template versions.
    ListProvisioningTemplateVersionsResponse
-> Maybe [ProvisioningTemplateVersionSummary]
versions :: Prelude.Maybe [ProvisioningTemplateVersionSummary],
    -- | A token to retrieve the next set of results.
    ListProvisioningTemplateVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListProvisioningTemplateVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListProvisioningTemplateVersionsResponse
-> ListProvisioningTemplateVersionsResponse -> Bool
(ListProvisioningTemplateVersionsResponse
 -> ListProvisioningTemplateVersionsResponse -> Bool)
-> (ListProvisioningTemplateVersionsResponse
    -> ListProvisioningTemplateVersionsResponse -> Bool)
-> Eq ListProvisioningTemplateVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisioningTemplateVersionsResponse
-> ListProvisioningTemplateVersionsResponse -> Bool
$c/= :: ListProvisioningTemplateVersionsResponse
-> ListProvisioningTemplateVersionsResponse -> Bool
== :: ListProvisioningTemplateVersionsResponse
-> ListProvisioningTemplateVersionsResponse -> Bool
$c== :: ListProvisioningTemplateVersionsResponse
-> ListProvisioningTemplateVersionsResponse -> Bool
Prelude.Eq, ReadPrec [ListProvisioningTemplateVersionsResponse]
ReadPrec ListProvisioningTemplateVersionsResponse
Int -> ReadS ListProvisioningTemplateVersionsResponse
ReadS [ListProvisioningTemplateVersionsResponse]
(Int -> ReadS ListProvisioningTemplateVersionsResponse)
-> ReadS [ListProvisioningTemplateVersionsResponse]
-> ReadPrec ListProvisioningTemplateVersionsResponse
-> ReadPrec [ListProvisioningTemplateVersionsResponse]
-> Read ListProvisioningTemplateVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisioningTemplateVersionsResponse]
$creadListPrec :: ReadPrec [ListProvisioningTemplateVersionsResponse]
readPrec :: ReadPrec ListProvisioningTemplateVersionsResponse
$creadPrec :: ReadPrec ListProvisioningTemplateVersionsResponse
readList :: ReadS [ListProvisioningTemplateVersionsResponse]
$creadList :: ReadS [ListProvisioningTemplateVersionsResponse]
readsPrec :: Int -> ReadS ListProvisioningTemplateVersionsResponse
$creadsPrec :: Int -> ReadS ListProvisioningTemplateVersionsResponse
Prelude.Read, Int -> ListProvisioningTemplateVersionsResponse -> ShowS
[ListProvisioningTemplateVersionsResponse] -> ShowS
ListProvisioningTemplateVersionsResponse -> String
(Int -> ListProvisioningTemplateVersionsResponse -> ShowS)
-> (ListProvisioningTemplateVersionsResponse -> String)
-> ([ListProvisioningTemplateVersionsResponse] -> ShowS)
-> Show ListProvisioningTemplateVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisioningTemplateVersionsResponse] -> ShowS
$cshowList :: [ListProvisioningTemplateVersionsResponse] -> ShowS
show :: ListProvisioningTemplateVersionsResponse -> String
$cshow :: ListProvisioningTemplateVersionsResponse -> String
showsPrec :: Int -> ListProvisioningTemplateVersionsResponse -> ShowS
$cshowsPrec :: Int -> ListProvisioningTemplateVersionsResponse -> ShowS
Prelude.Show, (forall x.
 ListProvisioningTemplateVersionsResponse
 -> Rep ListProvisioningTemplateVersionsResponse x)
-> (forall x.
    Rep ListProvisioningTemplateVersionsResponse x
    -> ListProvisioningTemplateVersionsResponse)
-> Generic ListProvisioningTemplateVersionsResponse
forall x.
Rep ListProvisioningTemplateVersionsResponse x
-> ListProvisioningTemplateVersionsResponse
forall x.
ListProvisioningTemplateVersionsResponse
-> Rep ListProvisioningTemplateVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProvisioningTemplateVersionsResponse x
-> ListProvisioningTemplateVersionsResponse
$cfrom :: forall x.
ListProvisioningTemplateVersionsResponse
-> Rep ListProvisioningTemplateVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListProvisioningTemplateVersionsResponse' 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:
--
-- 'versions', 'listProvisioningTemplateVersionsResponse_versions' - The list of fleet provisioning template versions.
--
-- 'nextToken', 'listProvisioningTemplateVersionsResponse_nextToken' - A token to retrieve the next set of results.
--
-- 'httpStatus', 'listProvisioningTemplateVersionsResponse_httpStatus' - The response's http status code.
newListProvisioningTemplateVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListProvisioningTemplateVersionsResponse
newListProvisioningTemplateVersionsResponse :: Int -> ListProvisioningTemplateVersionsResponse
newListProvisioningTemplateVersionsResponse
  Int
pHttpStatus_ =
    ListProvisioningTemplateVersionsResponse' :: Maybe [ProvisioningTemplateVersionSummary]
-> Maybe Text -> Int -> ListProvisioningTemplateVersionsResponse
ListProvisioningTemplateVersionsResponse'
      { $sel:versions:ListProvisioningTemplateVersionsResponse' :: Maybe [ProvisioningTemplateVersionSummary]
versions =
          Maybe [ProvisioningTemplateVersionSummary]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListProvisioningTemplateVersionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListProvisioningTemplateVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The list of fleet provisioning template versions.
listProvisioningTemplateVersionsResponse_versions :: Lens.Lens' ListProvisioningTemplateVersionsResponse (Prelude.Maybe [ProvisioningTemplateVersionSummary])
listProvisioningTemplateVersionsResponse_versions :: (Maybe [ProvisioningTemplateVersionSummary]
 -> f (Maybe [ProvisioningTemplateVersionSummary]))
-> ListProvisioningTemplateVersionsResponse
-> f ListProvisioningTemplateVersionsResponse
listProvisioningTemplateVersionsResponse_versions = (ListProvisioningTemplateVersionsResponse
 -> Maybe [ProvisioningTemplateVersionSummary])
-> (ListProvisioningTemplateVersionsResponse
    -> Maybe [ProvisioningTemplateVersionSummary]
    -> ListProvisioningTemplateVersionsResponse)
-> Lens'
     ListProvisioningTemplateVersionsResponse
     (Maybe [ProvisioningTemplateVersionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplateVersionsResponse' {Maybe [ProvisioningTemplateVersionSummary]
versions :: Maybe [ProvisioningTemplateVersionSummary]
$sel:versions:ListProvisioningTemplateVersionsResponse' :: ListProvisioningTemplateVersionsResponse
-> Maybe [ProvisioningTemplateVersionSummary]
versions} -> Maybe [ProvisioningTemplateVersionSummary]
versions) (\s :: ListProvisioningTemplateVersionsResponse
s@ListProvisioningTemplateVersionsResponse' {} Maybe [ProvisioningTemplateVersionSummary]
a -> ListProvisioningTemplateVersionsResponse
s {$sel:versions:ListProvisioningTemplateVersionsResponse' :: Maybe [ProvisioningTemplateVersionSummary]
versions = Maybe [ProvisioningTemplateVersionSummary]
a} :: ListProvisioningTemplateVersionsResponse) ((Maybe [ProvisioningTemplateVersionSummary]
  -> f (Maybe [ProvisioningTemplateVersionSummary]))
 -> ListProvisioningTemplateVersionsResponse
 -> f ListProvisioningTemplateVersionsResponse)
-> ((Maybe [ProvisioningTemplateVersionSummary]
     -> f (Maybe [ProvisioningTemplateVersionSummary]))
    -> Maybe [ProvisioningTemplateVersionSummary]
    -> f (Maybe [ProvisioningTemplateVersionSummary]))
-> (Maybe [ProvisioningTemplateVersionSummary]
    -> f (Maybe [ProvisioningTemplateVersionSummary]))
-> ListProvisioningTemplateVersionsResponse
-> f ListProvisioningTemplateVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ProvisioningTemplateVersionSummary]
  [ProvisioningTemplateVersionSummary]
  [ProvisioningTemplateVersionSummary]
  [ProvisioningTemplateVersionSummary]
-> Iso
     (Maybe [ProvisioningTemplateVersionSummary])
     (Maybe [ProvisioningTemplateVersionSummary])
     (Maybe [ProvisioningTemplateVersionSummary])
     (Maybe [ProvisioningTemplateVersionSummary])
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
  [ProvisioningTemplateVersionSummary]
  [ProvisioningTemplateVersionSummary]
  [ProvisioningTemplateVersionSummary]
  [ProvisioningTemplateVersionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token to retrieve the next set of results.
listProvisioningTemplateVersionsResponse_nextToken :: Lens.Lens' ListProvisioningTemplateVersionsResponse (Prelude.Maybe Prelude.Text)
listProvisioningTemplateVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProvisioningTemplateVersionsResponse
-> f ListProvisioningTemplateVersionsResponse
listProvisioningTemplateVersionsResponse_nextToken = (ListProvisioningTemplateVersionsResponse -> Maybe Text)
-> (ListProvisioningTemplateVersionsResponse
    -> Maybe Text -> ListProvisioningTemplateVersionsResponse)
-> Lens' ListProvisioningTemplateVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplateVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProvisioningTemplateVersionsResponse' :: ListProvisioningTemplateVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProvisioningTemplateVersionsResponse
s@ListProvisioningTemplateVersionsResponse' {} Maybe Text
a -> ListProvisioningTemplateVersionsResponse
s {$sel:nextToken:ListProvisioningTemplateVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProvisioningTemplateVersionsResponse)

-- | The response's http status code.
listProvisioningTemplateVersionsResponse_httpStatus :: Lens.Lens' ListProvisioningTemplateVersionsResponse Prelude.Int
listProvisioningTemplateVersionsResponse_httpStatus :: (Int -> f Int)
-> ListProvisioningTemplateVersionsResponse
-> f ListProvisioningTemplateVersionsResponse
listProvisioningTemplateVersionsResponse_httpStatus = (ListProvisioningTemplateVersionsResponse -> Int)
-> (ListProvisioningTemplateVersionsResponse
    -> Int -> ListProvisioningTemplateVersionsResponse)
-> Lens
     ListProvisioningTemplateVersionsResponse
     ListProvisioningTemplateVersionsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningTemplateVersionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListProvisioningTemplateVersionsResponse' :: ListProvisioningTemplateVersionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListProvisioningTemplateVersionsResponse
s@ListProvisioningTemplateVersionsResponse' {} Int
a -> ListProvisioningTemplateVersionsResponse
s {$sel:httpStatus:ListProvisioningTemplateVersionsResponse' :: Int
httpStatus = Int
a} :: ListProvisioningTemplateVersionsResponse)

instance
  Prelude.NFData
    ListProvisioningTemplateVersionsResponse