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 - 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.toJson());
  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>);
}