createABTest method
Creates an A/B test for comparing agent configurations. A/B tests split traffic between a control variant and a treatment variant through a gateway, then evaluate performance using online evaluation configurations to determine which variant performs better.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw UnauthorizedException.
May throw ValidationException.
Parameter evaluationConfig :
The evaluation configuration specifying which online evaluation
configurations to use for measuring variant performance.
Parameter gatewayArn :
The Amazon Resource Name (ARN) of the gateway to use for traffic
splitting.
Parameter name :
The name of the A/B test. Must be unique within your account.
Parameter roleArn :
The IAM role ARN that grants permissions for the A/B test to access
gateway and evaluation resources.
Parameter variants :
The list of variants for the A/B test. Must contain exactly two variants:
a control (C) and a treatment (T1), each with a configuration bundle or
target reference and a traffic weight.
Parameter clientToken :
A unique, case-sensitive identifier to ensure that the API request
completes no more than one time. If this token matches a previous request,
the service ignores the request, but does not return an error.
Parameter description :
The description of the A/B test.
Parameter enableOnCreate :
Whether to enable the A/B test immediately upon creation. If true, traffic
splitting begins automatically.
Parameter gatewayFilter :
Optional filter to restrict which gateway target paths are included in the
A/B test.
Implementation
Future<CreateABTestResponse> createABTest({
required ABTestEvaluationConfig evaluationConfig,
required String gatewayArn,
required String name,
required String roleArn,
required List<Variant> variants,
String? clientToken,
String? description,
bool? enableOnCreate,
GatewayFilter? gatewayFilter,
}) async {
final $payload = <String, dynamic>{
'evaluationConfig': evaluationConfig,
'gatewayArn': gatewayArn,
'name': name,
'roleArn': roleArn,
'variants': variants,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (enableOnCreate != null) 'enableOnCreate': enableOnCreate,
if (gatewayFilter != null) 'gatewayFilter': gatewayFilter,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/ab-tests',
exceptionFnMap: _exceptionFns,
);
return CreateABTestResponse.fromJson(response);
}