createRecommendationTemplate method

Future<CreateRecommendationTemplateResponse> createRecommendationTemplate({
  1. required String assessmentArn,
  2. required String name,
  3. String? bucketName,
  4. String? clientToken,
  5. TemplateFormat? format,
  6. List<String>? recommendationIds,
  7. List<RenderRecommendationType>? recommendationTypes,
  8. Map<String, String>? tags,
})

Creates a new recommendation template for the Resilience Hub application.

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

Parameter assessmentArn : Amazon Resource Name (ARN) of the assessment. The format for this ARN is: arn:partition:resiliencehub:region:account:app-assessment/app-id. For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference guide.

Parameter name : The name for the recommendation template.

Parameter bucketName : The name of the Amazon S3 bucket that will contain the recommendation template.

Parameter clientToken : Used for an idempotency token. A client token is a unique, case-sensitive string of up to 64 ASCII characters. You should not reuse the same client token for other API requests.

Parameter format : The format for the recommendation template.

CfnJson
The template is CloudFormation JSON.
CfnYaml
The template is CloudFormation YAML.

Parameter recommendationIds : Identifiers for the recommendations used to create a recommendation template.

Parameter recommendationTypes : An array of strings that specify the recommendation template type or types.

Alarm
The template is an AlarmRecommendation template.
Sop
The template is a SopRecommendation template.
Test
The template is a TestRecommendation template.

Parameter tags : Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key/value pair.

Implementation

Future<CreateRecommendationTemplateResponse> createRecommendationTemplate({
  required String assessmentArn,
  required String name,
  String? bucketName,
  String? clientToken,
  TemplateFormat? format,
  List<String>? recommendationIds,
  List<RenderRecommendationType>? recommendationTypes,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'assessmentArn': assessmentArn,
    'name': name,
    if (bucketName != null) 'bucketName': bucketName,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (format != null) 'format': format.value,
    if (recommendationIds != null) 'recommendationIds': recommendationIds,
    if (recommendationTypes != null)
      'recommendationTypes': recommendationTypes.map((e) => e.value).toList(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/create-recommendation-template',
    exceptionFnMap: _exceptionFns,
  );
  return CreateRecommendationTemplateResponse.fromJson(response);
}