createDatastore method

Future<CreateDatastoreResponse> createDatastore({
  1. required String datastoreName,
  2. DatastoreStorage? datastoreStorage,
  3. FileFormatConfiguration? fileFormatConfiguration,
  4. RetentionPeriod? retentionPeriod,
  5. List<Tag>? tags,
})

Creates a data store, which is a repository for messages.

May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw InternalFailureException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw LimitExceededException.

Parameter datastoreName : The name of the data store.

Parameter datastoreStorage : Where data store data is stored. You can choose one of serviceManagedS3 or customerManagedS3 storage. If not specified, the default is serviceManagedS3. You cannot change this storage option after the data store is created.

Parameter fileFormatConfiguration : Contains the configuration information of file formats. AWS IoT Analytics data stores support JSON and Parquet.

The default file format is JSON. You can specify only one format.

You can't change the file format after you create the data store.

Parameter retentionPeriod : How long, in days, message data is kept for the data store. When customerManagedS3 storage is selected, this parameter is ignored.

Parameter tags : Metadata which can be used to manage the data store.

Implementation

Future<CreateDatastoreResponse> createDatastore({
  required String datastoreName,
  DatastoreStorage? datastoreStorage,
  FileFormatConfiguration? fileFormatConfiguration,
  RetentionPeriod? retentionPeriod,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(datastoreName, 'datastoreName');
  _s.validateStringLength(
    'datastoreName',
    datastoreName,
    1,
    128,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'datastoreName': datastoreName,
    if (datastoreStorage != null) 'datastoreStorage': datastoreStorage,
    if (fileFormatConfiguration != null)
      'fileFormatConfiguration': fileFormatConfiguration,
    if (retentionPeriod != null) 'retentionPeriod': retentionPeriod,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/datastores',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDatastoreResponse.fromJson(response);
}