MCPcopy Create free account
hub / github.com/firebase/firebase-tools / createInstance

Function createInstance

src/management/database.ts:107–133  ·  view source on GitHub ↗
(
  projectId: string,
  instanceName: string,
  location: DatabaseLocation,
  databaseType: DatabaseInstanceType,
)

Source from the content-addressed store, hash-verified

105 * @param databaseType type of the database being created.
106 */
107export async function createInstance(
108 projectId: string,
109 instanceName: string,
110 location: DatabaseLocation,
111 databaseType: DatabaseInstanceType,
112): Promise<DatabaseInstance> {
113 try {
114 const response = await apiClient.request({
115 method: "POST",
116 path: `/projects/${projectId}/locations/${location}/instances`,
117 queryParams: { databaseId: instanceName },
118 body: { type: databaseType },
119 timeout: TIMEOUT_MILLIS,
120 });
121
122 return convertDatabaseInstance(response.body);
123 } catch (err: any) {
124 logger.debug(err.message);
125 return utils.reject(
126 `Failed to create instance: ${instanceName}. See firebase-debug.log for more details.`,
127 {
128 code: 2,
129 original: err,
130 },
131 );
132 }
133}
134
135/**
136 * Checks if an instance with the specified name can be created.

Callers 3

database.spec.tsFile · 0.90

Calls 2

convertDatabaseInstanceFunction · 0.85
requestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…