{-# 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.ElasticBeanstalk.DescribeApplicationVersions
-- 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)
--
-- Retrieve a list of application versions.
--
-- This operation returns paginated results.
module Amazonka.ElasticBeanstalk.DescribeApplicationVersions
  ( -- * Creating a Request
    DescribeApplicationVersions (..),
    newDescribeApplicationVersions,

    -- * Request Lenses
    describeApplicationVersions_versionLabels,
    describeApplicationVersions_nextToken,
    describeApplicationVersions_maxRecords,
    describeApplicationVersions_applicationName,

    -- * Destructuring the Response
    DescribeApplicationVersionsResponse (..),
    newDescribeApplicationVersionsResponse,

    -- * Response Lenses
    describeApplicationVersionsResponse_applicationVersions,
    describeApplicationVersionsResponse_nextToken,
    describeApplicationVersionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElasticBeanstalk.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

-- | Request to describe application versions.
--
-- /See:/ 'newDescribeApplicationVersions' smart constructor.
data DescribeApplicationVersions = DescribeApplicationVersions'
  { -- | Specify a version label to show a specific application version.
    DescribeApplicationVersions -> Maybe [Text]
versionLabels :: Prelude.Maybe [Prelude.Text],
    -- | For a paginated request. Specify a token from a previous response page
    -- to retrieve the next response page. All other parameter values must be
    -- identical to the ones specified in the initial request.
    --
    -- If no @NextToken@ is specified, the first page is retrieved.
    DescribeApplicationVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | For a paginated request. Specify a maximum number of application
    -- versions to include in each response.
    --
    -- If no @MaxRecords@ is specified, all available application versions are
    -- retrieved in a single response.
    DescribeApplicationVersions -> Maybe Natural
maxRecords :: Prelude.Maybe Prelude.Natural,
    -- | Specify an application name to show only application versions for that
    -- application.
    DescribeApplicationVersions -> Maybe Text
applicationName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeApplicationVersions -> DescribeApplicationVersions -> Bool
(DescribeApplicationVersions
 -> DescribeApplicationVersions -> Bool)
-> (DescribeApplicationVersions
    -> DescribeApplicationVersions -> Bool)
-> Eq DescribeApplicationVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplicationVersions -> DescribeApplicationVersions -> Bool
$c/= :: DescribeApplicationVersions -> DescribeApplicationVersions -> Bool
== :: DescribeApplicationVersions -> DescribeApplicationVersions -> Bool
$c== :: DescribeApplicationVersions -> DescribeApplicationVersions -> Bool
Prelude.Eq, ReadPrec [DescribeApplicationVersions]
ReadPrec DescribeApplicationVersions
Int -> ReadS DescribeApplicationVersions
ReadS [DescribeApplicationVersions]
(Int -> ReadS DescribeApplicationVersions)
-> ReadS [DescribeApplicationVersions]
-> ReadPrec DescribeApplicationVersions
-> ReadPrec [DescribeApplicationVersions]
-> Read DescribeApplicationVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplicationVersions]
$creadListPrec :: ReadPrec [DescribeApplicationVersions]
readPrec :: ReadPrec DescribeApplicationVersions
$creadPrec :: ReadPrec DescribeApplicationVersions
readList :: ReadS [DescribeApplicationVersions]
$creadList :: ReadS [DescribeApplicationVersions]
readsPrec :: Int -> ReadS DescribeApplicationVersions
$creadsPrec :: Int -> ReadS DescribeApplicationVersions
Prelude.Read, Int -> DescribeApplicationVersions -> ShowS
[DescribeApplicationVersions] -> ShowS
DescribeApplicationVersions -> String
(Int -> DescribeApplicationVersions -> ShowS)
-> (DescribeApplicationVersions -> String)
-> ([DescribeApplicationVersions] -> ShowS)
-> Show DescribeApplicationVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplicationVersions] -> ShowS
$cshowList :: [DescribeApplicationVersions] -> ShowS
show :: DescribeApplicationVersions -> String
$cshow :: DescribeApplicationVersions -> String
showsPrec :: Int -> DescribeApplicationVersions -> ShowS
$cshowsPrec :: Int -> DescribeApplicationVersions -> ShowS
Prelude.Show, (forall x.
 DescribeApplicationVersions -> Rep DescribeApplicationVersions x)
-> (forall x.
    Rep DescribeApplicationVersions x -> DescribeApplicationVersions)
-> Generic DescribeApplicationVersions
forall x.
Rep DescribeApplicationVersions x -> DescribeApplicationVersions
forall x.
DescribeApplicationVersions -> Rep DescribeApplicationVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeApplicationVersions x -> DescribeApplicationVersions
$cfrom :: forall x.
DescribeApplicationVersions -> Rep DescribeApplicationVersions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeApplicationVersions' 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:
--
-- 'versionLabels', 'describeApplicationVersions_versionLabels' - Specify a version label to show a specific application version.
--
-- 'nextToken', 'describeApplicationVersions_nextToken' - For a paginated request. Specify a token from a previous response page
-- to retrieve the next response page. All other parameter values must be
-- identical to the ones specified in the initial request.
--
-- If no @NextToken@ is specified, the first page is retrieved.
--
-- 'maxRecords', 'describeApplicationVersions_maxRecords' - For a paginated request. Specify a maximum number of application
-- versions to include in each response.
--
-- If no @MaxRecords@ is specified, all available application versions are
-- retrieved in a single response.
--
-- 'applicationName', 'describeApplicationVersions_applicationName' - Specify an application name to show only application versions for that
-- application.
newDescribeApplicationVersions ::
  DescribeApplicationVersions
newDescribeApplicationVersions :: DescribeApplicationVersions
newDescribeApplicationVersions =
  DescribeApplicationVersions' :: Maybe [Text]
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> DescribeApplicationVersions
DescribeApplicationVersions'
    { $sel:versionLabels:DescribeApplicationVersions' :: Maybe [Text]
versionLabels =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeApplicationVersions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeApplicationVersions' :: Maybe Natural
maxRecords = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationName:DescribeApplicationVersions' :: Maybe Text
applicationName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specify a version label to show a specific application version.
describeApplicationVersions_versionLabels :: Lens.Lens' DescribeApplicationVersions (Prelude.Maybe [Prelude.Text])
describeApplicationVersions_versionLabels :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeApplicationVersions -> f DescribeApplicationVersions
describeApplicationVersions_versionLabels = (DescribeApplicationVersions -> Maybe [Text])
-> (DescribeApplicationVersions
    -> Maybe [Text] -> DescribeApplicationVersions)
-> Lens
     DescribeApplicationVersions
     DescribeApplicationVersions
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersions' {Maybe [Text]
versionLabels :: Maybe [Text]
$sel:versionLabels:DescribeApplicationVersions' :: DescribeApplicationVersions -> Maybe [Text]
versionLabels} -> Maybe [Text]
versionLabels) (\s :: DescribeApplicationVersions
s@DescribeApplicationVersions' {} Maybe [Text]
a -> DescribeApplicationVersions
s {$sel:versionLabels:DescribeApplicationVersions' :: Maybe [Text]
versionLabels = Maybe [Text]
a} :: DescribeApplicationVersions) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeApplicationVersions -> f DescribeApplicationVersions)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeApplicationVersions
-> f DescribeApplicationVersions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | For a paginated request. Specify a token from a previous response page
-- to retrieve the next response page. All other parameter values must be
-- identical to the ones specified in the initial request.
--
-- If no @NextToken@ is specified, the first page is retrieved.
describeApplicationVersions_nextToken :: Lens.Lens' DescribeApplicationVersions (Prelude.Maybe Prelude.Text)
describeApplicationVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeApplicationVersions -> f DescribeApplicationVersions
describeApplicationVersions_nextToken = (DescribeApplicationVersions -> Maybe Text)
-> (DescribeApplicationVersions
    -> Maybe Text -> DescribeApplicationVersions)
-> Lens
     DescribeApplicationVersions
     DescribeApplicationVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeApplicationVersions' :: DescribeApplicationVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeApplicationVersions
s@DescribeApplicationVersions' {} Maybe Text
a -> DescribeApplicationVersions
s {$sel:nextToken:DescribeApplicationVersions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeApplicationVersions)

-- | For a paginated request. Specify a maximum number of application
-- versions to include in each response.
--
-- If no @MaxRecords@ is specified, all available application versions are
-- retrieved in a single response.
describeApplicationVersions_maxRecords :: Lens.Lens' DescribeApplicationVersions (Prelude.Maybe Prelude.Natural)
describeApplicationVersions_maxRecords :: (Maybe Natural -> f (Maybe Natural))
-> DescribeApplicationVersions -> f DescribeApplicationVersions
describeApplicationVersions_maxRecords = (DescribeApplicationVersions -> Maybe Natural)
-> (DescribeApplicationVersions
    -> Maybe Natural -> DescribeApplicationVersions)
-> Lens
     DescribeApplicationVersions
     DescribeApplicationVersions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersions' {Maybe Natural
maxRecords :: Maybe Natural
$sel:maxRecords:DescribeApplicationVersions' :: DescribeApplicationVersions -> Maybe Natural
maxRecords} -> Maybe Natural
maxRecords) (\s :: DescribeApplicationVersions
s@DescribeApplicationVersions' {} Maybe Natural
a -> DescribeApplicationVersions
s {$sel:maxRecords:DescribeApplicationVersions' :: Maybe Natural
maxRecords = Maybe Natural
a} :: DescribeApplicationVersions)

-- | Specify an application name to show only application versions for that
-- application.
describeApplicationVersions_applicationName :: Lens.Lens' DescribeApplicationVersions (Prelude.Maybe Prelude.Text)
describeApplicationVersions_applicationName :: (Maybe Text -> f (Maybe Text))
-> DescribeApplicationVersions -> f DescribeApplicationVersions
describeApplicationVersions_applicationName = (DescribeApplicationVersions -> Maybe Text)
-> (DescribeApplicationVersions
    -> Maybe Text -> DescribeApplicationVersions)
-> Lens
     DescribeApplicationVersions
     DescribeApplicationVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersions' {Maybe Text
applicationName :: Maybe Text
$sel:applicationName:DescribeApplicationVersions' :: DescribeApplicationVersions -> Maybe Text
applicationName} -> Maybe Text
applicationName) (\s :: DescribeApplicationVersions
s@DescribeApplicationVersions' {} Maybe Text
a -> DescribeApplicationVersions
s {$sel:applicationName:DescribeApplicationVersions' :: Maybe Text
applicationName = Maybe Text
a} :: DescribeApplicationVersions)

instance Core.AWSPager DescribeApplicationVersions where
  page :: DescribeApplicationVersions
-> AWSResponse DescribeApplicationVersions
-> Maybe DescribeApplicationVersions
page DescribeApplicationVersions
rq AWSResponse DescribeApplicationVersions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeApplicationVersions
DescribeApplicationVersionsResponse
rs
            DescribeApplicationVersionsResponse
-> Getting (First Text) DescribeApplicationVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeApplicationVersionsResponse
-> Const (First Text) DescribeApplicationVersionsResponse
Lens' DescribeApplicationVersionsResponse (Maybe Text)
describeApplicationVersionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeApplicationVersionsResponse
 -> Const (First Text) DescribeApplicationVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeApplicationVersionsResponse 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 DescribeApplicationVersions
forall a. Maybe a
Prelude.Nothing
    | Maybe [ApplicationVersionDescription] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeApplicationVersions
DescribeApplicationVersionsResponse
rs
            DescribeApplicationVersionsResponse
-> Getting
     (First [ApplicationVersionDescription])
     DescribeApplicationVersionsResponse
     [ApplicationVersionDescription]
-> Maybe [ApplicationVersionDescription]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ApplicationVersionDescription]
 -> Const
      (First [ApplicationVersionDescription])
      (Maybe [ApplicationVersionDescription]))
-> DescribeApplicationVersionsResponse
-> Const
     (First [ApplicationVersionDescription])
     DescribeApplicationVersionsResponse
Lens'
  DescribeApplicationVersionsResponse
  (Maybe [ApplicationVersionDescription])
describeApplicationVersionsResponse_applicationVersions
              ((Maybe [ApplicationVersionDescription]
  -> Const
       (First [ApplicationVersionDescription])
       (Maybe [ApplicationVersionDescription]))
 -> DescribeApplicationVersionsResponse
 -> Const
      (First [ApplicationVersionDescription])
      DescribeApplicationVersionsResponse)
-> (([ApplicationVersionDescription]
     -> Const
          (First [ApplicationVersionDescription])
          [ApplicationVersionDescription])
    -> Maybe [ApplicationVersionDescription]
    -> Const
         (First [ApplicationVersionDescription])
         (Maybe [ApplicationVersionDescription]))
-> Getting
     (First [ApplicationVersionDescription])
     DescribeApplicationVersionsResponse
     [ApplicationVersionDescription]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ApplicationVersionDescription]
 -> Const
      (First [ApplicationVersionDescription])
      [ApplicationVersionDescription])
-> Maybe [ApplicationVersionDescription]
-> Const
     (First [ApplicationVersionDescription])
     (Maybe [ApplicationVersionDescription])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeApplicationVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeApplicationVersions -> Maybe DescribeApplicationVersions
forall a. a -> Maybe a
Prelude.Just (DescribeApplicationVersions -> Maybe DescribeApplicationVersions)
-> DescribeApplicationVersions -> Maybe DescribeApplicationVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeApplicationVersions
rq
          DescribeApplicationVersions
-> (DescribeApplicationVersions -> DescribeApplicationVersions)
-> DescribeApplicationVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeApplicationVersions
-> Identity DescribeApplicationVersions
Lens
  DescribeApplicationVersions
  DescribeApplicationVersions
  (Maybe Text)
  (Maybe Text)
describeApplicationVersions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeApplicationVersions
 -> Identity DescribeApplicationVersions)
-> Maybe Text
-> DescribeApplicationVersions
-> DescribeApplicationVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeApplicationVersions
DescribeApplicationVersionsResponse
rs
          DescribeApplicationVersionsResponse
-> Getting (First Text) DescribeApplicationVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeApplicationVersionsResponse
-> Const (First Text) DescribeApplicationVersionsResponse
Lens' DescribeApplicationVersionsResponse (Maybe Text)
describeApplicationVersionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeApplicationVersionsResponse
 -> Const (First Text) DescribeApplicationVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeApplicationVersionsResponse 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 DescribeApplicationVersions where
  type
    AWSResponse DescribeApplicationVersions =
      DescribeApplicationVersionsResponse
  request :: DescribeApplicationVersions -> Request DescribeApplicationVersions
request = Service
-> DescribeApplicationVersions
-> Request DescribeApplicationVersions
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeApplicationVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeApplicationVersions)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeApplicationVersions))
-> Logger
-> Service
-> Proxy DescribeApplicationVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeApplicationVersions)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeApplicationVersionsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [ApplicationVersionDescription]
-> Maybe Text -> Int -> DescribeApplicationVersionsResponse
DescribeApplicationVersionsResponse'
            (Maybe [ApplicationVersionDescription]
 -> Maybe Text -> Int -> DescribeApplicationVersionsResponse)
-> Either String (Maybe [ApplicationVersionDescription])
-> Either
     String (Maybe Text -> Int -> DescribeApplicationVersionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ApplicationVersions"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node]
    -> Either String (Maybe [ApplicationVersionDescription]))
-> Either String (Maybe [ApplicationVersionDescription])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ApplicationVersionDescription])
-> [Node] -> Either String (Maybe [ApplicationVersionDescription])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ApplicationVersionDescription]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String (Maybe Text -> Int -> DescribeApplicationVersionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeApplicationVersionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
            Either String (Int -> DescribeApplicationVersionsResponse)
-> Either String Int
-> Either String DescribeApplicationVersionsResponse
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 DescribeApplicationVersions

instance Prelude.NFData DescribeApplicationVersions

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

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

instance Core.ToQuery DescribeApplicationVersions where
  toQuery :: DescribeApplicationVersions -> QueryString
toQuery DescribeApplicationVersions' {Maybe Natural
Maybe [Text]
Maybe Text
applicationName :: Maybe Text
maxRecords :: Maybe Natural
nextToken :: Maybe Text
versionLabels :: Maybe [Text]
$sel:applicationName:DescribeApplicationVersions' :: DescribeApplicationVersions -> Maybe Text
$sel:maxRecords:DescribeApplicationVersions' :: DescribeApplicationVersions -> Maybe Natural
$sel:nextToken:DescribeApplicationVersions' :: DescribeApplicationVersions -> Maybe Text
$sel:versionLabels:DescribeApplicationVersions' :: DescribeApplicationVersions -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"DescribeApplicationVersions" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"VersionLabels"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
versionLabels
            ),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"MaxRecords" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxRecords,
        ByteString
"ApplicationName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
applicationName
      ]

-- | Result message wrapping a list of application version descriptions.
--
-- /See:/ 'newDescribeApplicationVersionsResponse' smart constructor.
data DescribeApplicationVersionsResponse = DescribeApplicationVersionsResponse'
  { -- | List of @ApplicationVersionDescription@ objects sorted in order of
    -- creation.
    DescribeApplicationVersionsResponse
-> Maybe [ApplicationVersionDescription]
applicationVersions :: Prelude.Maybe [ApplicationVersionDescription],
    -- | In a paginated request, the token that you can pass in a subsequent
    -- request to get the next response page.
    DescribeApplicationVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeApplicationVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeApplicationVersionsResponse
-> DescribeApplicationVersionsResponse -> Bool
(DescribeApplicationVersionsResponse
 -> DescribeApplicationVersionsResponse -> Bool)
-> (DescribeApplicationVersionsResponse
    -> DescribeApplicationVersionsResponse -> Bool)
-> Eq DescribeApplicationVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplicationVersionsResponse
-> DescribeApplicationVersionsResponse -> Bool
$c/= :: DescribeApplicationVersionsResponse
-> DescribeApplicationVersionsResponse -> Bool
== :: DescribeApplicationVersionsResponse
-> DescribeApplicationVersionsResponse -> Bool
$c== :: DescribeApplicationVersionsResponse
-> DescribeApplicationVersionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeApplicationVersionsResponse]
ReadPrec DescribeApplicationVersionsResponse
Int -> ReadS DescribeApplicationVersionsResponse
ReadS [DescribeApplicationVersionsResponse]
(Int -> ReadS DescribeApplicationVersionsResponse)
-> ReadS [DescribeApplicationVersionsResponse]
-> ReadPrec DescribeApplicationVersionsResponse
-> ReadPrec [DescribeApplicationVersionsResponse]
-> Read DescribeApplicationVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplicationVersionsResponse]
$creadListPrec :: ReadPrec [DescribeApplicationVersionsResponse]
readPrec :: ReadPrec DescribeApplicationVersionsResponse
$creadPrec :: ReadPrec DescribeApplicationVersionsResponse
readList :: ReadS [DescribeApplicationVersionsResponse]
$creadList :: ReadS [DescribeApplicationVersionsResponse]
readsPrec :: Int -> ReadS DescribeApplicationVersionsResponse
$creadsPrec :: Int -> ReadS DescribeApplicationVersionsResponse
Prelude.Read, Int -> DescribeApplicationVersionsResponse -> ShowS
[DescribeApplicationVersionsResponse] -> ShowS
DescribeApplicationVersionsResponse -> String
(Int -> DescribeApplicationVersionsResponse -> ShowS)
-> (DescribeApplicationVersionsResponse -> String)
-> ([DescribeApplicationVersionsResponse] -> ShowS)
-> Show DescribeApplicationVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplicationVersionsResponse] -> ShowS
$cshowList :: [DescribeApplicationVersionsResponse] -> ShowS
show :: DescribeApplicationVersionsResponse -> String
$cshow :: DescribeApplicationVersionsResponse -> String
showsPrec :: Int -> DescribeApplicationVersionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeApplicationVersionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeApplicationVersionsResponse
 -> Rep DescribeApplicationVersionsResponse x)
-> (forall x.
    Rep DescribeApplicationVersionsResponse x
    -> DescribeApplicationVersionsResponse)
-> Generic DescribeApplicationVersionsResponse
forall x.
Rep DescribeApplicationVersionsResponse x
-> DescribeApplicationVersionsResponse
forall x.
DescribeApplicationVersionsResponse
-> Rep DescribeApplicationVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeApplicationVersionsResponse x
-> DescribeApplicationVersionsResponse
$cfrom :: forall x.
DescribeApplicationVersionsResponse
-> Rep DescribeApplicationVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeApplicationVersionsResponse' 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:
--
-- 'applicationVersions', 'describeApplicationVersionsResponse_applicationVersions' - List of @ApplicationVersionDescription@ objects sorted in order of
-- creation.
--
-- 'nextToken', 'describeApplicationVersionsResponse_nextToken' - In a paginated request, the token that you can pass in a subsequent
-- request to get the next response page.
--
-- 'httpStatus', 'describeApplicationVersionsResponse_httpStatus' - The response's http status code.
newDescribeApplicationVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeApplicationVersionsResponse
newDescribeApplicationVersionsResponse :: Int -> DescribeApplicationVersionsResponse
newDescribeApplicationVersionsResponse Int
pHttpStatus_ =
  DescribeApplicationVersionsResponse' :: Maybe [ApplicationVersionDescription]
-> Maybe Text -> Int -> DescribeApplicationVersionsResponse
DescribeApplicationVersionsResponse'
    { $sel:applicationVersions:DescribeApplicationVersionsResponse' :: Maybe [ApplicationVersionDescription]
applicationVersions =
        Maybe [ApplicationVersionDescription]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeApplicationVersionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeApplicationVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | List of @ApplicationVersionDescription@ objects sorted in order of
-- creation.
describeApplicationVersionsResponse_applicationVersions :: Lens.Lens' DescribeApplicationVersionsResponse (Prelude.Maybe [ApplicationVersionDescription])
describeApplicationVersionsResponse_applicationVersions :: (Maybe [ApplicationVersionDescription]
 -> f (Maybe [ApplicationVersionDescription]))
-> DescribeApplicationVersionsResponse
-> f DescribeApplicationVersionsResponse
describeApplicationVersionsResponse_applicationVersions = (DescribeApplicationVersionsResponse
 -> Maybe [ApplicationVersionDescription])
-> (DescribeApplicationVersionsResponse
    -> Maybe [ApplicationVersionDescription]
    -> DescribeApplicationVersionsResponse)
-> Lens'
     DescribeApplicationVersionsResponse
     (Maybe [ApplicationVersionDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersionsResponse' {Maybe [ApplicationVersionDescription]
applicationVersions :: Maybe [ApplicationVersionDescription]
$sel:applicationVersions:DescribeApplicationVersionsResponse' :: DescribeApplicationVersionsResponse
-> Maybe [ApplicationVersionDescription]
applicationVersions} -> Maybe [ApplicationVersionDescription]
applicationVersions) (\s :: DescribeApplicationVersionsResponse
s@DescribeApplicationVersionsResponse' {} Maybe [ApplicationVersionDescription]
a -> DescribeApplicationVersionsResponse
s {$sel:applicationVersions:DescribeApplicationVersionsResponse' :: Maybe [ApplicationVersionDescription]
applicationVersions = Maybe [ApplicationVersionDescription]
a} :: DescribeApplicationVersionsResponse) ((Maybe [ApplicationVersionDescription]
  -> f (Maybe [ApplicationVersionDescription]))
 -> DescribeApplicationVersionsResponse
 -> f DescribeApplicationVersionsResponse)
-> ((Maybe [ApplicationVersionDescription]
     -> f (Maybe [ApplicationVersionDescription]))
    -> Maybe [ApplicationVersionDescription]
    -> f (Maybe [ApplicationVersionDescription]))
-> (Maybe [ApplicationVersionDescription]
    -> f (Maybe [ApplicationVersionDescription]))
-> DescribeApplicationVersionsResponse
-> f DescribeApplicationVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ApplicationVersionDescription]
  [ApplicationVersionDescription]
  [ApplicationVersionDescription]
  [ApplicationVersionDescription]
-> Iso
     (Maybe [ApplicationVersionDescription])
     (Maybe [ApplicationVersionDescription])
     (Maybe [ApplicationVersionDescription])
     (Maybe [ApplicationVersionDescription])
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
  [ApplicationVersionDescription]
  [ApplicationVersionDescription]
  [ApplicationVersionDescription]
  [ApplicationVersionDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | In a paginated request, the token that you can pass in a subsequent
-- request to get the next response page.
describeApplicationVersionsResponse_nextToken :: Lens.Lens' DescribeApplicationVersionsResponse (Prelude.Maybe Prelude.Text)
describeApplicationVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeApplicationVersionsResponse
-> f DescribeApplicationVersionsResponse
describeApplicationVersionsResponse_nextToken = (DescribeApplicationVersionsResponse -> Maybe Text)
-> (DescribeApplicationVersionsResponse
    -> Maybe Text -> DescribeApplicationVersionsResponse)
-> Lens' DescribeApplicationVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeApplicationVersionsResponse' :: DescribeApplicationVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeApplicationVersionsResponse
s@DescribeApplicationVersionsResponse' {} Maybe Text
a -> DescribeApplicationVersionsResponse
s {$sel:nextToken:DescribeApplicationVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeApplicationVersionsResponse)

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

instance
  Prelude.NFData
    DescribeApplicationVersionsResponse