createJobTemplate method
Creates a job template. Job template stores values of StartJobRun API request in a template and can be used to start a job run. Job template allows two use cases: avoid repeating recurring StartJobRun API request values, enforcing certain values in StartJobRun API request.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ValidationException.
Parameter jobTemplateData :
The job template data which holds values of StartJobRun API request.
Parameter name :
The specified name of the job template.
Parameter clientToken :
The client token of the job template.
Parameter kmsKeyArn :
The KMS key ARN used to encrypt the job template.
Parameter tags :
The tags that are associated with the job template.
Implementation
Future<CreateJobTemplateResponse> createJobTemplate({
required JobTemplateData jobTemplateData,
required String name,
String? clientToken,
String? kmsKeyArn,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'jobTemplateData': jobTemplateData,
'name': name,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (kmsKeyArn != null) 'kmsKeyArn': kmsKeyArn,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/jobtemplates',
exceptionFnMap: _exceptionFns,
);
return CreateJobTemplateResponse.fromJson(response);
}