createExperimentTemplate method

Future<CreateExperimentTemplateResponse> createExperimentTemplate({
  1. required Map<String, CreateExperimentTemplateActionInput> actions,
  2. required String description,
  3. required String roleArn,
  4. required List<CreateExperimentTemplateStopConditionInput> stopConditions,
  5. String? clientToken,
  6. CreateExperimentTemplateExperimentOptionsInput? experimentOptions,
  7. CreateExperimentTemplateReportConfigurationInput? experimentReportConfiguration,
  8. CreateExperimentTemplateLogConfigurationInput? logConfiguration,
  9. Map<String, String>? tags,
  10. Map<String, CreateExperimentTemplateTargetInput>? targets,
})

Creates an experiment template.

An experiment template includes the following components:

  • Targets: A target can be a specific resource in your Amazon Web Services environment, or one or more resources that match criteria that you specify, for example, resources that have specific tags.
  • Actions: The actions to carry out on the target. You can specify multiple actions, the duration of each action, and when to start each action during an experiment.
  • Stop conditions: If a stop condition is triggered while an experiment is running, the experiment is automatically stopped. You can define a stop condition as a CloudWatch alarm.
For more information, see experiment templates in the Fault Injection Service User Guide.

May throw ConflictException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter actions : The actions for the experiment.

Parameter description : A description for the experiment template.

Parameter roleArn : The Amazon Resource Name (ARN) of an IAM role that grants the FIS service permission to perform service actions on your behalf.

Parameter stopConditions : The stop conditions.

Parameter clientToken : Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Parameter experimentOptions : The experiment options for the experiment template.

Parameter experimentReportConfiguration : The experiment report configuration for the experiment template.

Parameter logConfiguration : The configuration for experiment logging.

Parameter tags : The tags to apply to the experiment template.

Parameter targets : The targets for the experiment.

Implementation

Future<CreateExperimentTemplateResponse> createExperimentTemplate({
  required Map<String, CreateExperimentTemplateActionInput> actions,
  required String description,
  required String roleArn,
  required List<CreateExperimentTemplateStopConditionInput> stopConditions,
  String? clientToken,
  CreateExperimentTemplateExperimentOptionsInput? experimentOptions,
  CreateExperimentTemplateReportConfigurationInput?
      experimentReportConfiguration,
  CreateExperimentTemplateLogConfigurationInput? logConfiguration,
  Map<String, String>? tags,
  Map<String, CreateExperimentTemplateTargetInput>? targets,
}) async {
  final $payload = <String, dynamic>{
    'actions': actions,
    'description': description,
    'roleArn': roleArn,
    'stopConditions': stopConditions,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (experimentOptions != null) 'experimentOptions': experimentOptions,
    if (experimentReportConfiguration != null)
      'experimentReportConfiguration': experimentReportConfiguration,
    if (logConfiguration != null) 'logConfiguration': logConfiguration,
    if (tags != null) 'tags': tags,
    if (targets != null) 'targets': targets,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/experimentTemplates',
    exceptionFnMap: _exceptionFns,
  );
  return CreateExperimentTemplateResponse.fromJson(response);
}