createDataset method
Creates a new Dataset resource asynchronously. Returns immediately with status CREATING. Poll GetDataset until status transitions to ACTIVE or CREATE_FAILED (with failureReason).
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter datasetName :
Human-readable name for the dataset. Unique within the account
(case-insensitive). Immutable after creation.
Parameter schemaType :
Versioned schema type governing the structure of examples. Immutable after
creation.
Parameter source :
Source of initial examples. Provide either inline examples or an S3 URI
pointing to a JSONL file.
Parameter clientToken :
Optional idempotency token.
Parameter description :
A description of the dataset.
Parameter kmsKeyArn :
Optional AWS KMS key ARN for SSE-KMS on service S3 writes.
Parameter tags :
A map of tag keys and values to assign to the dataset.
Implementation
Future<CreateDatasetResponse> createDataset({
required String datasetName,
required DatasetSchemaType schemaType,
required DataSourceType source,
String? clientToken,
String? description,
String? kmsKeyArn,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'datasetName': datasetName,
'schemaType': schemaType.value,
'source': source,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (kmsKeyArn != null) 'kmsKeyArn': kmsKeyArn,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/datasets',
exceptionFnMap: _exceptionFns,
);
return CreateDatasetResponse.fromJson(response);
}