createDataset method

Future<CreateDatasetResponse> createDataset({
  1. required String datasetName,
  2. required DatasetSource datasetSource,
  3. String? clientToken,
  4. String? datasetDescription,
  5. String? datasetId,
  6. Map<String, String>? tags,
})

Creates a dataset to connect an external datasource.

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 datasetDescription : A description about the dataset, and its functionality.

Parameter datasetId : The ID of the dataset.

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.

Implementation

Future<CreateDatasetResponse> createDataset({
  required String datasetName,
  required DatasetSource datasetSource,
  String? clientToken,
  String? datasetDescription,
  String? datasetId,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'datasetName': datasetName,
    'datasetSource': datasetSource,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (datasetDescription != null) 'datasetDescription': datasetDescription,
    if (datasetId != null) 'datasetId': datasetId,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/datasets',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDatasetResponse.fromJson(response);
}