Skip to content

list_package_versions

list_package_versions(
    domain: DomainName,
    repository: RepositoryName,
    format: PackageFormat,
    package: PackageName,
    *,
    config_overrides: Optional[codeartifactClientConfig] = None,
    domain_owner: Optional[AccountId] = None,
    namespace: Optional[PackageNamespace] = None,
    status: Optional[PackageVersionStatus] = None,
    sort_by: Optional[PackageVersionSortType] = None,
    max_results: Optional[ListPackageVersionsMaxResults] = None,
    next_token: Optional[PaginationToken] = None,
    origin_type: Optional[PackageVersionOriginType] = None,
) -> ListPackageVersionsResult

Returns a list of PackageVersionSummary objects for package versions in a repository that match the request parameters. Package versions of all statuses will be returned by default when calling list-package-versions with no --status parameter.

Parameters:

  • domain (DomainName) –

    The name of the domain that contains the repository that contains the requested package versions.

  • domain_owner (Optional[AccountId], default: None ) –

    The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

  • repository (RepositoryName) –

    The name of the repository that contains the requested package versions.

  • format (PackageFormat) –

    The format of the package versions you want to list.

  • namespace (Optional[PackageNamespace], default: None ) –

    The namespace of the package that contains the requested package versions. The package component that specifies its namespace depends on its type. For example:

    The namespace is required when deleting package versions of the following formats:

    • Maven

    • Swift

    • generic

    • The namespace of a Maven package version is its groupId.

    • The namespace of an npm or Swift package version is its scope.

    • The namespace of a generic package is its namespace.

    • Python, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace.

  • package (PackageName) –

    The name of the package for which you want to request package versions.

  • status (Optional[PackageVersionStatus], default: None ) –

    A string that filters the requested package versions by status.

  • sort_by (Optional[PackageVersionSortType], default: None ) –

    How to sort the requested list of package versions.

  • max_results (Optional[ListPackageVersionsMaxResults], default: None ) –

    The maximum number of results to return per page.

  • next_token (Optional[PaginationToken], default: None ) –

    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.

  • origin_type (Optional[PackageVersionOriginType], default: None ) –

    The originType used to filter package versions. Only package versions with the provided originType will be returned.

Raises:

  • AccessDeniedException –

    The operation did not succeed because of an unauthorized access attempt.

  • InternalServerException –

    The operation did not succeed because of an error that occurred inside CodeArtifact.

  • ResourceNotFoundException –

    The operation did not succeed because the resource requested is not found in the service.

  • ThrottlingException –

    The operation did not succeed because too many requests are sent to the service.

  • ValidationException –

    The operation did not succeed because a parameter in the request was sent with an invalid value.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_codeartifact/_services/codeartifact.py
def list_package_versions(
    self,
    domain: "capo_codeartifact.types.domain_name.DomainName",
    repository: "capo_codeartifact.types.repository_name.RepositoryName",
    format: "capo_codeartifact.types.package_format.PackageFormat",
    package: "capo_codeartifact.types.package_name.PackageName",
    *,
    config_overrides: Optional[codeartifactClientConfig] = None,
    domain_owner: Optional["capo_codeartifact.types.account_id.AccountId"] = None,
    namespace: Optional[
        "capo_codeartifact.types.package_namespace.PackageNamespace"
    ] = None,
    status: Optional[
        "capo_codeartifact.types.package_version_status.PackageVersionStatus"
    ] = None,
    sort_by: Optional[
        "capo_codeartifact.types.package_version_sort_type.PackageVersionSortType"
    ] = None,
    max_results: Optional[
        "capo_codeartifact.types.list_package_versions_max_results.ListPackageVersionsMaxResults"
    ] = None,
    next_token: Optional[
        "capo_codeartifact.types.pagination_token.PaginationToken"
    ] = None,
    origin_type: Optional[
        "capo_codeartifact.types.package_version_origin_type.PackageVersionOriginType"
    ] = None,
) -> (
    "capo_codeartifact.types.list_package_versions_result.ListPackageVersionsResult"
):
    """<p> Returns a list of <a href="https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageVersionSummary.html">PackageVersionSummary</a> objects for package versions in a repository that match the request parameters. Package versions of all statuses will be returned by default when calling <code>list-package-versions</code> with no <code>--status</code> parameter. </p>

    Args:
        domain: <p> The name of the domain that contains the repository that contains the requested package versions. </p>
        domain_owner: <p> The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces. </p>
        repository: <p> The name of the repository that contains the requested package versions. </p>
        format: <p> The format of the package versions you want to list. </p>
        namespace: <p>The namespace of the package that contains the requested package versions. The package component that specifies its namespace depends on its type. For example:</p> <note> <p>The namespace is required when deleting package versions of the following formats:</p> <ul> <li> <p>Maven</p> </li> <li> <p>Swift</p> </li> <li> <p>generic</p> </li> </ul> </note> <ul> <li> <p> The namespace of a Maven package version is its <code>groupId</code>. </p> </li> <li> <p> The namespace of an npm or Swift package version is its <code>scope</code>. </p> </li> <li> <p>The namespace of a generic package is its <code>namespace</code>.</p> </li> <li> <p> Python, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace. </p> </li> </ul>
        package: <p> The name of the package for which you want to request package versions. </p>
        status: <p> A string that filters the requested package versions by status. </p>
        sort_by: <p> How to sort the requested list of package versions. </p>
        max_results: <p> The maximum number of results to return per page. </p>
        next_token: <p> 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. </p>
        origin_type: <p>The <code>originType</code> used to filter package versions. Only package versions with the provided <code>originType</code> will be returned.</p>

    Raises:
        capo_codeartifact.errors.access_denied_exception.AccessDeniedException: <p> The operation did not succeed because of an unauthorized access attempt. </p>
        capo_codeartifact.errors.internal_server_exception.InternalServerException: <p> The operation did not succeed because of an error that occurred inside CodeArtifact. </p>
        capo_codeartifact.errors.resource_not_found_exception.ResourceNotFoundException: <p> The operation did not succeed because the resource requested is not found in the service. </p>
        capo_codeartifact.errors.throttling_exception.ThrottlingException: <p> The operation did not succeed because too many requests are sent to the service. </p>
        capo_codeartifact.errors.validation_exception.ValidationException: <p> The operation did not succeed because a parameter in the request was sent with an invalid value. </p>
        capo_codeartifact.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codeartifact.types.list_package_versions_request.ListPackageVersionsRequest]",
    ) -> OperationResponse[
        "capo_codeartifact.types.list_package_versions_result.ListPackageVersionsResult"
    ]:
        import capo_codeartifact._operations.code_artifact_control_plane_service.list_package_versions

        output, http_response = (
            capo_codeartifact._operations.code_artifact_control_plane_service.list_package_versions.list_package_versions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPackageVersions")
    )
    input_: capo_codeartifact.types.list_package_versions_request.ListPackageVersionsRequest = {
        "domain": domain,
        "repository": repository,
        "format": format,
        "package": package,
    }
    if domain_owner is not None:
        input_["domain_owner"] = domain_owner
    if namespace is not None:
        input_["namespace"] = namespace
    if status is not None:
        input_["status"] = status
    if sort_by is not None:
        input_["sort_by"] = sort_by
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if origin_type is not None:
        input_["origin_type"] = origin_type

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output