Files
cosmos-explorer/src/Utils/arm/generatedClients/cosmos/tableResources.ts
FAIZ CHACHIYA 7b568df150 Walmart enable priority based execution feature (#1625)
* changed the variable enablePriorityBasedThrottling to enablePriorityBasedExecution

* Update the arm client version to '2023-09-15-preview' to fetch the status for the 'enablePriorityBasedExecution' property and performed the respective changes for priority based execution to grab the changes from the DatabaseAccount data model

* formatting changes to all the committed files

* review comments - removed the variable and added the check in the if loop itself

* check style changes

---------

Co-authored-by: Faiz Chachiya <faizchachiya@microsoft.com>
2023-09-25 22:41:46 +05:30

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/2023-09-15-preview/cosmos-db.json
*/
import { armRequest } from "../../request";
import * as Types from "./types";
import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-09-15-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 });
}