{-# 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.Proton.ListServiceTemplateVersions
-- 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)
--
-- List major or minor versions of a service template with detail data.
--
-- This operation returns paginated results.
module Amazonka.Proton.ListServiceTemplateVersions
  ( -- * Creating a Request
    ListServiceTemplateVersions (..),
    newListServiceTemplateVersions,

    -- * Request Lenses
    listServiceTemplateVersions_majorVersion,
    listServiceTemplateVersions_nextToken,
    listServiceTemplateVersions_maxResults,
    listServiceTemplateVersions_templateName,

    -- * Destructuring the Response
    ListServiceTemplateVersionsResponse (..),
    newListServiceTemplateVersionsResponse,

    -- * Response Lenses
    listServiceTemplateVersionsResponse_nextToken,
    listServiceTemplateVersionsResponse_httpStatus,
    listServiceTemplateVersionsResponse_templateVersions,
  )
where

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

-- | /See:/ 'newListServiceTemplateVersions' smart constructor.
data ListServiceTemplateVersions = ListServiceTemplateVersions'
  { -- | To view a list of minor of versions under a major version of a service
    -- template, include @majorVersion@.
    --
    -- To view a list of major versions of a service template, /exclude/
    -- @majorVersion@.
    ListServiceTemplateVersions -> Maybe Text
majorVersion :: Prelude.Maybe Prelude.Text,
    -- | A token to indicate the location of the next major or minor version in
    -- the array of major or minor versions of a service template, after the
    -- list of major or minor versions that was previously requested.
    ListServiceTemplateVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of major or minor versions of a service template to
    -- list.
    ListServiceTemplateVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the service template.
    ListServiceTemplateVersions -> Text
templateName :: Prelude.Text
  }
  deriving (ListServiceTemplateVersions -> ListServiceTemplateVersions -> Bool
(ListServiceTemplateVersions
 -> ListServiceTemplateVersions -> Bool)
-> (ListServiceTemplateVersions
    -> ListServiceTemplateVersions -> Bool)
-> Eq ListServiceTemplateVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServiceTemplateVersions -> ListServiceTemplateVersions -> Bool
$c/= :: ListServiceTemplateVersions -> ListServiceTemplateVersions -> Bool
== :: ListServiceTemplateVersions -> ListServiceTemplateVersions -> Bool
$c== :: ListServiceTemplateVersions -> ListServiceTemplateVersions -> Bool
Prelude.Eq, ReadPrec [ListServiceTemplateVersions]
ReadPrec ListServiceTemplateVersions
Int -> ReadS ListServiceTemplateVersions
ReadS [ListServiceTemplateVersions]
(Int -> ReadS ListServiceTemplateVersions)
-> ReadS [ListServiceTemplateVersions]
-> ReadPrec ListServiceTemplateVersions
-> ReadPrec [ListServiceTemplateVersions]
-> Read ListServiceTemplateVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListServiceTemplateVersions]
$creadListPrec :: ReadPrec [ListServiceTemplateVersions]
readPrec :: ReadPrec ListServiceTemplateVersions
$creadPrec :: ReadPrec ListServiceTemplateVersions
readList :: ReadS [ListServiceTemplateVersions]
$creadList :: ReadS [ListServiceTemplateVersions]
readsPrec :: Int -> ReadS ListServiceTemplateVersions
$creadsPrec :: Int -> ReadS ListServiceTemplateVersions
Prelude.Read, Int -> ListServiceTemplateVersions -> ShowS
[ListServiceTemplateVersions] -> ShowS
ListServiceTemplateVersions -> String
(Int -> ListServiceTemplateVersions -> ShowS)
-> (ListServiceTemplateVersions -> String)
-> ([ListServiceTemplateVersions] -> ShowS)
-> Show ListServiceTemplateVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServiceTemplateVersions] -> ShowS
$cshowList :: [ListServiceTemplateVersions] -> ShowS
show :: ListServiceTemplateVersions -> String
$cshow :: ListServiceTemplateVersions -> String
showsPrec :: Int -> ListServiceTemplateVersions -> ShowS
$cshowsPrec :: Int -> ListServiceTemplateVersions -> ShowS
Prelude.Show, (forall x.
 ListServiceTemplateVersions -> Rep ListServiceTemplateVersions x)
-> (forall x.
    Rep ListServiceTemplateVersions x -> ListServiceTemplateVersions)
-> Generic ListServiceTemplateVersions
forall x.
Rep ListServiceTemplateVersions x -> ListServiceTemplateVersions
forall x.
ListServiceTemplateVersions -> Rep ListServiceTemplateVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListServiceTemplateVersions x -> ListServiceTemplateVersions
$cfrom :: forall x.
ListServiceTemplateVersions -> Rep ListServiceTemplateVersions x
Prelude.Generic)

-- |
-- Create a value of 'ListServiceTemplateVersions' 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:
--
-- 'majorVersion', 'listServiceTemplateVersions_majorVersion' - To view a list of minor of versions under a major version of a service
-- template, include @majorVersion@.
--
-- To view a list of major versions of a service template, /exclude/
-- @majorVersion@.
--
-- 'nextToken', 'listServiceTemplateVersions_nextToken' - A token to indicate the location of the next major or minor version in
-- the array of major or minor versions of a service template, after the
-- list of major or minor versions that was previously requested.
--
-- 'maxResults', 'listServiceTemplateVersions_maxResults' - The maximum number of major or minor versions of a service template to
-- list.
--
-- 'templateName', 'listServiceTemplateVersions_templateName' - The name of the service template.
newListServiceTemplateVersions ::
  -- | 'templateName'
  Prelude.Text ->
  ListServiceTemplateVersions
newListServiceTemplateVersions :: Text -> ListServiceTemplateVersions
newListServiceTemplateVersions Text
pTemplateName_ =
  ListServiceTemplateVersions' :: Maybe Text
-> Maybe Text
-> Maybe Natural
-> Text
-> ListServiceTemplateVersions
ListServiceTemplateVersions'
    { $sel:majorVersion:ListServiceTemplateVersions' :: Maybe Text
majorVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListServiceTemplateVersions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListServiceTemplateVersions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:templateName:ListServiceTemplateVersions' :: Text
templateName = Text
pTemplateName_
    }

-- | To view a list of minor of versions under a major version of a service
-- template, include @majorVersion@.
--
-- To view a list of major versions of a service template, /exclude/
-- @majorVersion@.
listServiceTemplateVersions_majorVersion :: Lens.Lens' ListServiceTemplateVersions (Prelude.Maybe Prelude.Text)
listServiceTemplateVersions_majorVersion :: (Maybe Text -> f (Maybe Text))
-> ListServiceTemplateVersions -> f ListServiceTemplateVersions
listServiceTemplateVersions_majorVersion = (ListServiceTemplateVersions -> Maybe Text)
-> (ListServiceTemplateVersions
    -> Maybe Text -> ListServiceTemplateVersions)
-> Lens
     ListServiceTemplateVersions
     ListServiceTemplateVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceTemplateVersions' {Maybe Text
majorVersion :: Maybe Text
$sel:majorVersion:ListServiceTemplateVersions' :: ListServiceTemplateVersions -> Maybe Text
majorVersion} -> Maybe Text
majorVersion) (\s :: ListServiceTemplateVersions
s@ListServiceTemplateVersions' {} Maybe Text
a -> ListServiceTemplateVersions
s {$sel:majorVersion:ListServiceTemplateVersions' :: Maybe Text
majorVersion = Maybe Text
a} :: ListServiceTemplateVersions)

-- | A token to indicate the location of the next major or minor version in
-- the array of major or minor versions of a service template, after the
-- list of major or minor versions that was previously requested.
listServiceTemplateVersions_nextToken :: Lens.Lens' ListServiceTemplateVersions (Prelude.Maybe Prelude.Text)
listServiceTemplateVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListServiceTemplateVersions -> f ListServiceTemplateVersions
listServiceTemplateVersions_nextToken = (ListServiceTemplateVersions -> Maybe Text)
-> (ListServiceTemplateVersions
    -> Maybe Text -> ListServiceTemplateVersions)
-> Lens
     ListServiceTemplateVersions
     ListServiceTemplateVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceTemplateVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServiceTemplateVersions' :: ListServiceTemplateVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServiceTemplateVersions
s@ListServiceTemplateVersions' {} Maybe Text
a -> ListServiceTemplateVersions
s {$sel:nextToken:ListServiceTemplateVersions' :: Maybe Text
nextToken = Maybe Text
a} :: ListServiceTemplateVersions)

-- | The maximum number of major or minor versions of a service template to
-- list.
listServiceTemplateVersions_maxResults :: Lens.Lens' ListServiceTemplateVersions (Prelude.Maybe Prelude.Natural)
listServiceTemplateVersions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListServiceTemplateVersions -> f ListServiceTemplateVersions
listServiceTemplateVersions_maxResults = (ListServiceTemplateVersions -> Maybe Natural)
-> (ListServiceTemplateVersions
    -> Maybe Natural -> ListServiceTemplateVersions)
-> Lens
     ListServiceTemplateVersions
     ListServiceTemplateVersions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceTemplateVersions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListServiceTemplateVersions' :: ListServiceTemplateVersions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListServiceTemplateVersions
s@ListServiceTemplateVersions' {} Maybe Natural
a -> ListServiceTemplateVersions
s {$sel:maxResults:ListServiceTemplateVersions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListServiceTemplateVersions)

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

instance Core.AWSPager ListServiceTemplateVersions where
  page :: ListServiceTemplateVersions
-> AWSResponse ListServiceTemplateVersions
-> Maybe ListServiceTemplateVersions
page ListServiceTemplateVersions
rq AWSResponse ListServiceTemplateVersions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListServiceTemplateVersions
ListServiceTemplateVersionsResponse
rs
            ListServiceTemplateVersionsResponse
-> Getting (First Text) ListServiceTemplateVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListServiceTemplateVersionsResponse
-> Const (First Text) ListServiceTemplateVersionsResponse
Lens' ListServiceTemplateVersionsResponse (Maybe Text)
listServiceTemplateVersionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListServiceTemplateVersionsResponse
 -> Const (First Text) ListServiceTemplateVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListServiceTemplateVersionsResponse 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 ListServiceTemplateVersions
forall a. Maybe a
Prelude.Nothing
    | [ServiceTemplateVersionSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListServiceTemplateVersions
ListServiceTemplateVersionsResponse
rs
            ListServiceTemplateVersionsResponse
-> Getting
     [ServiceTemplateVersionSummary]
     ListServiceTemplateVersionsResponse
     [ServiceTemplateVersionSummary]
-> [ServiceTemplateVersionSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [ServiceTemplateVersionSummary]
  ListServiceTemplateVersionsResponse
  [ServiceTemplateVersionSummary]
Lens'
  ListServiceTemplateVersionsResponse [ServiceTemplateVersionSummary]
listServiceTemplateVersionsResponse_templateVersions
        ) =
      Maybe ListServiceTemplateVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListServiceTemplateVersions -> Maybe ListServiceTemplateVersions
forall a. a -> Maybe a
Prelude.Just (ListServiceTemplateVersions -> Maybe ListServiceTemplateVersions)
-> ListServiceTemplateVersions -> Maybe ListServiceTemplateVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListServiceTemplateVersions
rq
          ListServiceTemplateVersions
-> (ListServiceTemplateVersions -> ListServiceTemplateVersions)
-> ListServiceTemplateVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListServiceTemplateVersions
-> Identity ListServiceTemplateVersions
Lens
  ListServiceTemplateVersions
  ListServiceTemplateVersions
  (Maybe Text)
  (Maybe Text)
listServiceTemplateVersions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListServiceTemplateVersions
 -> Identity ListServiceTemplateVersions)
-> Maybe Text
-> ListServiceTemplateVersions
-> ListServiceTemplateVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListServiceTemplateVersions
ListServiceTemplateVersionsResponse
rs
          ListServiceTemplateVersionsResponse
-> Getting (First Text) ListServiceTemplateVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListServiceTemplateVersionsResponse
-> Const (First Text) ListServiceTemplateVersionsResponse
Lens' ListServiceTemplateVersionsResponse (Maybe Text)
listServiceTemplateVersionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListServiceTemplateVersionsResponse
 -> Const (First Text) ListServiceTemplateVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListServiceTemplateVersionsResponse 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 ListServiceTemplateVersions where
  type
    AWSResponse ListServiceTemplateVersions =
      ListServiceTemplateVersionsResponse
  request :: ListServiceTemplateVersions -> Request ListServiceTemplateVersions
request = Service
-> ListServiceTemplateVersions
-> Request ListServiceTemplateVersions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListServiceTemplateVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListServiceTemplateVersions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListServiceTemplateVersions))
-> Logger
-> Service
-> Proxy ListServiceTemplateVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListServiceTemplateVersions)))
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
-> Int
-> [ServiceTemplateVersionSummary]
-> ListServiceTemplateVersionsResponse
ListServiceTemplateVersionsResponse'
            (Maybe Text
 -> Int
 -> [ServiceTemplateVersionSummary]
 -> ListServiceTemplateVersionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int
      -> [ServiceTemplateVersionSummary]
      -> ListServiceTemplateVersionsResponse)
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
"nextToken")
            Either
  String
  (Int
   -> [ServiceTemplateVersionSummary]
   -> ListServiceTemplateVersionsResponse)
-> Either String Int
-> Either
     String
     ([ServiceTemplateVersionSummary]
      -> ListServiceTemplateVersionsResponse)
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))
            Either
  String
  ([ServiceTemplateVersionSummary]
   -> ListServiceTemplateVersionsResponse)
-> Either String [ServiceTemplateVersionSummary]
-> Either String ListServiceTemplateVersionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe [ServiceTemplateVersionSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"templateVersions"
                            Either String (Maybe [ServiceTemplateVersionSummary])
-> [ServiceTemplateVersionSummary]
-> Either String [ServiceTemplateVersionSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ServiceTemplateVersionSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListServiceTemplateVersions

instance Prelude.NFData ListServiceTemplateVersions

instance Core.ToHeaders ListServiceTemplateVersions where
  toHeaders :: ListServiceTemplateVersions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListServiceTemplateVersions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AwsProton20200720.ListServiceTemplateVersions" ::
                          Prelude.ByteString
                      ),
            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.ToJSON ListServiceTemplateVersions where
  toJSON :: ListServiceTemplateVersions -> Value
toJSON ListServiceTemplateVersions' {Maybe Natural
Maybe Text
Text
templateName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
majorVersion :: Maybe Text
$sel:templateName:ListServiceTemplateVersions' :: ListServiceTemplateVersions -> Text
$sel:maxResults:ListServiceTemplateVersions' :: ListServiceTemplateVersions -> Maybe Natural
$sel:nextToken:ListServiceTemplateVersions' :: ListServiceTemplateVersions -> Maybe Text
$sel:majorVersion:ListServiceTemplateVersions' :: ListServiceTemplateVersions -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"majorVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
majorVersion,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"templateName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
templateName)
          ]
      )

instance Core.ToPath ListServiceTemplateVersions where
  toPath :: ListServiceTemplateVersions -> ByteString
toPath = ByteString -> ListServiceTemplateVersions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListServiceTemplateVersions where
  toQuery :: ListServiceTemplateVersions -> QueryString
toQuery = QueryString -> ListServiceTemplateVersions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListServiceTemplateVersionsResponse' smart constructor.
data ListServiceTemplateVersionsResponse = ListServiceTemplateVersionsResponse'
  { -- | A token to indicate the location of the next major or minor version in
    -- the array of major or minor versions of a service template, after the
    -- list of major or minor versions that was previously requested.
    ListServiceTemplateVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListServiceTemplateVersionsResponse -> Int
httpStatus :: Prelude.Int,
    -- | An array of major or minor versions of a service template with detail
    -- data.
    ListServiceTemplateVersionsResponse
-> [ServiceTemplateVersionSummary]
templateVersions :: [ServiceTemplateVersionSummary]
  }
  deriving (ListServiceTemplateVersionsResponse
-> ListServiceTemplateVersionsResponse -> Bool
(ListServiceTemplateVersionsResponse
 -> ListServiceTemplateVersionsResponse -> Bool)
-> (ListServiceTemplateVersionsResponse
    -> ListServiceTemplateVersionsResponse -> Bool)
-> Eq ListServiceTemplateVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServiceTemplateVersionsResponse
-> ListServiceTemplateVersionsResponse -> Bool
$c/= :: ListServiceTemplateVersionsResponse
-> ListServiceTemplateVersionsResponse -> Bool
== :: ListServiceTemplateVersionsResponse
-> ListServiceTemplateVersionsResponse -> Bool
$c== :: ListServiceTemplateVersionsResponse
-> ListServiceTemplateVersionsResponse -> Bool
Prelude.Eq, Int -> ListServiceTemplateVersionsResponse -> ShowS
[ListServiceTemplateVersionsResponse] -> ShowS
ListServiceTemplateVersionsResponse -> String
(Int -> ListServiceTemplateVersionsResponse -> ShowS)
-> (ListServiceTemplateVersionsResponse -> String)
-> ([ListServiceTemplateVersionsResponse] -> ShowS)
-> Show ListServiceTemplateVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServiceTemplateVersionsResponse] -> ShowS
$cshowList :: [ListServiceTemplateVersionsResponse] -> ShowS
show :: ListServiceTemplateVersionsResponse -> String
$cshow :: ListServiceTemplateVersionsResponse -> String
showsPrec :: Int -> ListServiceTemplateVersionsResponse -> ShowS
$cshowsPrec :: Int -> ListServiceTemplateVersionsResponse -> ShowS
Prelude.Show, (forall x.
 ListServiceTemplateVersionsResponse
 -> Rep ListServiceTemplateVersionsResponse x)
-> (forall x.
    Rep ListServiceTemplateVersionsResponse x
    -> ListServiceTemplateVersionsResponse)
-> Generic ListServiceTemplateVersionsResponse
forall x.
Rep ListServiceTemplateVersionsResponse x
-> ListServiceTemplateVersionsResponse
forall x.
ListServiceTemplateVersionsResponse
-> Rep ListServiceTemplateVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListServiceTemplateVersionsResponse x
-> ListServiceTemplateVersionsResponse
$cfrom :: forall x.
ListServiceTemplateVersionsResponse
-> Rep ListServiceTemplateVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListServiceTemplateVersionsResponse' 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', 'listServiceTemplateVersionsResponse_nextToken' - A token to indicate the location of the next major or minor version in
-- the array of major or minor versions of a service template, after the
-- list of major or minor versions that was previously requested.
--
-- 'httpStatus', 'listServiceTemplateVersionsResponse_httpStatus' - The response's http status code.
--
-- 'templateVersions', 'listServiceTemplateVersionsResponse_templateVersions' - An array of major or minor versions of a service template with detail
-- data.
newListServiceTemplateVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListServiceTemplateVersionsResponse
newListServiceTemplateVersionsResponse :: Int -> ListServiceTemplateVersionsResponse
newListServiceTemplateVersionsResponse Int
pHttpStatus_ =
  ListServiceTemplateVersionsResponse' :: Maybe Text
-> Int
-> [ServiceTemplateVersionSummary]
-> ListServiceTemplateVersionsResponse
ListServiceTemplateVersionsResponse'
    { $sel:nextToken:ListServiceTemplateVersionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListServiceTemplateVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:templateVersions:ListServiceTemplateVersionsResponse' :: [ServiceTemplateVersionSummary]
templateVersions = [ServiceTemplateVersionSummary]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A token to indicate the location of the next major or minor version in
-- the array of major or minor versions of a service template, after the
-- list of major or minor versions that was previously requested.
listServiceTemplateVersionsResponse_nextToken :: Lens.Lens' ListServiceTemplateVersionsResponse (Prelude.Maybe Prelude.Text)
listServiceTemplateVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListServiceTemplateVersionsResponse
-> f ListServiceTemplateVersionsResponse
listServiceTemplateVersionsResponse_nextToken = (ListServiceTemplateVersionsResponse -> Maybe Text)
-> (ListServiceTemplateVersionsResponse
    -> Maybe Text -> ListServiceTemplateVersionsResponse)
-> Lens' ListServiceTemplateVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceTemplateVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServiceTemplateVersionsResponse' :: ListServiceTemplateVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServiceTemplateVersionsResponse
s@ListServiceTemplateVersionsResponse' {} Maybe Text
a -> ListServiceTemplateVersionsResponse
s {$sel:nextToken:ListServiceTemplateVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListServiceTemplateVersionsResponse)

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

-- | An array of major or minor versions of a service template with detail
-- data.
listServiceTemplateVersionsResponse_templateVersions :: Lens.Lens' ListServiceTemplateVersionsResponse [ServiceTemplateVersionSummary]
listServiceTemplateVersionsResponse_templateVersions :: ([ServiceTemplateVersionSummary]
 -> f [ServiceTemplateVersionSummary])
-> ListServiceTemplateVersionsResponse
-> f ListServiceTemplateVersionsResponse
listServiceTemplateVersionsResponse_templateVersions = (ListServiceTemplateVersionsResponse
 -> [ServiceTemplateVersionSummary])
-> (ListServiceTemplateVersionsResponse
    -> [ServiceTemplateVersionSummary]
    -> ListServiceTemplateVersionsResponse)
-> Lens'
     ListServiceTemplateVersionsResponse [ServiceTemplateVersionSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceTemplateVersionsResponse' {[ServiceTemplateVersionSummary]
templateVersions :: [ServiceTemplateVersionSummary]
$sel:templateVersions:ListServiceTemplateVersionsResponse' :: ListServiceTemplateVersionsResponse
-> [ServiceTemplateVersionSummary]
templateVersions} -> [ServiceTemplateVersionSummary]
templateVersions) (\s :: ListServiceTemplateVersionsResponse
s@ListServiceTemplateVersionsResponse' {} [ServiceTemplateVersionSummary]
a -> ListServiceTemplateVersionsResponse
s {$sel:templateVersions:ListServiceTemplateVersionsResponse' :: [ServiceTemplateVersionSummary]
templateVersions = [ServiceTemplateVersionSummary]
a} :: ListServiceTemplateVersionsResponse) (([ServiceTemplateVersionSummary]
  -> f [ServiceTemplateVersionSummary])
 -> ListServiceTemplateVersionsResponse
 -> f ListServiceTemplateVersionsResponse)
-> (([ServiceTemplateVersionSummary]
     -> f [ServiceTemplateVersionSummary])
    -> [ServiceTemplateVersionSummary]
    -> f [ServiceTemplateVersionSummary])
-> ([ServiceTemplateVersionSummary]
    -> f [ServiceTemplateVersionSummary])
-> ListServiceTemplateVersionsResponse
-> f ListServiceTemplateVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ServiceTemplateVersionSummary]
 -> f [ServiceTemplateVersionSummary])
-> [ServiceTemplateVersionSummary]
-> f [ServiceTemplateVersionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListServiceTemplateVersionsResponse