createTargetAccountConfiguration method

Future<CreateTargetAccountConfigurationResponse> createTargetAccountConfiguration({
  1. required String accountId,
  2. required String experimentTemplateId,
  3. required String roleArn,
  4. String? clientToken,
  5. String? description,
})

Creates a target account configuration for the experiment template. A target account configuration is required when accountTargeting of experimentOptions is set to multi-account. For more information, see experiment options in the Fault Injection Service User Guide.

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

Parameter accountId : The Amazon Web Services account ID of the target account.

Parameter experimentTemplateId : The experiment template ID.

Parameter roleArn : The Amazon Resource Name (ARN) of an IAM role for the target account.

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

Parameter description : The description of the target account.

Implementation

Future<CreateTargetAccountConfigurationResponse>
    createTargetAccountConfiguration({
  required String accountId,
  required String experimentTemplateId,
  required String roleArn,
  String? clientToken,
  String? description,
}) async {
  final $payload = <String, dynamic>{
    'roleArn': roleArn,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/experimentTemplates/${Uri.encodeComponent(experimentTemplateId)}/targetAccountConfigurations/${Uri.encodeComponent(accountId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateTargetAccountConfigurationResponse.fromJson(response);
}