Migrate notebooks workspaces to generated clients (#876)

This commit is contained in:
Steve Faulkner
2021-06-09 13:08:10 -07:00
committed by GitHub
parent 8f6cac3d35
commit fc9f4c5583
13 changed files with 49 additions and 583 deletions

View File

@@ -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. */

View File

@@ -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;
};

View File

@@ -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.`);
}