create method

Future<DatabaseInstance> create(
  1. DatabaseInstance request,
  2. String parent, {
  3. String? databaseId,
  4. bool? validateOnly,
  5. String? $fields,
})

Requests that a new DatabaseInstance be created.

The state of a successfully created DatabaseInstance is ACTIVE. Only available for projects on the Blaze plan. Projects can be upgraded using the Cloud Billing API https://cloud.google.com/billing/reference/rest/v1/projects/updateBillingInfo. Note that it might take a few minutes for billing enablement state to propagate to Firebase systems.

request - The metadata request object.

Request parameters:

parent - Required. The parent project for which to create a database instance, in the form: projects/{project-number}/locations/{location-id}. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$.

databaseId - The globally unique identifier of the database instance.

validateOnly - When set to true, the request will be validated but not submitted.

$fields - Selector specifying which fields to include in a partial response.

Completes with a DatabaseInstance.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<DatabaseInstance> create(
  DatabaseInstance request,
  core.String parent, {
  core.String? databaseId,
  core.bool? validateOnly,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (databaseId != null) 'databaseId': [databaseId],
    if (validateOnly != null) 'validateOnly': ['${validateOnly}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1beta/' + core.Uri.encodeFull('$parent') + '/instances';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return DatabaseInstance.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}