Files
cosmos-explorer/src/Utils/arm/CassandraResources.ts
Steve Faulkner f4f2d00d7f More tweaks
2020-07-23 18:12:58 -05:00

116 lines
5.3 KiB
TypeScript

/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
export class CassandraResourcesClient {
private readonly baseUrl = "https://management.azure.com";
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/cassandraKeyspaces`;
constructor(
private readonly subscriptionId: string,
private readonly resourceGroupName: string,
private readonly accountName: string
) {}
/* Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. */
async listCassandraKeyspaces(): Promise<Types.CassandraKeyspaceListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. */
async getCassandraKeyspace(keyspaceName: string): Promise<Types.CassandraKeyspaceGetResults> {
const path = `/${keyspaceName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB Cassandra keyspace */
async createUpdateCassandraKeyspace(
keyspaceName: string,
body: Types.CassandraKeyspaceCreateUpdateParameters
): Promise<Types.CassandraKeyspaceGetResults | void> {
const path = `/${keyspaceName}`;
return window
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB Cassandra keyspace. */
async deleteCassandraKeyspace(keyspaceName: string): Promise<void | void> {
const path = `/${keyspaceName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Lists the Cassandra table under an existing Azure Cosmos DB database account. */
async listCassandraTables(keyspaceName: string): Promise<Types.CassandraTableListResult> {
const path = `/${keyspaceName}/tables`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Gets the Cassandra table under an existing Azure Cosmos DB database account. */
async getCassandraTable(keyspaceName: string, tableName: string): Promise<Types.CassandraTableGetResults> {
const path = `/${keyspaceName}/tables/${tableName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB Cassandra Table */
async createUpdateCassandraTable(
keyspaceName: string,
tableName: string,
body: Types.CassandraTableCreateUpdateParameters
): Promise<Types.CassandraTableGetResults | void> {
const path = `/${keyspaceName}/tables/${tableName}`;
return window
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB Cassandra table. */
async deleteCassandraTable(keyspaceName: string, tableName: string): Promise<void | void> {
const path = `/${keyspaceName}/tables/${tableName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. */
async getCassandraTableThroughput(
keyspaceName: string,
tableName: string
): Promise<Types.ThroughputSettingsGetResults> {
const path = `/${keyspaceName}/tables/${tableName}/throughputSettings/default`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Update RUs per second of an Azure Cosmos DB Cassandra table */
async updateCassandraTableThroughput(
keyspaceName: string,
tableName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/${keyspaceName}/tables/${tableName}/throughputSettings/default`;
return window
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
}
/* Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. */
async getCassandraKeyspaceThroughput(keyspaceName: string): Promise<Types.ThroughputSettingsGetResults> {
const path = `/${keyspaceName}/throughputSettings/default`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Update RUs per second of an Azure Cosmos DB Cassandra Keyspace */
async updateCassandraKeyspaceThroughput(
keyspaceName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/${keyspaceName}/throughputSettings/default`;
return window
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
}
}