createGeneratedTemplate method

Future<CreateGeneratedTemplateOutput> createGeneratedTemplate({
  1. required String generatedTemplateName,
  2. List<ResourceDefinition>? resources,
  3. String? stackName,
  4. TemplateConfiguration? templateConfiguration,
})

Creates a template from existing resources that are not already managed with CloudFormation. You can check the status of the template generation using the DescribeGeneratedTemplate API action.

May throw AlreadyExistsException. May throw ConcurrentResourcesLimitExceededException. May throw LimitExceededException.

Parameter generatedTemplateName : The name assigned to the generated template.

Parameter resources : An optional list of resources to be included in the generated template.

If no resources are specified,the template will be created without any resources. Resources can be added to the template using the UpdateGeneratedTemplate API action.

Parameter stackName : An optional name or ARN of a stack to use as the base stack for the generated template.

Parameter templateConfiguration : The configuration details of the generated template, including the DeletionPolicy and UpdateReplacePolicy.

Implementation

Future<CreateGeneratedTemplateOutput> createGeneratedTemplate({
  required String generatedTemplateName,
  List<ResourceDefinition>? resources,
  String? stackName,
  TemplateConfiguration? templateConfiguration,
}) async {
  final $request = <String, String>{
    'GeneratedTemplateName': generatedTemplateName,
    if (resources != null)
      if (resources.isEmpty)
        'Resources': ''
      else
        for (var i1 = 0; i1 < resources.length; i1++)
          for (var e3 in resources[i1].toQueryMap().entries)
            'Resources.member.${i1 + 1}.${e3.key}': e3.value,
    if (stackName != null) 'StackName': stackName,
    if (templateConfiguration != null)
      for (var e1 in templateConfiguration.toQueryMap().entries)
        'TemplateConfiguration.${e1.key}': e1.value,
  };
  final $result = await _protocol.send(
    $request,
    action: 'CreateGeneratedTemplate',
    version: '2010-05-15',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateGeneratedTemplateResult',
  );
  return CreateGeneratedTemplateOutput.fromXml($result);
}