createEnvironmentTemplateVersion method

Future<CreateEnvironmentTemplateVersionOutput> createEnvironmentTemplateVersion({
  1. required TemplateVersionSourceInput source,
  2. required String templateName,
  3. String? clientToken,
  4. String? description,
  5. String? majorVersion,
  6. List<Tag>? tags,
})

Create a new major or minor version of an environment template. A major version of an environment template is a version that isn't backwards compatible. A minor version of an environment template is a version that's backwards compatible within its major version.

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

Parameter source : An object that includes the template bundle S3 bucket path and name for the new version of an template.

Parameter templateName : The name of the environment template.

Parameter clientToken : When included, if two identical requests are made with the same client token, Proton returns the environment template version that the first request created.

Parameter description : A description of the new version of an environment template.

Parameter majorVersion : To create a new minor version of the environment template, include major Version.

To create a new major and minor version of the environment template, exclude major Version.

Parameter tags : An optional list of metadata items that you can associate with the Proton environment template version. A tag is a key-value pair.

For more information, see Proton resources and tagging in the Proton User Guide.

Implementation

Future<CreateEnvironmentTemplateVersionOutput>
    createEnvironmentTemplateVersion({
  required TemplateVersionSourceInput source,
  required String templateName,
  String? clientToken,
  String? description,
  String? majorVersion,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AwsProton20200720.CreateEnvironmentTemplateVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'source': source,
      'templateName': templateName,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'description': description,
      if (majorVersion != null) 'majorVersion': majorVersion,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateEnvironmentTemplateVersionOutput.fromJson(jsonResponse.body);
}