updatePackageVersionsStatus method

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

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.

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 that contains the package versions with a status to be updated.

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

Parameter package : The name of the package with the version statuses to update.

Parameter repository : The repository that contains the package versions with the status you want to update.

Parameter targetStatus : The status you want to change the package version status to.

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

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

Parameter namespace : 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.

Parameter versionRevisions : 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.

Implementation

Future<UpdatePackageVersionsStatusResult> updatePackageVersionsStatus({
  required String domain,
  required PackageFormat format,
  required String package,
  required String repository,
  required PackageVersionStatus targetStatus,
  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>{
    'targetStatus': targetStatus.value,
    '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/update_status',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return UpdatePackageVersionsStatusResult.fromJson(response);
}