mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 01:41:31 +00:00
* Added throughput bucketing * fix bugs * enable/disable per autoscale selection * Added logic * change query bucket to group * Updated to a tab * Fixed unit tests * Edit package-lock * Compile build fix * fix unit tests * moving the throughput bucket flag to the client generation level
102 lines
4.9 KiB
TypeScript
102 lines
4.9 KiB
TypeScript
/*
|
|
AUTOGENERATED FILE
|
|
Run "npm run generateARMClients" to regenerate
|
|
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
|
|
|
|
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/cosmos-db.json
|
|
*/
|
|
|
|
import { configContext } from "../../../../ConfigContext";
|
|
import { armRequest } from "../../request";
|
|
import * as Types from "./types";
|
|
const apiVersion = "2024-12-01-preview";
|
|
|
|
/* Lists the Tables under an existing Azure Cosmos DB database account. */
|
|
export async function listTables(
|
|
subscriptionId: string,
|
|
resourceGroupName: string,
|
|
accountName: string,
|
|
): Promise<Types.TableListResult> {
|
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables`;
|
|
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
|
|
}
|
|
|
|
/* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */
|
|
export async function getTable(
|
|
subscriptionId: string,
|
|
resourceGroupName: string,
|
|
accountName: string,
|
|
tableName: string,
|
|
): Promise<Types.TableGetResults> {
|
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
|
|
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
|
|
}
|
|
|
|
/* Create or update an Azure Cosmos DB Table */
|
|
export async function createUpdateTable(
|
|
subscriptionId: string,
|
|
resourceGroupName: string,
|
|
accountName: string,
|
|
tableName: string,
|
|
body: Types.TableCreateUpdateParameters,
|
|
): Promise<Types.TableGetResults | void> {
|
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
|
|
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
|
|
}
|
|
|
|
/* Deletes an existing Azure Cosmos DB Table. */
|
|
export async function deleteTable(
|
|
subscriptionId: string,
|
|
resourceGroupName: string,
|
|
accountName: string,
|
|
tableName: string,
|
|
): Promise<void> {
|
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
|
|
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion });
|
|
}
|
|
|
|
/* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */
|
|
export async function getTableThroughput(
|
|
subscriptionId: string,
|
|
resourceGroupName: string,
|
|
accountName: string,
|
|
tableName: string,
|
|
): Promise<Types.ThroughputSettingsGetResults> {
|
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`;
|
|
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
|
|
}
|
|
|
|
/* Update RUs per second of an Azure Cosmos DB Table */
|
|
export async function updateTableThroughput(
|
|
subscriptionId: string,
|
|
resourceGroupName: string,
|
|
accountName: string,
|
|
tableName: string,
|
|
body: Types.ThroughputSettingsUpdateParameters,
|
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`;
|
|
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
|
|
}
|
|
|
|
/* Migrate an Azure Cosmos DB Table from manual throughput to autoscale */
|
|
export async function migrateTableToAutoscale(
|
|
subscriptionId: string,
|
|
resourceGroupName: string,
|
|
accountName: string,
|
|
tableName: string,
|
|
): Promise<Types.ThroughputSettingsGetResults | void | Types.CloudError> {
|
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default/migrateToAutoscale`;
|
|
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
|
|
}
|
|
|
|
/* Migrate an Azure Cosmos DB Table from autoscale to manual throughput */
|
|
export async function migrateTableToManualThroughput(
|
|
subscriptionId: string,
|
|
resourceGroupName: string,
|
|
accountName: string,
|
|
tableName: string,
|
|
): Promise<Types.ThroughputSettingsGetResults | void | Types.CloudError> {
|
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default/migrateToManualThroughput`;
|
|
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
|
|
}
|