{-# 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.ListEnvironmentTemplateVersions
-- 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 an environment template with detail
-- data.
--
-- This operation returns paginated results.
module Amazonka.Proton.ListEnvironmentTemplateVersions
  ( -- * Creating a Request
    ListEnvironmentTemplateVersions (..),
    newListEnvironmentTemplateVersions,

    -- * Request Lenses
    listEnvironmentTemplateVersions_majorVersion,
    listEnvironmentTemplateVersions_nextToken,
    listEnvironmentTemplateVersions_maxResults,
    listEnvironmentTemplateVersions_templateName,

    -- * Destructuring the Response
    ListEnvironmentTemplateVersionsResponse (..),
    newListEnvironmentTemplateVersionsResponse,

    -- * Response Lenses
    listEnvironmentTemplateVersionsResponse_nextToken,
    listEnvironmentTemplateVersionsResponse_httpStatus,
    listEnvironmentTemplateVersionsResponse_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:/ 'newListEnvironmentTemplateVersions' smart constructor.
data ListEnvironmentTemplateVersions = ListEnvironmentTemplateVersions'
  { -- | To view a list of minor of versions under a major version of an
    -- environment template, include @majorVersion@.
    --
    -- To view a list of major versions of an environment template, /exclude/
    -- @majorVersion@.
    ListEnvironmentTemplateVersions -> 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 an environment template, after
    -- the list of major or minor versions that was previously requested.
    ListEnvironmentTemplateVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of major or minor versions of an environment template
    -- to list.
    ListEnvironmentTemplateVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the environment template.
    ListEnvironmentTemplateVersions -> Text
templateName :: Prelude.Text
  }
  deriving (ListEnvironmentTemplateVersions
-> ListEnvironmentTemplateVersions -> Bool
(ListEnvironmentTemplateVersions
 -> ListEnvironmentTemplateVersions -> Bool)
-> (ListEnvironmentTemplateVersions
    -> ListEnvironmentTemplateVersions -> Bool)
-> Eq ListEnvironmentTemplateVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEnvironmentTemplateVersions
-> ListEnvironmentTemplateVersions -> Bool
$c/= :: ListEnvironmentTemplateVersions
-> ListEnvironmentTemplateVersions -> Bool
== :: ListEnvironmentTemplateVersions
-> ListEnvironmentTemplateVersions -> Bool
$c== :: ListEnvironmentTemplateVersions
-> ListEnvironmentTemplateVersions -> Bool
Prelude.Eq, ReadPrec [ListEnvironmentTemplateVersions]
ReadPrec ListEnvironmentTemplateVersions
Int -> ReadS ListEnvironmentTemplateVersions
ReadS [ListEnvironmentTemplateVersions]
(Int -> ReadS ListEnvironmentTemplateVersions)
-> ReadS [ListEnvironmentTemplateVersions]
-> ReadPrec ListEnvironmentTemplateVersions
-> ReadPrec [ListEnvironmentTemplateVersions]
-> Read ListEnvironmentTemplateVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEnvironmentTemplateVersions]
$creadListPrec :: ReadPrec [ListEnvironmentTemplateVersions]
readPrec :: ReadPrec ListEnvironmentTemplateVersions
$creadPrec :: ReadPrec ListEnvironmentTemplateVersions
readList :: ReadS [ListEnvironmentTemplateVersions]
$creadList :: ReadS [ListEnvironmentTemplateVersions]
readsPrec :: Int -> ReadS ListEnvironmentTemplateVersions
$creadsPrec :: Int -> ReadS ListEnvironmentTemplateVersions
Prelude.Read, Int -> ListEnvironmentTemplateVersions -> ShowS
[ListEnvironmentTemplateVersions] -> ShowS
ListEnvironmentTemplateVersions -> String
(Int -> ListEnvironmentTemplateVersions -> ShowS)
-> (ListEnvironmentTemplateVersions -> String)
-> ([ListEnvironmentTemplateVersions] -> ShowS)
-> Show ListEnvironmentTemplateVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEnvironmentTemplateVersions] -> ShowS
$cshowList :: [ListEnvironmentTemplateVersions] -> ShowS
show :: ListEnvironmentTemplateVersions -> String
$cshow :: ListEnvironmentTemplateVersions -> String
showsPrec :: Int -> ListEnvironmentTemplateVersions -> ShowS
$cshowsPrec :: Int -> ListEnvironmentTemplateVersions -> ShowS
Prelude.Show, (forall x.
 ListEnvironmentTemplateVersions
 -> Rep ListEnvironmentTemplateVersions x)
-> (forall x.
    Rep ListEnvironmentTemplateVersions x
    -> ListEnvironmentTemplateVersions)
-> Generic ListEnvironmentTemplateVersions
forall x.
Rep ListEnvironmentTemplateVersions x
-> ListEnvironmentTemplateVersions
forall x.
ListEnvironmentTemplateVersions
-> Rep ListEnvironmentTemplateVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEnvironmentTemplateVersions x
-> ListEnvironmentTemplateVersions
$cfrom :: forall x.
ListEnvironmentTemplateVersions
-> Rep ListEnvironmentTemplateVersions x
Prelude.Generic)

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

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

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

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

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

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

instance
  Prelude.Hashable
    ListEnvironmentTemplateVersions

instance
  Prelude.NFData
    ListEnvironmentTemplateVersions

instance
  Core.ToHeaders
    ListEnvironmentTemplateVersions
  where
  toHeaders :: ListEnvironmentTemplateVersions -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListEnvironmentTemplateVersions -> 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.ListEnvironmentTemplateVersions" ::
                          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 ListEnvironmentTemplateVersions where
  toJSON :: ListEnvironmentTemplateVersions -> Value
toJSON ListEnvironmentTemplateVersions' {Maybe Natural
Maybe Text
Text
templateName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
majorVersion :: Maybe Text
$sel:templateName:ListEnvironmentTemplateVersions' :: ListEnvironmentTemplateVersions -> Text
$sel:maxResults:ListEnvironmentTemplateVersions' :: ListEnvironmentTemplateVersions -> Maybe Natural
$sel:nextToken:ListEnvironmentTemplateVersions' :: ListEnvironmentTemplateVersions -> Maybe Text
$sel:majorVersion:ListEnvironmentTemplateVersions' :: ListEnvironmentTemplateVersions -> 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 ListEnvironmentTemplateVersions where
  toPath :: ListEnvironmentTemplateVersions -> ByteString
toPath = ByteString -> ListEnvironmentTemplateVersions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ListEnvironmentTemplateVersionsResponse' 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', 'listEnvironmentTemplateVersionsResponse_nextToken' - A token to indicate the location of the next major or minor version in
-- the array of major or minor versions of an environment template, after
-- the list of major or minor versions that was previously requested.
--
-- 'httpStatus', 'listEnvironmentTemplateVersionsResponse_httpStatus' - The response's http status code.
--
-- 'templateVersions', 'listEnvironmentTemplateVersionsResponse_templateVersions' - An array of major or minor versions of an environment template detail
-- data.
newListEnvironmentTemplateVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEnvironmentTemplateVersionsResponse
newListEnvironmentTemplateVersionsResponse :: Int -> ListEnvironmentTemplateVersionsResponse
newListEnvironmentTemplateVersionsResponse
  Int
pHttpStatus_ =
    ListEnvironmentTemplateVersionsResponse' :: Maybe Text
-> Int
-> [EnvironmentTemplateVersionSummary]
-> ListEnvironmentTemplateVersionsResponse
ListEnvironmentTemplateVersionsResponse'
      { $sel:nextToken:ListEnvironmentTemplateVersionsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListEnvironmentTemplateVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:templateVersions:ListEnvironmentTemplateVersionsResponse' :: [EnvironmentTemplateVersionSummary]
templateVersions = [EnvironmentTemplateVersionSummary]
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 an environment template, after
-- the list of major or minor versions that was previously requested.
listEnvironmentTemplateVersionsResponse_nextToken :: Lens.Lens' ListEnvironmentTemplateVersionsResponse (Prelude.Maybe Prelude.Text)
listEnvironmentTemplateVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEnvironmentTemplateVersionsResponse
-> f ListEnvironmentTemplateVersionsResponse
listEnvironmentTemplateVersionsResponse_nextToken = (ListEnvironmentTemplateVersionsResponse -> Maybe Text)
-> (ListEnvironmentTemplateVersionsResponse
    -> Maybe Text -> ListEnvironmentTemplateVersionsResponse)
-> Lens' ListEnvironmentTemplateVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentTemplateVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEnvironmentTemplateVersionsResponse' :: ListEnvironmentTemplateVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEnvironmentTemplateVersionsResponse
s@ListEnvironmentTemplateVersionsResponse' {} Maybe Text
a -> ListEnvironmentTemplateVersionsResponse
s {$sel:nextToken:ListEnvironmentTemplateVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEnvironmentTemplateVersionsResponse)

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

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

instance
  Prelude.NFData
    ListEnvironmentTemplateVersionsResponse