deleteNamespace method

Future<DeleteNamespaceResponse> deleteNamespace({
  1. required String namespaceName,
  2. String? finalSnapshotName,
  3. int? finalSnapshotRetentionPeriod,
})

Deletes a namespace from Amazon Redshift Serverless. Before you delete the namespace, you can create a final snapshot that has all of the data within the namespace.

May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter namespaceName : The name of the namespace to delete.

Parameter finalSnapshotName : The name of the snapshot to be created before the namespace is deleted.

Parameter finalSnapshotRetentionPeriod : How long to retain the final snapshot.

Implementation

Future<DeleteNamespaceResponse> deleteNamespace({
  required String namespaceName,
  String? finalSnapshotName,
  int? finalSnapshotRetentionPeriod,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RedshiftServerless.DeleteNamespace'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'namespaceName': namespaceName,
      if (finalSnapshotName != null) 'finalSnapshotName': finalSnapshotName,
      if (finalSnapshotRetentionPeriod != null)
        'finalSnapshotRetentionPeriod': finalSnapshotRetentionPeriod,
    },
  );

  return DeleteNamespaceResponse.fromJson(jsonResponse.body);
}