disposePackageVersions method

Future<DisposePackageVersionsResult> disposePackageVersions({
  1. required String domain,
  2. required PackageFormat format,
  3. required String package,
  4. required String repository,
  5. required List<String> versions,
  6. String? domainOwner,
  7. PackageVersionStatus? expectedStatus,
  8. String? namespace,
  9. Map<String, String>? versionRevisions,
})

Deletes the assets in package versions and sets the package versions' status to Disposed. A disposed package version cannot be restored in your repository because its assets are deleted.

To view all disposed package versions in a repository, use ListPackageVersions and set the status parameter to Disposed.

To view information about a disposed package version, use DescribePackageVersion.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter domain : The name of the domain that contains the repository you want to dispose.

Parameter format : A format that specifies the type of package versions you want to dispose.

Parameter package : The name of the package with the versions you want to dispose.

Parameter repository : The name of the repository that contains the package versions you want to dispose.

Parameter versions : The versions of the package you want to dispose.

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

Parameter expectedStatus : The expected status of the package version to dispose.

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

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

Parameter versionRevisions : The revisions of the package versions you want to dispose.

Implementation

Future<DisposePackageVersionsResult> disposePackageVersions({
  required String domain,
  required PackageFormat format,
  required String package,
  required String repository,
  required List<String> versions,
  String? domainOwner,
  PackageVersionStatus? expectedStatus,
  String? namespace,
  Map<String, String>? versionRevisions,
}) async {
  final $query = <String, List<String>>{
    'domain': [domain],
    'format': [format.value],
    'package': [package],
    'repository': [repository],
    if (domainOwner != null) 'domain-owner': [domainOwner],
    if (namespace != null) 'namespace': [namespace],
  };
  final $payload = <String, dynamic>{
    'versions': versions,
    if (expectedStatus != null) 'expectedStatus': expectedStatus.value,
    if (versionRevisions != null) 'versionRevisions': versionRevisions,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/package/versions/dispose',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return DisposePackageVersionsResult.fromJson(response);
}