/* 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 }); }