createTestCase method

Future<CreateTestCaseResponse> createTestCase({
  1. required String content,
  2. required String instanceId,
  3. required String name,
  4. String? description,
  5. TestCaseEntryPoint? entryPoint,
  6. String? initializationData,
  7. String? lastModifiedRegion,
  8. DateTime? lastModifiedTime,
  9. TestCaseStatus? status,
  10. Map<String, String>? tags,
  11. String? testCaseId,
})

Creates a test case with its content and metadata for the specified Amazon Connect instance.

May throw AccessDeniedException. May throw DuplicateResourceException. May throw IdempotencyException. May throw InternalServiceException. May throw InvalidParameterException. May throw InvalidRequestException. May throw InvalidTestCaseException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException.

Parameter content : The JSON string that represents the content of the test.

Parameter instanceId : The identifier of the Amazon Connect instance.

Parameter name : The name of the test.

Parameter description : The description of the test.

Parameter entryPoint : Defines the starting point for your test.

Parameter initializationData : Defines the initial custom attributes for your test.

Parameter lastModifiedRegion : The region in which the resource was last modified

Parameter lastModifiedTime : The time at which the resource was last modified.

Parameter status : Indicates the test status as either SAVED or PUBLISHED. The PUBLISHED status will initiate validation on the content. The SAVED status does not initiate validation of the content.

Parameter tags : The tags used to organize, track, or control access for this resource.

Parameter testCaseId : Id of the test case if you want to create it in a replica region using Amazon Connect Global Resiliency

Implementation

Future<CreateTestCaseResponse> createTestCase({
  required String content,
  required String instanceId,
  required String name,
  String? description,
  TestCaseEntryPoint? entryPoint,
  String? initializationData,
  String? lastModifiedRegion,
  DateTime? lastModifiedTime,
  TestCaseStatus? status,
  Map<String, String>? tags,
  String? testCaseId,
}) async {
  final headers = <String, String>{
    if (lastModifiedRegion != null)
      'x-amz-last-modified-region': lastModifiedRegion.toString(),
    if (lastModifiedTime != null)
      'x-amz-last-modified-time': _s.rfc822ToJson(lastModifiedTime),
    if (testCaseId != null) 'x-amz-resource-id': testCaseId.toString(),
  };
  final $payload = <String, dynamic>{
    'Content': content,
    'Name': name,
    if (description != null) 'Description': description,
    if (entryPoint != null) 'EntryPoint': entryPoint,
    if (initializationData != null) 'InitializationData': initializationData,
    if (status != null) 'Status': status.value,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/test-cases/${Uri.encodeComponent(instanceId)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateTestCaseResponse.fromJson(response);
}