mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Migrate notebooks workspaces to generated clients (#876)
This commit is contained in:
@@ -37,11 +37,10 @@ export async function createOrUpdate(
|
||||
subscriptionId: string,
|
||||
resourceGroupName: string,
|
||||
accountName: string,
|
||||
notebookWorkspaceName: string,
|
||||
body: Types.NotebookWorkspaceCreateUpdateParameters
|
||||
notebookWorkspaceName: string
|
||||
): Promise<Types.NotebookWorkspace> {
|
||||
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/notebookWorkspaces/${notebookWorkspaceName}`;
|
||||
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
|
||||
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body: {} });
|
||||
}
|
||||
|
||||
/* Deletes the notebook workspace for a Cosmos DB account. */
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/notebook.json
|
||||
*/
|
||||
|
||||
import { ARMResourceProperties } from "../cosmos/types";
|
||||
|
||||
/* Parameters to create a notebook workspace resource */
|
||||
export type NotebookWorkspaceCreateUpdateParameters = unknown;
|
||||
|
||||
@@ -16,7 +18,7 @@ export interface NotebookWorkspaceListResult {
|
||||
}
|
||||
|
||||
/* A notebook workspace resource */
|
||||
export type NotebookWorkspace = unknown & {
|
||||
export type NotebookWorkspace = ARMResourceProperties & {
|
||||
/* Resource properties. */
|
||||
properties?: NotebookWorkspaceProperties;
|
||||
};
|
||||
|
||||
@@ -144,13 +144,13 @@ async function getOperationStatus(operationStatusUrl: string) {
|
||||
|
||||
const body = await response.json();
|
||||
const status = body.status;
|
||||
if (!status && response.status === 200) {
|
||||
return body;
|
||||
}
|
||||
if (status === "Canceled" || status === "Failed") {
|
||||
const errorMessage = body.error ? JSON.stringify(body.error) : "Operation could not be completed";
|
||||
const error = new Error(errorMessage);
|
||||
throw new AbortError(error);
|
||||
}
|
||||
if (response.status === 200) {
|
||||
return body;
|
||||
}
|
||||
throw new Error(`Operation Response: ${JSON.stringify(body)}. Retrying.`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user