createExperimentTemplate method
- 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,
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.
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);
}