delete_package_versions

delete_package_versions(**kwargs)

Deletes one or more versions of a package. A deleted package version cannot be restored in your repository. If you want to remove a package version from your repository and be able to restore it later, set its status to Archived . Archived packages cannot be downloaded from a repository and don't show up with list package APIs (for example, ListackageVersions ), but you can restore them using UpdatePackageVersionsStatus.

See also: AWS API Documentation

Request Syntax

response = client.delete_package_versions(
    domain='string',
    domainOwner='string',
    repository='string',
    format='npm'|'pypi'|'maven'|'nuget',
    namespace='string',
    package='string',
    versions=[
        'string',
    ],
    expectedStatus='Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted'
)
Parameters
  • domain (string) --

    [REQUIRED]

    The name of the domain that contains the package to delete.

  • domainOwner (string) -- The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.
  • repository (string) --

    [REQUIRED]

    The name of the repository that contains the package versions to delete.

  • format (string) --

    [REQUIRED]

    The format of the package versions to delete.

  • namespace (string) --

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

    • The namespace of a Maven package version is its groupId . The namespace is required when deleting Maven package versions.
    • The namespace of an npm package version is its scope .
    • Python and NuGet package versions do not contain a corresponding component, package versions of those formats do not have a namespace.
  • package (string) --

    [REQUIRED]

    The name of the package with the versions to delete.

  • versions (list) --

    [REQUIRED]

    An array of strings that specify the versions of the package to delete.

    • (string) --
  • expectedStatus (string) -- The expected status of the package version to delete.
Return type

dict

Returns

Response Syntax

{
    'successfulVersions': {
        'string': {
            'revision': 'string',
            'status': 'Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted'
        }
    },
    'failedVersions': {
        'string': {
            'errorCode': 'ALREADY_EXISTS'|'MISMATCHED_REVISION'|'MISMATCHED_STATUS'|'NOT_ALLOWED'|'NOT_FOUND'|'SKIPPED',
            'errorMessage': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • successfulVersions (dict) --

      A list of the package versions that were successfully deleted. The status of every successful version will be Deleted .

      • (string) --

        • (dict) --

          Contains the revision and status of a package version.

          • revision (string) --

            The revision of a package version.

          • status (string) --

            The status of a package version.

    • failedVersions (dict) --

      A PackageVersionError object that contains a map of errors codes for the deleted package that failed. The possible error codes are:

      • ALREADY_EXISTS
      • MISMATCHED_REVISION
      • MISMATCHED_STATUS
      • NOT_ALLOWED
      • NOT_FOUND
      • SKIPPED
      • (string) --

        • (dict) --

          l An error associated with package.

          • errorCode (string) --

            The error code associated with the error. Valid error codes are:

            • ALREADY_EXISTS
            • MISMATCHED_REVISION
            • MISMATCHED_STATUS
            • NOT_ALLOWED
            • NOT_FOUND
            • SKIPPED
          • errorMessage (string) --

            The error message associated with the error.

Exceptions

  • CodeArtifact.Client.exceptions.AccessDeniedException
  • CodeArtifact.Client.exceptions.ConflictException
  • CodeArtifact.Client.exceptions.InternalServerException
  • CodeArtifact.Client.exceptions.ResourceNotFoundException
  • CodeArtifact.Client.exceptions.ThrottlingException
  • CodeArtifact.Client.exceptions.ValidationException