createDataset method

Future<CreateDatasetResponse> createDataset({
  1. required String datasetName,
  2. required String flywheelArn,
  3. required DatasetInputDataConfig inputDataConfig,
  4. String? clientRequestToken,
  5. DatasetType? datasetType,
  6. String? description,
  7. List<Tag>? tags,
})

Creates a dataset to upload training or test data for a model associated with a flywheel. For more information about datasets, see Flywheel overview in the Amazon Comprehend Developer Guide.

May throw InternalServerException. May throw InvalidRequestException. May throw ResourceInUseException. May throw ResourceLimitExceededException. May throw ResourceNotFoundException. May throw TooManyRequestsException. May throw TooManyTagsException.

Parameter datasetName : Name of the dataset.

Parameter flywheelArn : The Amazon Resource Number (ARN) of the flywheel of the flywheel to receive the data.

Parameter inputDataConfig : Information about the input data configuration. The type of input data varies based on the format of the input and whether the data is for a classifier model or an entity recognition model.

Parameter clientRequestToken : A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.

Parameter datasetType : The dataset type. You can specify that the data in a dataset is for training the model or for testing the model.

Parameter description : Description of the dataset.

Parameter tags : Tags for the dataset.

Implementation

Future<CreateDatasetResponse> createDataset({
  required String datasetName,
  required String flywheelArn,
  required DatasetInputDataConfig inputDataConfig,
  String? clientRequestToken,
  DatasetType? datasetType,
  String? description,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Comprehend_20171127.CreateDataset'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DatasetName': datasetName,
      'FlywheelArn': flywheelArn,
      'InputDataConfig': inputDataConfig,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (datasetType != null) 'DatasetType': datasetType.value,
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateDatasetResponse.fromJson(jsonResponse.body);
}