createKxDataview method

Future<CreateKxDataviewResponse> createKxDataview({
  1. required KxAzMode azMode,
  2. required String databaseName,
  3. required String dataviewName,
  4. required String environmentId,
  5. bool? autoUpdate,
  6. String? availabilityZoneId,
  7. String? changesetId,
  8. String? clientToken,
  9. String? description,
  10. bool? readWrite,
  11. List<KxDataviewSegmentConfiguration>? segmentConfigurations,
  12. Map<String, String>? tags,
})

Creates a snapshot of kdb database with tiered storage capabilities and a pre-warmed cache, ready for mounting on kdb clusters. Dataviews are only available for clusters running on a scaling group. They are not supported on dedicated clusters.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter azMode : The number of availability zones you want to assign per volume. Currently, FinSpace only supports SINGLE for volumes. This places dataview in a single AZ.

Parameter databaseName : The name of the database where you want to create a dataview.

Parameter dataviewName : A unique identifier for the dataview.

Parameter environmentId : A unique identifier for the kdb environment, where you want to create the dataview.

Parameter autoUpdate : The option to specify whether you want to apply all the future additions and corrections automatically to the dataview, when you ingest new changesets. The default value is false.

Parameter availabilityZoneId : The identifier of the availability zones.

Parameter changesetId : A unique identifier of the changeset that you want to use to ingest data.

Parameter clientToken : A token that ensures idempotency. This token expires in 10 minutes.

Parameter description : A description of the dataview.

Parameter readWrite : The option to specify whether you want to make the dataview writable to perform database maintenance. The following are some considerations related to writable dataviews.

  • You cannot create partial writable dataviews. When you create writeable dataviews you must provide the entire database path.
  • You cannot perform updates on a writeable dataview. Hence, autoUpdate must be set as False if readWrite is True for a dataview.
  • You must also use a unique volume for creating a writeable dataview. So, if you choose a volume that is already in use by another dataview, the dataview creation fails.
  • Once you create a dataview as writeable, you cannot change it to read-only. So, you cannot update the readWrite parameter later.

Parameter segmentConfigurations : The configuration that contains the database path of the data that you want to place on each selected volume. Each segment must have a unique database path for each volume. If you do not explicitly specify any database path for a volume, they are accessible from the cluster through the default S3/object store segment.

Parameter tags : A list of key-value pairs to label the dataview. You can add up to 50 tags to a dataview.

Implementation

Future<CreateKxDataviewResponse> createKxDataview({
  required KxAzMode azMode,
  required String databaseName,
  required String dataviewName,
  required String environmentId,
  bool? autoUpdate,
  String? availabilityZoneId,
  String? changesetId,
  String? clientToken,
  String? description,
  bool? readWrite,
  List<KxDataviewSegmentConfiguration>? segmentConfigurations,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'azMode': azMode.value,
    'dataviewName': dataviewName,
    if (autoUpdate != null) 'autoUpdate': autoUpdate,
    if (availabilityZoneId != null) 'availabilityZoneId': availabilityZoneId,
    if (changesetId != null) 'changesetId': changesetId,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (readWrite != null) 'readWrite': readWrite,
    if (segmentConfigurations != null)
      'segmentConfigurations': segmentConfigurations,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/kx/environments/${Uri.encodeComponent(environmentId)}/databases/${Uri.encodeComponent(databaseName)}/dataviews',
    exceptionFnMap: _exceptionFns,
  );
  return CreateKxDataviewResponse.fromJson(response);
}