Skip to content

list_packages async

list_packages(
    domain: DomainName,
    repository: RepositoryName,
    *,
    config_overrides: Optional[AsynccodeartifactClientConfig] = None,
    domain_owner: Optional[AccountId] = None,
    format: Optional[PackageFormat] = None,
    namespace: Optional[PackageNamespace] = None,
    package_prefix: Optional[PackageName] = None,
    max_results: Optional[ListPackagesMaxResults] = None,
    next_token: Optional[PaginationToken] = None,
    publish: Optional[AllowPublish] = None,
    upstream: Optional[AllowUpstream] = None,
) -> ListPackagesResult

Returns a list of PackageSummary objects for packages in a repository that match the request parameters.

Parameters:

  • domain (DomainName) –

    The name of the domain that contains the repository that contains the requested packages.

  • 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 packages.

  • format (Optional[PackageFormat], default: None ) –

    The format used to filter requested packages. Only packages from the provided format will be returned.

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

    The namespace prefix used to filter requested packages. Only packages with a namespace that starts with the provided string value are returned. Note that although this option is called --namespace and not --namespace-prefix, it has prefix-matching behavior.

    Each package format uses namespace as follows:

    • 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_prefix (Optional[PackageName], default: None ) –

    A prefix used to filter requested packages. Only packages with names that start with packagePrefix are returned.

  • max_results (Optional[ListPackagesMaxResults], 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.

  • publish (Optional[AllowPublish], default: None ) –

    The value of the Publish package origin control restriction used to filter requested packages. Only packages with the provided restriction are returned. For more information, see PackageOriginRestrictions.

  • upstream (Optional[AllowUpstream], default: None ) –

    The value of the Upstream package origin control restriction used to filter requested packages. Only packages with the provided restriction are returned. For more information, see PackageOriginRestrictions.

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/async_codeartifact.py
async def list_packages(
    self,
    domain: "capo_codeartifact.types.domain_name.DomainName",
    repository: "capo_codeartifact.types.repository_name.RepositoryName",
    *,
    config_overrides: Optional[AsynccodeartifactClientConfig] = None,
    domain_owner: Optional["capo_codeartifact.types.account_id.AccountId"] = None,
    format: Optional["capo_codeartifact.types.package_format.PackageFormat"] = None,
    namespace: Optional[
        "capo_codeartifact.types.package_namespace.PackageNamespace"
    ] = None,
    package_prefix: Optional[
        "capo_codeartifact.types.package_name.PackageName"
    ] = None,
    max_results: Optional[
        "capo_codeartifact.types.list_packages_max_results.ListPackagesMaxResults"
    ] = None,
    next_token: Optional[
        "capo_codeartifact.types.pagination_token.PaginationToken"
    ] = None,
    publish: Optional["capo_codeartifact.types.allow_publish.AllowPublish"] = None,
    upstream: Optional[
        "capo_codeartifact.types.allow_upstream.AllowUpstream"
    ] = None,
) -> "capo_codeartifact.types.list_packages_result.ListPackagesResult":
    """<p> Returns a list of <a href="https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageSummary.html">PackageSummary</a> objects for packages in a repository that match the request parameters. </p>

    Args:
        domain: <p> The name of the domain that contains the repository that contains the requested packages. </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 packages. </p>
        format: <p>The format used to filter requested packages. Only packages from the provided format will be returned.</p>
        namespace: <p>The namespace prefix used to filter requested packages. Only packages with a namespace that starts with the provided string value are returned. Note that although this option is called <code>--namespace</code> and not <code>--namespace-prefix</code>, it has prefix-matching behavior.</p> <p>Each package format uses namespace as follows:</p> <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_prefix: <p> A prefix used to filter requested packages. Only packages with names that start with <code>packagePrefix</code> are returned. </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>
        publish: <p>The value of the <code>Publish</code> package origin control restriction used to filter requested packages. Only packages with the provided restriction are returned. For more information, see <a href="https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginRestrictions.html">PackageOriginRestrictions</a>.</p>
        upstream: <p>The value of the <code>Upstream</code> package origin control restriction used to filter requested packages. Only packages with the provided restriction are returned. For more information, see <a href="https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginRestrictions.html">PackageOriginRestrictions</a>.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codeartifact.types.list_packages_request.ListPackagesRequest]",
    ) -> AsyncOperationResponse[
        "capo_codeartifact.types.list_packages_result.ListPackagesResult"
    ]:
        import capo_codeartifact._operations.code_artifact_control_plane_service.list_packages

        (
            output,
            http_response,
        ) = await capo_codeartifact._operations.code_artifact_control_plane_service.list_packages.async_list_packages(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPackages")
    )
    input_: capo_codeartifact.types.list_packages_request.ListPackagesRequest = {
        "domain": domain,
        "repository": repository,
    }
    if domain_owner is not None:
        input_["domain_owner"] = domain_owner
    if format is not None:
        input_["format"] = format
    if namespace is not None:
        input_["namespace"] = namespace
    if package_prefix is not None:
        input_["package_prefix"] = package_prefix
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if publish is not None:
        input_["publish"] = publish
    if upstream is not None:
        input_["upstream"] = upstream

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output