{-# 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.CodeArtifact.ListPackageVersions
-- 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)
--
-- Returns a list of
-- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageVersionSummary.html PackageVersionSummary>
-- objects for package versions in a repository that match the request
-- parameters.
--
-- This operation returns paginated results.
module Amazonka.CodeArtifact.ListPackageVersions
  ( -- * Creating a Request
    ListPackageVersions (..),
    newListPackageVersions,

    -- * Request Lenses
    listPackageVersions_status,
    listPackageVersions_namespace,
    listPackageVersions_domainOwner,
    listPackageVersions_nextToken,
    listPackageVersions_maxResults,
    listPackageVersions_sortBy,
    listPackageVersions_domain,
    listPackageVersions_repository,
    listPackageVersions_format,
    listPackageVersions_package,

    -- * Destructuring the Response
    ListPackageVersionsResponse (..),
    newListPackageVersionsResponse,

    -- * Response Lenses
    listPackageVersionsResponse_format,
    listPackageVersionsResponse_namespace,
    listPackageVersionsResponse_versions,
    listPackageVersionsResponse_nextToken,
    listPackageVersionsResponse_package,
    listPackageVersionsResponse_defaultDisplayVersion,
    listPackageVersionsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListPackageVersions' smart constructor.
data ListPackageVersions = ListPackageVersions'
  { -- | A string that specifies the status of the package versions to include in
    -- the returned list. It can be one of the following:
    --
    -- -   @Published@
    --
    -- -   @Unfinished@
    --
    -- -   @Unlisted@
    --
    -- -   @Archived@
    --
    -- -   @Disposed@
    ListPackageVersions -> Maybe PackageVersionStatus
status :: Prelude.Maybe PackageVersionStatus,
    -- | The namespace of the package. The package component that specifies its
    -- namespace depends on its type. For example:
    --
    -- -   The namespace of a Maven package is its @groupId@.
    --
    -- -   The namespace of an npm package is its @scope@.
    --
    -- -   A Python package does not contain a corresponding component, so
    --     Python packages do not have a namespace.
    ListPackageVersions -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | The 12-digit account number of the AWS account that owns the domain. It
    -- does not include dashes or spaces.
    ListPackageVersions -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
    -- | The token for the next set of results. Use the value returned in the
    -- previous response in the next request to retrieve the next set of
    -- results.
    ListPackageVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return per page.
    ListPackageVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | How to sort the returned list of package versions.
    ListPackageVersions -> Maybe PackageVersionSortType
sortBy :: Prelude.Maybe PackageVersionSortType,
    -- | The name of the domain that contains the repository that contains the
    -- returned package versions.
    ListPackageVersions -> Text
domain :: Prelude.Text,
    -- | The name of the repository that contains the package.
    ListPackageVersions -> Text
repository :: Prelude.Text,
    -- | The format of the returned packages. The valid package types are:
    --
    -- -   @npm@: A Node Package Manager (npm) package.
    --
    -- -   @pypi@: A Python Package Index (PyPI) package.
    --
    -- -   @maven@: A Maven package that contains compiled code in a
    --     distributable format, such as a JAR file.
    ListPackageVersions -> PackageFormat
format :: PackageFormat,
    -- | The name of the package for which you want to return a list of package
    -- versions.
    ListPackageVersions -> Text
package :: Prelude.Text
  }
  deriving (ListPackageVersions -> ListPackageVersions -> Bool
(ListPackageVersions -> ListPackageVersions -> Bool)
-> (ListPackageVersions -> ListPackageVersions -> Bool)
-> Eq ListPackageVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPackageVersions -> ListPackageVersions -> Bool
$c/= :: ListPackageVersions -> ListPackageVersions -> Bool
== :: ListPackageVersions -> ListPackageVersions -> Bool
$c== :: ListPackageVersions -> ListPackageVersions -> Bool
Prelude.Eq, ReadPrec [ListPackageVersions]
ReadPrec ListPackageVersions
Int -> ReadS ListPackageVersions
ReadS [ListPackageVersions]
(Int -> ReadS ListPackageVersions)
-> ReadS [ListPackageVersions]
-> ReadPrec ListPackageVersions
-> ReadPrec [ListPackageVersions]
-> Read ListPackageVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPackageVersions]
$creadListPrec :: ReadPrec [ListPackageVersions]
readPrec :: ReadPrec ListPackageVersions
$creadPrec :: ReadPrec ListPackageVersions
readList :: ReadS [ListPackageVersions]
$creadList :: ReadS [ListPackageVersions]
readsPrec :: Int -> ReadS ListPackageVersions
$creadsPrec :: Int -> ReadS ListPackageVersions
Prelude.Read, Int -> ListPackageVersions -> ShowS
[ListPackageVersions] -> ShowS
ListPackageVersions -> String
(Int -> ListPackageVersions -> ShowS)
-> (ListPackageVersions -> String)
-> ([ListPackageVersions] -> ShowS)
-> Show ListPackageVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPackageVersions] -> ShowS
$cshowList :: [ListPackageVersions] -> ShowS
show :: ListPackageVersions -> String
$cshow :: ListPackageVersions -> String
showsPrec :: Int -> ListPackageVersions -> ShowS
$cshowsPrec :: Int -> ListPackageVersions -> ShowS
Prelude.Show, (forall x. ListPackageVersions -> Rep ListPackageVersions x)
-> (forall x. Rep ListPackageVersions x -> ListPackageVersions)
-> Generic ListPackageVersions
forall x. Rep ListPackageVersions x -> ListPackageVersions
forall x. ListPackageVersions -> Rep ListPackageVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPackageVersions x -> ListPackageVersions
$cfrom :: forall x. ListPackageVersions -> Rep ListPackageVersions x
Prelude.Generic)

-- |
-- Create a value of 'ListPackageVersions' 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:
--
-- 'status', 'listPackageVersions_status' - A string that specifies the status of the package versions to include in
-- the returned list. It can be one of the following:
--
-- -   @Published@
--
-- -   @Unfinished@
--
-- -   @Unlisted@
--
-- -   @Archived@
--
-- -   @Disposed@
--
-- 'namespace', 'listPackageVersions_namespace' - The namespace of the package. The package component that specifies its
-- namespace depends on its type. For example:
--
-- -   The namespace of a Maven package is its @groupId@.
--
-- -   The namespace of an npm package is its @scope@.
--
-- -   A Python package does not contain a corresponding component, so
--     Python packages do not have a namespace.
--
-- 'domainOwner', 'listPackageVersions_domainOwner' - The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
--
-- 'nextToken', 'listPackageVersions_nextToken' - The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
--
-- 'maxResults', 'listPackageVersions_maxResults' - The maximum number of results to return per page.
--
-- 'sortBy', 'listPackageVersions_sortBy' - How to sort the returned list of package versions.
--
-- 'domain', 'listPackageVersions_domain' - The name of the domain that contains the repository that contains the
-- returned package versions.
--
-- 'repository', 'listPackageVersions_repository' - The name of the repository that contains the package.
--
-- 'format', 'listPackageVersions_format' - The format of the returned packages. The valid package types are:
--
-- -   @npm@: A Node Package Manager (npm) package.
--
-- -   @pypi@: A Python Package Index (PyPI) package.
--
-- -   @maven@: A Maven package that contains compiled code in a
--     distributable format, such as a JAR file.
--
-- 'package', 'listPackageVersions_package' - The name of the package for which you want to return a list of package
-- versions.
newListPackageVersions ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'repository'
  Prelude.Text ->
  -- | 'format'
  PackageFormat ->
  -- | 'package'
  Prelude.Text ->
  ListPackageVersions
newListPackageVersions :: Text -> Text -> PackageFormat -> Text -> ListPackageVersions
newListPackageVersions
  Text
pDomain_
  Text
pRepository_
  PackageFormat
pFormat_
  Text
pPackage_ =
    ListPackageVersions' :: Maybe PackageVersionStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe PackageVersionSortType
-> Text
-> Text
-> PackageFormat
-> Text
-> ListPackageVersions
ListPackageVersions'
      { $sel:status:ListPackageVersions' :: Maybe PackageVersionStatus
status = Maybe PackageVersionStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:namespace:ListPackageVersions' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:domainOwner:ListPackageVersions' :: Maybe Text
domainOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListPackageVersions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListPackageVersions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:sortBy:ListPackageVersions' :: Maybe PackageVersionSortType
sortBy = Maybe PackageVersionSortType
forall a. Maybe a
Prelude.Nothing,
        $sel:domain:ListPackageVersions' :: Text
domain = Text
pDomain_,
        $sel:repository:ListPackageVersions' :: Text
repository = Text
pRepository_,
        $sel:format:ListPackageVersions' :: PackageFormat
format = PackageFormat
pFormat_,
        $sel:package:ListPackageVersions' :: Text
package = Text
pPackage_
      }

-- | A string that specifies the status of the package versions to include in
-- the returned list. It can be one of the following:
--
-- -   @Published@
--
-- -   @Unfinished@
--
-- -   @Unlisted@
--
-- -   @Archived@
--
-- -   @Disposed@
listPackageVersions_status :: Lens.Lens' ListPackageVersions (Prelude.Maybe PackageVersionStatus)
listPackageVersions_status :: (Maybe PackageVersionStatus -> f (Maybe PackageVersionStatus))
-> ListPackageVersions -> f ListPackageVersions
listPackageVersions_status = (ListPackageVersions -> Maybe PackageVersionStatus)
-> (ListPackageVersions
    -> Maybe PackageVersionStatus -> ListPackageVersions)
-> Lens
     ListPackageVersions
     ListPackageVersions
     (Maybe PackageVersionStatus)
     (Maybe PackageVersionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Maybe PackageVersionStatus
status :: Maybe PackageVersionStatus
$sel:status:ListPackageVersions' :: ListPackageVersions -> Maybe PackageVersionStatus
status} -> Maybe PackageVersionStatus
status) (\s :: ListPackageVersions
s@ListPackageVersions' {} Maybe PackageVersionStatus
a -> ListPackageVersions
s {$sel:status:ListPackageVersions' :: Maybe PackageVersionStatus
status = Maybe PackageVersionStatus
a} :: ListPackageVersions)

-- | The namespace of the package. The package component that specifies its
-- namespace depends on its type. For example:
--
-- -   The namespace of a Maven package is its @groupId@.
--
-- -   The namespace of an npm package is its @scope@.
--
-- -   A Python package does not contain a corresponding component, so
--     Python packages do not have a namespace.
listPackageVersions_namespace :: Lens.Lens' ListPackageVersions (Prelude.Maybe Prelude.Text)
listPackageVersions_namespace :: (Maybe Text -> f (Maybe Text))
-> ListPackageVersions -> f ListPackageVersions
listPackageVersions_namespace = (ListPackageVersions -> Maybe Text)
-> (ListPackageVersions -> Maybe Text -> ListPackageVersions)
-> Lens
     ListPackageVersions ListPackageVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Maybe Text
namespace :: Maybe Text
$sel:namespace:ListPackageVersions' :: ListPackageVersions -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: ListPackageVersions
s@ListPackageVersions' {} Maybe Text
a -> ListPackageVersions
s {$sel:namespace:ListPackageVersions' :: Maybe Text
namespace = Maybe Text
a} :: ListPackageVersions)

-- | The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
listPackageVersions_domainOwner :: Lens.Lens' ListPackageVersions (Prelude.Maybe Prelude.Text)
listPackageVersions_domainOwner :: (Maybe Text -> f (Maybe Text))
-> ListPackageVersions -> f ListPackageVersions
listPackageVersions_domainOwner = (ListPackageVersions -> Maybe Text)
-> (ListPackageVersions -> Maybe Text -> ListPackageVersions)
-> Lens
     ListPackageVersions ListPackageVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:ListPackageVersions' :: ListPackageVersions -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: ListPackageVersions
s@ListPackageVersions' {} Maybe Text
a -> ListPackageVersions
s {$sel:domainOwner:ListPackageVersions' :: Maybe Text
domainOwner = Maybe Text
a} :: ListPackageVersions)

-- | The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
listPackageVersions_nextToken :: Lens.Lens' ListPackageVersions (Prelude.Maybe Prelude.Text)
listPackageVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPackageVersions -> f ListPackageVersions
listPackageVersions_nextToken = (ListPackageVersions -> Maybe Text)
-> (ListPackageVersions -> Maybe Text -> ListPackageVersions)
-> Lens
     ListPackageVersions ListPackageVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPackageVersions' :: ListPackageVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPackageVersions
s@ListPackageVersions' {} Maybe Text
a -> ListPackageVersions
s {$sel:nextToken:ListPackageVersions' :: Maybe Text
nextToken = Maybe Text
a} :: ListPackageVersions)

-- | The maximum number of results to return per page.
listPackageVersions_maxResults :: Lens.Lens' ListPackageVersions (Prelude.Maybe Prelude.Natural)
listPackageVersions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPackageVersions -> f ListPackageVersions
listPackageVersions_maxResults = (ListPackageVersions -> Maybe Natural)
-> (ListPackageVersions -> Maybe Natural -> ListPackageVersions)
-> Lens
     ListPackageVersions
     ListPackageVersions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPackageVersions' :: ListPackageVersions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPackageVersions
s@ListPackageVersions' {} Maybe Natural
a -> ListPackageVersions
s {$sel:maxResults:ListPackageVersions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPackageVersions)

-- | How to sort the returned list of package versions.
listPackageVersions_sortBy :: Lens.Lens' ListPackageVersions (Prelude.Maybe PackageVersionSortType)
listPackageVersions_sortBy :: (Maybe PackageVersionSortType -> f (Maybe PackageVersionSortType))
-> ListPackageVersions -> f ListPackageVersions
listPackageVersions_sortBy = (ListPackageVersions -> Maybe PackageVersionSortType)
-> (ListPackageVersions
    -> Maybe PackageVersionSortType -> ListPackageVersions)
-> Lens
     ListPackageVersions
     ListPackageVersions
     (Maybe PackageVersionSortType)
     (Maybe PackageVersionSortType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Maybe PackageVersionSortType
sortBy :: Maybe PackageVersionSortType
$sel:sortBy:ListPackageVersions' :: ListPackageVersions -> Maybe PackageVersionSortType
sortBy} -> Maybe PackageVersionSortType
sortBy) (\s :: ListPackageVersions
s@ListPackageVersions' {} Maybe PackageVersionSortType
a -> ListPackageVersions
s {$sel:sortBy:ListPackageVersions' :: Maybe PackageVersionSortType
sortBy = Maybe PackageVersionSortType
a} :: ListPackageVersions)

-- | The name of the domain that contains the repository that contains the
-- returned package versions.
listPackageVersions_domain :: Lens.Lens' ListPackageVersions Prelude.Text
listPackageVersions_domain :: (Text -> f Text) -> ListPackageVersions -> f ListPackageVersions
listPackageVersions_domain = (ListPackageVersions -> Text)
-> (ListPackageVersions -> Text -> ListPackageVersions)
-> Lens ListPackageVersions ListPackageVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Text
domain :: Text
$sel:domain:ListPackageVersions' :: ListPackageVersions -> Text
domain} -> Text
domain) (\s :: ListPackageVersions
s@ListPackageVersions' {} Text
a -> ListPackageVersions
s {$sel:domain:ListPackageVersions' :: Text
domain = Text
a} :: ListPackageVersions)

-- | The name of the repository that contains the package.
listPackageVersions_repository :: Lens.Lens' ListPackageVersions Prelude.Text
listPackageVersions_repository :: (Text -> f Text) -> ListPackageVersions -> f ListPackageVersions
listPackageVersions_repository = (ListPackageVersions -> Text)
-> (ListPackageVersions -> Text -> ListPackageVersions)
-> Lens ListPackageVersions ListPackageVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Text
repository :: Text
$sel:repository:ListPackageVersions' :: ListPackageVersions -> Text
repository} -> Text
repository) (\s :: ListPackageVersions
s@ListPackageVersions' {} Text
a -> ListPackageVersions
s {$sel:repository:ListPackageVersions' :: Text
repository = Text
a} :: ListPackageVersions)

-- | The format of the returned packages. The valid package types are:
--
-- -   @npm@: A Node Package Manager (npm) package.
--
-- -   @pypi@: A Python Package Index (PyPI) package.
--
-- -   @maven@: A Maven package that contains compiled code in a
--     distributable format, such as a JAR file.
listPackageVersions_format :: Lens.Lens' ListPackageVersions PackageFormat
listPackageVersions_format :: (PackageFormat -> f PackageFormat)
-> ListPackageVersions -> f ListPackageVersions
listPackageVersions_format = (ListPackageVersions -> PackageFormat)
-> (ListPackageVersions -> PackageFormat -> ListPackageVersions)
-> Lens
     ListPackageVersions ListPackageVersions PackageFormat PackageFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {PackageFormat
format :: PackageFormat
$sel:format:ListPackageVersions' :: ListPackageVersions -> PackageFormat
format} -> PackageFormat
format) (\s :: ListPackageVersions
s@ListPackageVersions' {} PackageFormat
a -> ListPackageVersions
s {$sel:format:ListPackageVersions' :: PackageFormat
format = PackageFormat
a} :: ListPackageVersions)

-- | The name of the package for which you want to return a list of package
-- versions.
listPackageVersions_package :: Lens.Lens' ListPackageVersions Prelude.Text
listPackageVersions_package :: (Text -> f Text) -> ListPackageVersions -> f ListPackageVersions
listPackageVersions_package = (ListPackageVersions -> Text)
-> (ListPackageVersions -> Text -> ListPackageVersions)
-> Lens ListPackageVersions ListPackageVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersions' {Text
package :: Text
$sel:package:ListPackageVersions' :: ListPackageVersions -> Text
package} -> Text
package) (\s :: ListPackageVersions
s@ListPackageVersions' {} Text
a -> ListPackageVersions
s {$sel:package:ListPackageVersions' :: Text
package = Text
a} :: ListPackageVersions)

instance Core.AWSPager ListPackageVersions where
  page :: ListPackageVersions
-> AWSResponse ListPackageVersions -> Maybe ListPackageVersions
page ListPackageVersions
rq AWSResponse ListPackageVersions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPackageVersions
ListPackageVersionsResponse
rs
            ListPackageVersionsResponse
-> Getting (First Text) ListPackageVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPackageVersionsResponse
-> Const (First Text) ListPackageVersionsResponse
Lens' ListPackageVersionsResponse (Maybe Text)
listPackageVersionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPackageVersionsResponse
 -> Const (First Text) ListPackageVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPackageVersionsResponse 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 ListPackageVersions
forall a. Maybe a
Prelude.Nothing
    | Maybe [PackageVersionSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPackageVersions
ListPackageVersionsResponse
rs
            ListPackageVersionsResponse
-> Getting
     (First [PackageVersionSummary])
     ListPackageVersionsResponse
     [PackageVersionSummary]
-> Maybe [PackageVersionSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [PackageVersionSummary]
 -> Const
      (First [PackageVersionSummary]) (Maybe [PackageVersionSummary]))
-> ListPackageVersionsResponse
-> Const
     (First [PackageVersionSummary]) ListPackageVersionsResponse
Lens' ListPackageVersionsResponse (Maybe [PackageVersionSummary])
listPackageVersionsResponse_versions
              ((Maybe [PackageVersionSummary]
  -> Const
       (First [PackageVersionSummary]) (Maybe [PackageVersionSummary]))
 -> ListPackageVersionsResponse
 -> Const
      (First [PackageVersionSummary]) ListPackageVersionsResponse)
-> (([PackageVersionSummary]
     -> Const (First [PackageVersionSummary]) [PackageVersionSummary])
    -> Maybe [PackageVersionSummary]
    -> Const
         (First [PackageVersionSummary]) (Maybe [PackageVersionSummary]))
-> Getting
     (First [PackageVersionSummary])
     ListPackageVersionsResponse
     [PackageVersionSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PackageVersionSummary]
 -> Const (First [PackageVersionSummary]) [PackageVersionSummary])
-> Maybe [PackageVersionSummary]
-> Const
     (First [PackageVersionSummary]) (Maybe [PackageVersionSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListPackageVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListPackageVersions -> Maybe ListPackageVersions
forall a. a -> Maybe a
Prelude.Just (ListPackageVersions -> Maybe ListPackageVersions)
-> ListPackageVersions -> Maybe ListPackageVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListPackageVersions
rq
          ListPackageVersions
-> (ListPackageVersions -> ListPackageVersions)
-> ListPackageVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListPackageVersions -> Identity ListPackageVersions
Lens
  ListPackageVersions ListPackageVersions (Maybe Text) (Maybe Text)
listPackageVersions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListPackageVersions -> Identity ListPackageVersions)
-> Maybe Text -> ListPackageVersions -> ListPackageVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPackageVersions
ListPackageVersionsResponse
rs
          ListPackageVersionsResponse
-> Getting (First Text) ListPackageVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPackageVersionsResponse
-> Const (First Text) ListPackageVersionsResponse
Lens' ListPackageVersionsResponse (Maybe Text)
listPackageVersionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPackageVersionsResponse
 -> Const (First Text) ListPackageVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPackageVersionsResponse 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 ListPackageVersions where
  type
    AWSResponse ListPackageVersions =
      ListPackageVersionsResponse
  request :: ListPackageVersions -> Request ListPackageVersions
request = Service -> ListPackageVersions -> Request ListPackageVersions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListPackageVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPackageVersions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListPackageVersions))
-> Logger
-> Service
-> Proxy ListPackageVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPackageVersions)))
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 PackageFormat
-> Maybe Text
-> Maybe [PackageVersionSummary]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> ListPackageVersionsResponse
ListPackageVersionsResponse'
            (Maybe PackageFormat
 -> Maybe Text
 -> Maybe [PackageVersionSummary]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> ListPackageVersionsResponse)
-> Either String (Maybe PackageFormat)
-> Either
     String
     (Maybe Text
      -> Maybe [PackageVersionSummary]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> ListPackageVersionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe PackageFormat)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"format")
            Either
  String
  (Maybe Text
   -> Maybe [PackageVersionSummary]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> ListPackageVersionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [PackageVersionSummary]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> ListPackageVersionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"namespace")
            Either
  String
  (Maybe [PackageVersionSummary]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> ListPackageVersionsResponse)
-> Either String (Maybe [PackageVersionSummary])
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Int -> ListPackageVersionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [PackageVersionSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"versions" Either String (Maybe (Maybe [PackageVersionSummary]))
-> Maybe [PackageVersionSummary]
-> Either String (Maybe [PackageVersionSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [PackageVersionSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Int -> ListPackageVersionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> ListPackageVersionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> ListPackageVersionsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ListPackageVersionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"package")
            Either String (Maybe Text -> Int -> ListPackageVersionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListPackageVersionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"defaultDisplayVersion")
            Either String (Int -> ListPackageVersionsResponse)
-> Either String Int -> Either String ListPackageVersionsResponse
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 ListPackageVersions

instance Prelude.NFData ListPackageVersions

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

instance Core.ToJSON ListPackageVersions where
  toJSON :: ListPackageVersions -> Value
toJSON = Value -> ListPackageVersions -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

instance Core.ToPath ListPackageVersions where
  toPath :: ListPackageVersions -> ByteString
toPath = ByteString -> ListPackageVersions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/package/versions"

instance Core.ToQuery ListPackageVersions where
  toQuery :: ListPackageVersions -> QueryString
toQuery ListPackageVersions' {Maybe Natural
Maybe Text
Maybe PackageVersionSortType
Maybe PackageVersionStatus
Text
PackageFormat
package :: Text
format :: PackageFormat
repository :: Text
domain :: Text
sortBy :: Maybe PackageVersionSortType
maxResults :: Maybe Natural
nextToken :: Maybe Text
domainOwner :: Maybe Text
namespace :: Maybe Text
status :: Maybe PackageVersionStatus
$sel:package:ListPackageVersions' :: ListPackageVersions -> Text
$sel:format:ListPackageVersions' :: ListPackageVersions -> PackageFormat
$sel:repository:ListPackageVersions' :: ListPackageVersions -> Text
$sel:domain:ListPackageVersions' :: ListPackageVersions -> Text
$sel:sortBy:ListPackageVersions' :: ListPackageVersions -> Maybe PackageVersionSortType
$sel:maxResults:ListPackageVersions' :: ListPackageVersions -> Maybe Natural
$sel:nextToken:ListPackageVersions' :: ListPackageVersions -> Maybe Text
$sel:domainOwner:ListPackageVersions' :: ListPackageVersions -> Maybe Text
$sel:namespace:ListPackageVersions' :: ListPackageVersions -> Maybe Text
$sel:status:ListPackageVersions' :: ListPackageVersions -> Maybe PackageVersionStatus
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"status" ByteString -> Maybe PackageVersionStatus -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe PackageVersionStatus
status,
        ByteString
"namespace" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
namespace,
        ByteString
"domain-owner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
domainOwner,
        ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"max-results" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"sortBy" ByteString -> Maybe PackageVersionSortType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe PackageVersionSortType
sortBy,
        ByteString
"domain" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domain,
        ByteString
"repository" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
repository,
        ByteString
"format" ByteString -> PackageFormat -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: PackageFormat
format,
        ByteString
"package" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
package
      ]

-- | /See:/ 'newListPackageVersionsResponse' smart constructor.
data ListPackageVersionsResponse = ListPackageVersionsResponse'
  { -- | A format of the package. Valid package format values are:
    --
    -- -   @npm@
    --
    -- -   @pypi@
    --
    -- -   @maven@
    ListPackageVersionsResponse -> Maybe PackageFormat
format :: Prelude.Maybe PackageFormat,
    -- | The namespace of the package. The package component that specifies its
    -- namespace depends on its type. For example:
    --
    -- -   The namespace of a Maven package is its @groupId@.
    --
    -- -   The namespace of an npm package is its @scope@.
    --
    -- -   A Python package does not contain a corresponding component, so
    --     Python packages do not have a namespace.
    ListPackageVersionsResponse -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | The returned list of
    -- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageVersionSummary.html PackageVersionSummary>
    -- objects.
    ListPackageVersionsResponse -> Maybe [PackageVersionSummary]
versions :: Prelude.Maybe [PackageVersionSummary],
    -- | If there are additional results, this is the token for the next set of
    -- results.
    ListPackageVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the package.
    ListPackageVersionsResponse -> Maybe Text
package :: Prelude.Maybe Prelude.Text,
    -- | The default package version to display. This depends on the package
    -- format:
    --
    -- -   For Maven and PyPI packages, it\'s the most recently published
    --     package version.
    --
    -- -   For npm packages, it\'s the version referenced by the @latest@ tag.
    --     If the @latest@ tag is not set, it\'s the most recently published
    --     package version.
    ListPackageVersionsResponse -> Maybe Text
defaultDisplayVersion :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListPackageVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPackageVersionsResponse -> ListPackageVersionsResponse -> Bool
(ListPackageVersionsResponse
 -> ListPackageVersionsResponse -> Bool)
-> (ListPackageVersionsResponse
    -> ListPackageVersionsResponse -> Bool)
-> Eq ListPackageVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPackageVersionsResponse -> ListPackageVersionsResponse -> Bool
$c/= :: ListPackageVersionsResponse -> ListPackageVersionsResponse -> Bool
== :: ListPackageVersionsResponse -> ListPackageVersionsResponse -> Bool
$c== :: ListPackageVersionsResponse -> ListPackageVersionsResponse -> Bool
Prelude.Eq, ReadPrec [ListPackageVersionsResponse]
ReadPrec ListPackageVersionsResponse
Int -> ReadS ListPackageVersionsResponse
ReadS [ListPackageVersionsResponse]
(Int -> ReadS ListPackageVersionsResponse)
-> ReadS [ListPackageVersionsResponse]
-> ReadPrec ListPackageVersionsResponse
-> ReadPrec [ListPackageVersionsResponse]
-> Read ListPackageVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPackageVersionsResponse]
$creadListPrec :: ReadPrec [ListPackageVersionsResponse]
readPrec :: ReadPrec ListPackageVersionsResponse
$creadPrec :: ReadPrec ListPackageVersionsResponse
readList :: ReadS [ListPackageVersionsResponse]
$creadList :: ReadS [ListPackageVersionsResponse]
readsPrec :: Int -> ReadS ListPackageVersionsResponse
$creadsPrec :: Int -> ReadS ListPackageVersionsResponse
Prelude.Read, Int -> ListPackageVersionsResponse -> ShowS
[ListPackageVersionsResponse] -> ShowS
ListPackageVersionsResponse -> String
(Int -> ListPackageVersionsResponse -> ShowS)
-> (ListPackageVersionsResponse -> String)
-> ([ListPackageVersionsResponse] -> ShowS)
-> Show ListPackageVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPackageVersionsResponse] -> ShowS
$cshowList :: [ListPackageVersionsResponse] -> ShowS
show :: ListPackageVersionsResponse -> String
$cshow :: ListPackageVersionsResponse -> String
showsPrec :: Int -> ListPackageVersionsResponse -> ShowS
$cshowsPrec :: Int -> ListPackageVersionsResponse -> ShowS
Prelude.Show, (forall x.
 ListPackageVersionsResponse -> Rep ListPackageVersionsResponse x)
-> (forall x.
    Rep ListPackageVersionsResponse x -> ListPackageVersionsResponse)
-> Generic ListPackageVersionsResponse
forall x.
Rep ListPackageVersionsResponse x -> ListPackageVersionsResponse
forall x.
ListPackageVersionsResponse -> Rep ListPackageVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPackageVersionsResponse x -> ListPackageVersionsResponse
$cfrom :: forall x.
ListPackageVersionsResponse -> Rep ListPackageVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPackageVersionsResponse' 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:
--
-- 'format', 'listPackageVersionsResponse_format' - A format of the package. Valid package format values are:
--
-- -   @npm@
--
-- -   @pypi@
--
-- -   @maven@
--
-- 'namespace', 'listPackageVersionsResponse_namespace' - The namespace of the package. The package component that specifies its
-- namespace depends on its type. For example:
--
-- -   The namespace of a Maven package is its @groupId@.
--
-- -   The namespace of an npm package is its @scope@.
--
-- -   A Python package does not contain a corresponding component, so
--     Python packages do not have a namespace.
--
-- 'versions', 'listPackageVersionsResponse_versions' - The returned list of
-- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageVersionSummary.html PackageVersionSummary>
-- objects.
--
-- 'nextToken', 'listPackageVersionsResponse_nextToken' - If there are additional results, this is the token for the next set of
-- results.
--
-- 'package', 'listPackageVersionsResponse_package' - The name of the package.
--
-- 'defaultDisplayVersion', 'listPackageVersionsResponse_defaultDisplayVersion' - The default package version to display. This depends on the package
-- format:
--
-- -   For Maven and PyPI packages, it\'s the most recently published
--     package version.
--
-- -   For npm packages, it\'s the version referenced by the @latest@ tag.
--     If the @latest@ tag is not set, it\'s the most recently published
--     package version.
--
-- 'httpStatus', 'listPackageVersionsResponse_httpStatus' - The response's http status code.
newListPackageVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPackageVersionsResponse
newListPackageVersionsResponse :: Int -> ListPackageVersionsResponse
newListPackageVersionsResponse Int
pHttpStatus_ =
  ListPackageVersionsResponse' :: Maybe PackageFormat
-> Maybe Text
-> Maybe [PackageVersionSummary]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> ListPackageVersionsResponse
ListPackageVersionsResponse'
    { $sel:format:ListPackageVersionsResponse' :: Maybe PackageFormat
format =
        Maybe PackageFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:namespace:ListPackageVersionsResponse' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versions:ListPackageVersionsResponse' :: Maybe [PackageVersionSummary]
versions = Maybe [PackageVersionSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPackageVersionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:package:ListPackageVersionsResponse' :: Maybe Text
package = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultDisplayVersion:ListPackageVersionsResponse' :: Maybe Text
defaultDisplayVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPackageVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A format of the package. Valid package format values are:
--
-- -   @npm@
--
-- -   @pypi@
--
-- -   @maven@
listPackageVersionsResponse_format :: Lens.Lens' ListPackageVersionsResponse (Prelude.Maybe PackageFormat)
listPackageVersionsResponse_format :: (Maybe PackageFormat -> f (Maybe PackageFormat))
-> ListPackageVersionsResponse -> f ListPackageVersionsResponse
listPackageVersionsResponse_format = (ListPackageVersionsResponse -> Maybe PackageFormat)
-> (ListPackageVersionsResponse
    -> Maybe PackageFormat -> ListPackageVersionsResponse)
-> Lens
     ListPackageVersionsResponse
     ListPackageVersionsResponse
     (Maybe PackageFormat)
     (Maybe PackageFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersionsResponse' {Maybe PackageFormat
format :: Maybe PackageFormat
$sel:format:ListPackageVersionsResponse' :: ListPackageVersionsResponse -> Maybe PackageFormat
format} -> Maybe PackageFormat
format) (\s :: ListPackageVersionsResponse
s@ListPackageVersionsResponse' {} Maybe PackageFormat
a -> ListPackageVersionsResponse
s {$sel:format:ListPackageVersionsResponse' :: Maybe PackageFormat
format = Maybe PackageFormat
a} :: ListPackageVersionsResponse)

-- | The namespace of the package. The package component that specifies its
-- namespace depends on its type. For example:
--
-- -   The namespace of a Maven package is its @groupId@.
--
-- -   The namespace of an npm package is its @scope@.
--
-- -   A Python package does not contain a corresponding component, so
--     Python packages do not have a namespace.
listPackageVersionsResponse_namespace :: Lens.Lens' ListPackageVersionsResponse (Prelude.Maybe Prelude.Text)
listPackageVersionsResponse_namespace :: (Maybe Text -> f (Maybe Text))
-> ListPackageVersionsResponse -> f ListPackageVersionsResponse
listPackageVersionsResponse_namespace = (ListPackageVersionsResponse -> Maybe Text)
-> (ListPackageVersionsResponse
    -> Maybe Text -> ListPackageVersionsResponse)
-> Lens' ListPackageVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersionsResponse' {Maybe Text
namespace :: Maybe Text
$sel:namespace:ListPackageVersionsResponse' :: ListPackageVersionsResponse -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: ListPackageVersionsResponse
s@ListPackageVersionsResponse' {} Maybe Text
a -> ListPackageVersionsResponse
s {$sel:namespace:ListPackageVersionsResponse' :: Maybe Text
namespace = Maybe Text
a} :: ListPackageVersionsResponse)

-- | The returned list of
-- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageVersionSummary.html PackageVersionSummary>
-- objects.
listPackageVersionsResponse_versions :: Lens.Lens' ListPackageVersionsResponse (Prelude.Maybe [PackageVersionSummary])
listPackageVersionsResponse_versions :: (Maybe [PackageVersionSummary]
 -> f (Maybe [PackageVersionSummary]))
-> ListPackageVersionsResponse -> f ListPackageVersionsResponse
listPackageVersionsResponse_versions = (ListPackageVersionsResponse -> Maybe [PackageVersionSummary])
-> (ListPackageVersionsResponse
    -> Maybe [PackageVersionSummary] -> ListPackageVersionsResponse)
-> Lens'
     ListPackageVersionsResponse (Maybe [PackageVersionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersionsResponse' {Maybe [PackageVersionSummary]
versions :: Maybe [PackageVersionSummary]
$sel:versions:ListPackageVersionsResponse' :: ListPackageVersionsResponse -> Maybe [PackageVersionSummary]
versions} -> Maybe [PackageVersionSummary]
versions) (\s :: ListPackageVersionsResponse
s@ListPackageVersionsResponse' {} Maybe [PackageVersionSummary]
a -> ListPackageVersionsResponse
s {$sel:versions:ListPackageVersionsResponse' :: Maybe [PackageVersionSummary]
versions = Maybe [PackageVersionSummary]
a} :: ListPackageVersionsResponse) ((Maybe [PackageVersionSummary]
  -> f (Maybe [PackageVersionSummary]))
 -> ListPackageVersionsResponse -> f ListPackageVersionsResponse)
-> ((Maybe [PackageVersionSummary]
     -> f (Maybe [PackageVersionSummary]))
    -> Maybe [PackageVersionSummary]
    -> f (Maybe [PackageVersionSummary]))
-> (Maybe [PackageVersionSummary]
    -> f (Maybe [PackageVersionSummary]))
-> ListPackageVersionsResponse
-> f ListPackageVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PackageVersionSummary]
  [PackageVersionSummary]
  [PackageVersionSummary]
  [PackageVersionSummary]
-> Iso
     (Maybe [PackageVersionSummary])
     (Maybe [PackageVersionSummary])
     (Maybe [PackageVersionSummary])
     (Maybe [PackageVersionSummary])
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
  [PackageVersionSummary]
  [PackageVersionSummary]
  [PackageVersionSummary]
  [PackageVersionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If there are additional results, this is the token for the next set of
-- results.
listPackageVersionsResponse_nextToken :: Lens.Lens' ListPackageVersionsResponse (Prelude.Maybe Prelude.Text)
listPackageVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPackageVersionsResponse -> f ListPackageVersionsResponse
listPackageVersionsResponse_nextToken = (ListPackageVersionsResponse -> Maybe Text)
-> (ListPackageVersionsResponse
    -> Maybe Text -> ListPackageVersionsResponse)
-> Lens' ListPackageVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPackageVersionsResponse' :: ListPackageVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPackageVersionsResponse
s@ListPackageVersionsResponse' {} Maybe Text
a -> ListPackageVersionsResponse
s {$sel:nextToken:ListPackageVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPackageVersionsResponse)

-- | The name of the package.
listPackageVersionsResponse_package :: Lens.Lens' ListPackageVersionsResponse (Prelude.Maybe Prelude.Text)
listPackageVersionsResponse_package :: (Maybe Text -> f (Maybe Text))
-> ListPackageVersionsResponse -> f ListPackageVersionsResponse
listPackageVersionsResponse_package = (ListPackageVersionsResponse -> Maybe Text)
-> (ListPackageVersionsResponse
    -> Maybe Text -> ListPackageVersionsResponse)
-> Lens' ListPackageVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersionsResponse' {Maybe Text
package :: Maybe Text
$sel:package:ListPackageVersionsResponse' :: ListPackageVersionsResponse -> Maybe Text
package} -> Maybe Text
package) (\s :: ListPackageVersionsResponse
s@ListPackageVersionsResponse' {} Maybe Text
a -> ListPackageVersionsResponse
s {$sel:package:ListPackageVersionsResponse' :: Maybe Text
package = Maybe Text
a} :: ListPackageVersionsResponse)

-- | The default package version to display. This depends on the package
-- format:
--
-- -   For Maven and PyPI packages, it\'s the most recently published
--     package version.
--
-- -   For npm packages, it\'s the version referenced by the @latest@ tag.
--     If the @latest@ tag is not set, it\'s the most recently published
--     package version.
listPackageVersionsResponse_defaultDisplayVersion :: Lens.Lens' ListPackageVersionsResponse (Prelude.Maybe Prelude.Text)
listPackageVersionsResponse_defaultDisplayVersion :: (Maybe Text -> f (Maybe Text))
-> ListPackageVersionsResponse -> f ListPackageVersionsResponse
listPackageVersionsResponse_defaultDisplayVersion = (ListPackageVersionsResponse -> Maybe Text)
-> (ListPackageVersionsResponse
    -> Maybe Text -> ListPackageVersionsResponse)
-> Lens' ListPackageVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackageVersionsResponse' {Maybe Text
defaultDisplayVersion :: Maybe Text
$sel:defaultDisplayVersion:ListPackageVersionsResponse' :: ListPackageVersionsResponse -> Maybe Text
defaultDisplayVersion} -> Maybe Text
defaultDisplayVersion) (\s :: ListPackageVersionsResponse
s@ListPackageVersionsResponse' {} Maybe Text
a -> ListPackageVersionsResponse
s {$sel:defaultDisplayVersion:ListPackageVersionsResponse' :: Maybe Text
defaultDisplayVersion = Maybe Text
a} :: ListPackageVersionsResponse)

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

instance Prelude.NFData ListPackageVersionsResponse