Skip to content

update_package_versions_status async

update_package_versions_status(
    domain: DomainName,
    repository: RepositoryName,
    format: PackageFormat,
    package: PackageName,
    versions: PackageVersionList,
    target_status: PackageVersionStatus,
    *,
    config_overrides: Optional[AsynccodeartifactClientConfig] = None,
    domain_owner: Optional[AccountId] = None,
    namespace: Optional[PackageNamespace] = None,
    version_revisions: Optional[PackageVersionRevisionMap] = None,
    expected_status: Optional[PackageVersionStatus] = None,
) -> UpdatePackageVersionsStatusResult

Updates the status of one or more versions of a package. Using UpdatePackageVersionsStatus, you can update the status of package versions to Archived, Published, or Unlisted. To set the status of a package version to Disposed, use DisposePackageVersions.

Parameters:

  • domain (DomainName) –

    The name of the domain that contains the repository that contains the package versions with a status to be updated.

  • 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 repository that contains the package versions with the status you want to update.

  • format (PackageFormat) –

    A format that specifies the type of the package with the statuses to update.

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

    The namespace of the package version to be updated. The package component that specifies its namespace depends on its type. For example:

    • 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 with the version statuses to update.

  • versions (PackageVersionList) –

    An array of strings that specify the versions of the package with the statuses to update.

  • version_revisions (Optional[PackageVersionRevisionMap], default: None ) –

    A map of package versions and package version revisions. The map key is the package version (for example, 3.5.2), and the map value is the package version revision.

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

    The package version’s expected status before it is updated. If expectedStatus is provided, the package version's status is updated only if its status at the time UpdatePackageVersionsStatus is called matches expectedStatus.

  • target_status (PackageVersionStatus) –

    The status you want to change the package version status to.

Raises:

  • AccessDeniedException –

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

  • ConflictException –

    The operation did not succeed because prerequisites are not met.

  • 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 update_package_versions_status(
    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",
    versions: "capo_codeartifact.types.package_version_list.PackageVersionList",
    target_status: "capo_codeartifact.types.package_version_status.PackageVersionStatus",
    *,
    config_overrides: Optional[AsynccodeartifactClientConfig] = None,
    domain_owner: Optional["capo_codeartifact.types.account_id.AccountId"] = None,
    namespace: Optional[
        "capo_codeartifact.types.package_namespace.PackageNamespace"
    ] = None,
    version_revisions: Optional[
        "capo_codeartifact.types.package_version_revision_map.PackageVersionRevisionMap"
    ] = None,
    expected_status: Optional[
        "capo_codeartifact.types.package_version_status.PackageVersionStatus"
    ] = None,
) -> "capo_codeartifact.types.update_package_versions_status_result.UpdatePackageVersionsStatusResult":
    """<p> Updates the status of one or more versions of a package. Using <code>UpdatePackageVersionsStatus</code>, you can update the status of package versions to <code>Archived</code>, <code>Published</code>, or <code>Unlisted</code>. To set the status of a package version to <code>Disposed</code>, use <a href="https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DisposePackageVersions.html">DisposePackageVersions</a>. </p>

    Args:
        domain: <p> The name of the domain that contains the repository that contains the package versions with a status to be updated. </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 repository that contains the package versions with the status you want to update. </p>
        format: <p> A format that specifies the type of the package with the statuses to update. </p>
        namespace: <p>The namespace of the package version to be updated. The package component that specifies its namespace depends on its type. For example:</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: <p> The name of the package with the version statuses to update. </p>
        versions: <p> An array of strings that specify the versions of the package with the statuses to update. </p>
        version_revisions: <p> A map of package versions and package version revisions. The map <code>key</code> is the package version (for example, <code>3.5.2</code>), and the map <code>value</code> is the package version revision. </p>
        expected_status: <p> The package version’s expected status before it is updated. If <code>expectedStatus</code> is provided, the package version's status is updated only if its status at the time <code>UpdatePackageVersionsStatus</code> is called matches <code>expectedStatus</code>. </p>
        target_status: <p> The status you want to change the package version status to. </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.conflict_exception.ConflictException: <p> The operation did not succeed because prerequisites are not met. </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.update_package_versions_status_request.UpdatePackageVersionsStatusRequest]",
    ) -> AsyncOperationResponse[
        "capo_codeartifact.types.update_package_versions_status_result.UpdatePackageVersionsStatusResult"
    ]:
        import capo_codeartifact._operations.code_artifact_control_plane_service.update_package_versions_status

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePackageVersionsStatus")
    )
    input_: capo_codeartifact.types.update_package_versions_status_request.UpdatePackageVersionsStatusRequest = {
        "domain": domain,
        "repository": repository,
        "format": format,
        "package": package,
        "versions": versions,
        "target_status": target_status,
    }
    if domain_owner is not None:
        input_["domain_owner"] = domain_owner
    if namespace is not None:
        input_["namespace"] = namespace
    if version_revisions is not None:
        input_["version_revisions"] = version_revisions
    if expected_status is not None:
        input_["expected_status"] = expected_status

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