createJobTemplate method

Future<CreateJobTemplateResponse> createJobTemplate({
  1. required String description,
  2. required String jobTemplateId,
  3. AbortConfig? abortConfig,
  4. List<String>? destinationPackageVersions,
  5. String? document,
  6. String? documentSource,
  7. String? jobArn,
  8. JobExecutionsRetryConfig? jobExecutionsRetryConfig,
  9. JobExecutionsRolloutConfig? jobExecutionsRolloutConfig,
  10. List<MaintenanceWindow>? maintenanceWindows,
  11. PresignedUrlConfig? presignedUrlConfig,
  12. List<Tag>? tags,
  13. TimeoutConfig? timeoutConfig,
})

Creates a job template.

Requires permission to access the CreateJobTemplate action.

May throw ConflictException. May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter description : A description of the job document.

Parameter jobTemplateId : A unique identifier for the job template. We recommend using a UUID. Alpha-numeric characters, "-", and "_" are valid for use here.

Parameter destinationPackageVersions : The package version Amazon Resource Names (ARNs) that are installed on the device when the job successfully completes. The package version must be in either the Published or Deprecated state when the job deploys. For more information, see Package version lifecycle.

Note:The following Length Constraints relates to a single ARN. Up to 25 package version ARNs are allowed.

Parameter document : The job document. Required if you don't specify a value for documentSource.

Parameter documentSource : An S3 link, or S3 object URL, to the job document. The link is an Amazon S3 object URL and is required if you don't specify a value for document.

For example, --document-source https://s3.region-code.amazonaws.com/example-firmware/device-firmware.1.0

For more information, see Methods for accessing a bucket.

Parameter jobArn : The ARN of the job to use as the basis for the job template.

Parameter jobExecutionsRetryConfig : Allows you to create the criteria to retry a job.

Parameter maintenanceWindows : Allows you to configure an optional maintenance window for the rollout of a job document to all devices in the target group for a job.

Parameter tags : Metadata that can be used to manage the job template.

Implementation

Future<CreateJobTemplateResponse> createJobTemplate({
  required String description,
  required String jobTemplateId,
  AbortConfig? abortConfig,
  List<String>? destinationPackageVersions,
  String? document,
  String? documentSource,
  String? jobArn,
  JobExecutionsRetryConfig? jobExecutionsRetryConfig,
  JobExecutionsRolloutConfig? jobExecutionsRolloutConfig,
  List<MaintenanceWindow>? maintenanceWindows,
  PresignedUrlConfig? presignedUrlConfig,
  List<Tag>? tags,
  TimeoutConfig? timeoutConfig,
}) async {
  final $payload = <String, dynamic>{
    'description': description,
    if (abortConfig != null) 'abortConfig': abortConfig,
    if (destinationPackageVersions != null)
      'destinationPackageVersions': destinationPackageVersions,
    if (document != null) 'document': document,
    if (documentSource != null) 'documentSource': documentSource,
    if (jobArn != null) 'jobArn': jobArn,
    if (jobExecutionsRetryConfig != null)
      'jobExecutionsRetryConfig': jobExecutionsRetryConfig,
    if (jobExecutionsRolloutConfig != null)
      'jobExecutionsRolloutConfig': jobExecutionsRolloutConfig,
    if (maintenanceWindows != null) 'maintenanceWindows': maintenanceWindows,
    if (presignedUrlConfig != null) 'presignedUrlConfig': presignedUrlConfig,
    if (tags != null) 'tags': tags,
    if (timeoutConfig != null) 'timeoutConfig': timeoutConfig,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/job-templates/${Uri.encodeComponent(jobTemplateId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateJobTemplateResponse.fromJson(response);
}