updatePackageVersion method

Future<void> updatePackageVersion({
  1. required String packageName,
  2. required String versionName,
  3. PackageVersionAction? action,
  4. PackageVersionArtifact? artifact,
  5. Map<String, String>? attributes,
  6. String? clientToken,
  7. String? description,
  8. String? recipe,
})

Updates the supported fields for a specific package version.

Requires permission to access the UpdatePackageVersion and GetIndexingConfiguration actions.

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

Parameter packageName : The name of the associated software package.

Parameter versionName : The name of the target package version.

Parameter action : The status that the package version should be assigned. For more information, see Package version lifecycle.

Parameter artifact : The various components that make up a software package version.

Parameter attributes : Metadata that can be used to define a package version’s configuration. For example, the Amazon S3 file location, configuration options that are being sent to the device or fleet.

Note: Attributes can be updated only when the package version is in a draft state.

The combined size of all the attributes on a package version is limited to 3KB.

Parameter clientToken : A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

Parameter description : The package version description.

Parameter recipe : The inline job document associated with a software package version used for a quick job deployment.

Implementation

Future<void> updatePackageVersion({
  required String packageName,
  required String versionName,
  PackageVersionAction? action,
  PackageVersionArtifact? artifact,
  Map<String, String>? attributes,
  String? clientToken,
  String? description,
  String? recipe,
}) async {
  final $query = <String, List<String>>{
    if (clientToken != null) 'clientToken': [clientToken],
  };
  final $payload = <String, dynamic>{
    if (action != null) 'action': action.value,
    if (artifact != null) 'artifact': artifact,
    if (attributes != null) 'attributes': attributes,
    if (description != null) 'description': description,
    if (recipe != null) 'recipe': recipe,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/packages/${Uri.encodeComponent(packageName)}/versions/${Uri.encodeComponent(versionName)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}