createPackageVersion method

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

Creates a new version for an existing IoT software package.

Requires permission to access the CreatePackageVersion and GetIndexingConfiguration actions.

May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter packageName : The name of the associated software package.

Parameter versionName : The name of the new package version.

Parameter artifact : The various build components created during the build process such as libraries and configuration files that make up a software package version.

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

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 : A summary of the package version being created. This can be used to outline the package's contents or purpose.

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

Parameter tags : Metadata that can be used to manage the package version.

Implementation

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