createDataset method
Creates a dataset. Session and curated datasets are created in a workspace. A session dataset contains data segments of time series data, and a curated dataset curates data segments selected from source session datasets. A dataset that connects to an external datasource is created outside of a workspace.
May throw ConflictingOperationException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter datasetName :
The name of the dataset.
Parameter datasetSource :
The data source for the dataset.
Parameter clientToken :
A unique case-sensitive identifier that you can provide to ensure the
idempotency of the request. Don't reuse this client token if a new
idempotent request is required.
Parameter datasetConfig :
The configuration for the dataset.
Parameter datasetDescription :
A description about the dataset, and its functionality.
Parameter datasetId :
The ID of the dataset.
Parameter datasetType :
The type of dataset: a session dataset, a curated dataset, or a connection
to an external datasource.
Parameter metadata :
The metadata for the dataset, provided as key-value pairs.
Parameter tags :
A list of key-value pairs that contain metadata for the access policy. For
more information, see Tagging
your IoT SiteWise resources in the IoT SiteWise User Guide.
Parameter workspaceName :
The name of the workspace that contains the dataset. Required for session
and curated datasets. Omit this field for datasets that connect to an
external datasource.
Implementation
Future<CreateDatasetResponse> createDataset({
required String datasetName,
required DatasetSource datasetSource,
String? clientToken,
DatasetConfig? datasetConfig,
String? datasetDescription,
String? datasetId,
DatasetTypeEnum? datasetType,
Map<String, String>? metadata,
Map<String, String>? tags,
String? workspaceName,
}) async {
final $payload = <String, dynamic>{
'datasetName': datasetName,
'datasetSource': datasetSource,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (datasetConfig != null) 'datasetConfig': datasetConfig,
if (datasetDescription != null) 'datasetDescription': datasetDescription,
if (datasetId != null) 'datasetId': datasetId,
if (datasetType != null) 'datasetType': datasetType.value,
if (metadata != null) 'metadata': metadata,
if (tags != null) 'tags': tags,
if (workspaceName != null) 'workspaceName': workspaceName,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/datasets',
hostPrefix: 'api.',
exceptionFnMap: _exceptionFns,
);
return CreateDatasetResponse.fromJson(response);
}