instances
Creates, updates, deletes, gets or lists an instances
resource.
Overview
Name | instances |
Type | Resource |
Id | firebase.database.instances |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The fully qualified resource name of the database instance, in the form: projects/{project-number}/locations/{location-id}/instances/{database-id} . |
databaseUrl | string | Output only. Output Only. The globally unique hostname of the database. |
project | string | Output only. The resource name of the project this instance belongs to. For example: projects/{project-number} . |
state | string | Output only. The database's lifecycle state. Read-only. |
type | string | Immutable. The database instance type. On creation only USER_DATABASE is allowed, which is also the default when omitted. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The fully qualified resource name of the database instance, in the form: projects/{project-number}/locations/{location-id}/instances/{database-id} . |
databaseUrl | string | Output only. Output Only. The globally unique hostname of the database. |
project | string | Output only. The resource name of the project this instance belongs to. For example: projects/{project-number} . |
state | string | Output only. The database's lifecycle state. Read-only. |
type | string | Immutable. The database instance type. On creation only USER_DATABASE is allowed, which is also the default when omitted. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , instancesId | Gets the DatabaseInstance identified by the specified resource name. | |
list | select | projectsId , locationsId | pageToken , pageSize , showDeleted | Lists each DatabaseInstance associated with the specified parent project. The list items are returned in no particular order, but will be a consistent view of the database instances when additional requests are made with a pageToken . The resulting list contains instances in any STATE. The list results may be stale by a few seconds. Use GetDatabaseInstance for consistent reads. |
create | insert | projectsId , locationsId | databaseId , validateOnly | 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. |
delete | delete | projectsId , locationsId , instancesId | Marks a DatabaseInstance to be deleted. The DatabaseInstance will be set to the DELETED state for 20 days, and will be purged within 30 days. The default database cannot be deleted. IDs for deleted database instances may never be recovered or re-used. The Database may only be deleted if it is already in a DISABLED state. | |
undelete | exec | projectsId , locationsId , instancesId | Restores a DatabaseInstance that was previously marked to be deleted. After the delete method is used, DatabaseInstances are set to the DELETED state for 20 days, and will be purged within 30 days. Databases in the DELETED state can be undeleted without losing any data. This method may only be used on a DatabaseInstance in the DELETED state. Purged DatabaseInstances may not be recovered. | |
disable | exec | projectsId , locationsId , instancesId | Disables a DatabaseInstance. The database can be re-enabled later using ReenableDatabaseInstance. When a database is disabled, all reads and writes are denied, including view access in the Firebase console. | |
reenable | exec | projectsId , locationsId , instancesId | Enables a DatabaseInstance. The database must have been disabled previously using DisableDatabaseInstance. The state of a successfully reenabled DatabaseInstance is ACTIVE. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
instancesId | string | |
locationsId | string | |
projectsId | string | |
databaseId | string | |
pageSize | integer (int32) | |
pageToken | string | |
showDeleted | boolean | |
validateOnly | boolean |
SELECT
examples
- get
- list
Gets the DatabaseInstance identified by the specified resource name.
SELECT
name,
databaseUrl,
project,
state,
type
FROM firebase.database.instances
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND instancesId = '{{ instancesId }}' -- required;
Lists each DatabaseInstance associated with the specified parent project. The list items are returned in no particular order, but will be a consistent view of the database instances when additional requests are made with a pageToken
. The resulting list contains instances in any STATE. The list results may be stale by a few seconds. Use GetDatabaseInstance for consistent reads.
SELECT
name,
databaseUrl,
project,
state,
type
FROM firebase.database.instances
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND pageToken = '{{ pageToken }}'
AND pageSize = '{{ pageSize }}'
AND showDeleted = '{{ showDeleted }}';
INSERT
examples
- create
- Manifest
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.
INSERT INTO firebase.database.instances (
data__name,
data__type,
projectsId,
locationsId,
databaseId,
validateOnly
)
SELECT
'{{ name }}',
'{{ type }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ databaseId }}',
'{{ validateOnly }}'
RETURNING
name,
databaseUrl,
project,
state,
type
;
# Description fields are for documentation purposes
- name: instances
props:
- name: projectsId
value: string
description: Required parameter for the instances resource.
- name: locationsId
value: string
description: Required parameter for the instances resource.
- name: name
value: string
description: >
The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`.
- name: type
value: string
description: >
Immutable. The database instance type. On creation only USER_DATABASE is allowed, which is also the default when omitted.
valid_values: ['DATABASE_INSTANCE_TYPE_UNSPECIFIED', 'DEFAULT_DATABASE', 'USER_DATABASE']
- name: databaseId
value: string
- name: validateOnly
value: boolean
DELETE
examples
- delete
Marks a DatabaseInstance to be deleted. The DatabaseInstance will be set to the DELETED state for 20 days, and will be purged within 30 days. The default database cannot be deleted. IDs for deleted database instances may never be recovered or re-used. The Database may only be deleted if it is already in a DISABLED state.
DELETE FROM firebase.database.instances
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND instancesId = '{{ instancesId }}' --required;
Lifecycle Methods
- undelete
- disable
- reenable
Restores a DatabaseInstance that was previously marked to be deleted. After the delete method is used, DatabaseInstances are set to the DELETED state for 20 days, and will be purged within 30 days. Databases in the DELETED state can be undeleted without losing any data. This method may only be used on a DatabaseInstance in the DELETED state. Purged DatabaseInstances may not be recovered.
EXEC firebase.database.instances.undelete
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@instancesId='{{ instancesId }}' --required;
Disables a DatabaseInstance. The database can be re-enabled later using ReenableDatabaseInstance. When a database is disabled, all reads and writes are denied, including view access in the Firebase console.
EXEC firebase.database.instances.disable
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@instancesId='{{ instancesId }}' --required;
Enables a DatabaseInstance. The database must have been disabled previously using DisableDatabaseInstance. The state of a successfully reenabled DatabaseInstance is ACTIVE.
EXEC firebase.database.instances.reenable
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@instancesId='{{ instancesId }}' --required;