mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-22 02:11:29 +00:00
More tweaks
This commit is contained in:
@@ -4,164 +4,112 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
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. */
|
/* Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. */
|
||||||
export async function listCassandraKeyspaces (
|
async listCassandraKeyspaces(): Promise<Types.CassandraKeyspaceListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.CassandraKeyspaceListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. */
|
/* Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getCassandraKeyspace (
|
async getCassandraKeyspace(keyspaceName: string): Promise<Types.CassandraKeyspaceGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${keyspaceName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
keyspaceName: string
|
|
||||||
|
|
||||||
) : Promise<Types.CassandraKeyspaceGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB Cassandra keyspace */
|
/* Create or update an Azure Cosmos DB Cassandra keyspace */
|
||||||
export async function createUpdateCassandraKeyspace (
|
async createUpdateCassandraKeyspace(
|
||||||
subscriptionId: string,
|
keyspaceName: string,
|
||||||
resourceGroupName: string,
|
body: Types.CassandraKeyspaceCreateUpdateParameters
|
||||||
accountName: string,
|
): Promise<Types.CassandraKeyspaceGetResults | void> {
|
||||||
keyspaceName: string
|
const path = `/${keyspaceName}`;
|
||||||
,body: Types.CassandraKeyspaceCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.CassandraKeyspaceGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB Cassandra keyspace. */
|
/* Deletes an existing Azure Cosmos DB Cassandra keyspace. */
|
||||||
export async function deleteCassandraKeyspace (
|
async deleteCassandraKeyspace(keyspaceName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${keyspaceName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
keyspaceName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "delete", }).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. */
|
|
||||||
export async function getCassandraKeyspaceThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
keyspaceName: string
|
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update RUs per second of an Azure Cosmos DB Cassandra Keyspace */
|
|
||||||
export async function updateCassandraKeyspaceThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
keyspaceName: string
|
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the Cassandra table under an existing Azure Cosmos DB database account. */
|
/* Lists the Cassandra table under an existing Azure Cosmos DB database account. */
|
||||||
export async function listCassandraTables (
|
async listCassandraTables(keyspaceName: string): Promise<Types.CassandraTableListResult> {
|
||||||
subscriptionId: string,
|
const path = `/${keyspaceName}/tables`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
keyspaceName: string
|
|
||||||
|
|
||||||
) : Promise<Types.CassandraTableListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the Cassandra table under an existing Azure Cosmos DB database account. */
|
/* Gets the Cassandra table under an existing Azure Cosmos DB database account. */
|
||||||
export async function getCassandraTable (
|
async getCassandraTable(keyspaceName: string, tableName: string): Promise<Types.CassandraTableGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${keyspaceName}/tables/${tableName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
keyspaceName: string,
|
|
||||||
tableName: string
|
|
||||||
|
|
||||||
) : Promise<Types.CassandraTableGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB Cassandra Table */
|
/* Create or update an Azure Cosmos DB Cassandra Table */
|
||||||
export async function createUpdateCassandraTable (
|
async createUpdateCassandraTable(
|
||||||
subscriptionId: string,
|
keyspaceName: string,
|
||||||
resourceGroupName: string,
|
tableName: string,
|
||||||
accountName: string,
|
body: Types.CassandraTableCreateUpdateParameters
|
||||||
keyspaceName: string,
|
): Promise<Types.CassandraTableGetResults | void> {
|
||||||
tableName: string
|
const path = `/${keyspaceName}/tables/${tableName}`;
|
||||||
,body: Types.CassandraTableCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.CassandraTableGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB Cassandra table. */
|
/* Deletes an existing Azure Cosmos DB Cassandra table. */
|
||||||
export async function deleteCassandraTable (
|
async deleteCassandraTable(keyspaceName: string, tableName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${keyspaceName}/tables/${tableName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
keyspaceName: string,
|
|
||||||
tableName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { 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. */
|
/* Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getCassandraTableThroughput (
|
async getCassandraTableThroughput(
|
||||||
subscriptionId: string,
|
keyspaceName: string,
|
||||||
resourceGroupName: string,
|
tableName: string
|
||||||
accountName: string,
|
): Promise<Types.ThroughputSettingsGetResults> {
|
||||||
keyspaceName: string,
|
const path = `/${keyspaceName}/tables/${tableName}/throughputSettings/default`;
|
||||||
tableName: string
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update RUs per second of an Azure Cosmos DB Cassandra table */
|
/* Update RUs per second of an Azure Cosmos DB Cassandra table */
|
||||||
export async function updateCassandraTableThroughput (
|
async updateCassandraTableThroughput(
|
||||||
subscriptionId: string,
|
keyspaceName: string,
|
||||||
resourceGroupName: string,
|
tableName: string,
|
||||||
accountName: string,
|
body: Types.ThroughputSettingsUpdateParameters
|
||||||
keyspaceName: string,
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
tableName: string
|
const path = `/${keyspaceName}/tables/${tableName}/throughputSettings/default`;
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
return window
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,46 +4,35 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given database account and collection. */
|
|
||||||
export async function listMetrics (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string
|
|
||||||
|
|
||||||
) : Promise<Types.MetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Retrieves the usages (most recent storage data) for the given collection. */
|
|
||||||
export async function listUsages (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string
|
|
||||||
|
|
||||||
) : Promise<Types.UsagesResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/usages`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
export class CollectionClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/databases/${this.databaseRid}/collections/${this.collectionRid}/`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string,
|
||||||
|
private readonly databaseRid: string,
|
||||||
|
private readonly collectionRid: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves metric definitions for the given collection. */
|
/* Retrieves metric definitions for the given collection. */
|
||||||
export async function listMetricDefinitions (
|
async listMetricDefinitions(): Promise<Types.MetricDefinitionsListResult> {
|
||||||
subscriptionId: string,
|
const path = `metricDefinitions`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string
|
|
||||||
|
|
||||||
) : Promise<Types.MetricDefinitionsListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metricDefinitions`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Retrieves the metrics determined by the given filter for the given database account and collection. */
|
||||||
|
async listMetrics(): Promise<Types.MetricListResult> {
|
||||||
|
const path = `metrics`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieves the usages (most recent storage data) for the given collection. */
|
||||||
|
async listUsages(): Promise<Types.UsagesResult> {
|
||||||
|
const path = `usages`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,32 +4,29 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class CollectionPartitionClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/databases/${this.databaseRid}/collections/${this.collectionRid}/partitions/`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string,
|
||||||
|
private readonly databaseRid: string,
|
||||||
|
private readonly collectionRid: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given collection, split by partition. */
|
/* Retrieves the metrics determined by the given filter for the given collection, split by partition. */
|
||||||
export async function listMetrics (
|
async listMetrics(): Promise<Types.PartitionMetricListResult> {
|
||||||
subscriptionId: string,
|
const path = `metrics`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string
|
|
||||||
|
|
||||||
) : Promise<Types.PartitionMetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Retrieves the usages (most recent storage data) for the given collection, split by partition. */
|
/* Retrieves the usages (most recent storage data) for the given collection, split by partition. */
|
||||||
export async function listUsages (
|
async listUsages(): Promise<Types.PartitionUsagesResult> {
|
||||||
subscriptionId: string,
|
const path = `usages`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string
|
|
||||||
|
|
||||||
) : Promise<Types.PartitionUsagesResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/usages`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,19 +4,24 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class CollectionPartitionRegionClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/region/${this.region}/databases/${this.databaseRid}/collections/${this.collectionRid}/partitions/metrics`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string,
|
||||||
|
private readonly region: string,
|
||||||
|
private readonly databaseRid: string,
|
||||||
|
private readonly collectionRid: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */
|
/* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */
|
||||||
export async function listMetrics (
|
async listMetrics(): Promise<Types.PartitionMetricListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
region: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string
|
|
||||||
|
|
||||||
) : Promise<Types.PartitionMetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,19 +4,24 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class CollectionRegionClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/region/${this.region}/databases/${this.databaseRid}/collections/${this.collectionRid}/metrics`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string,
|
||||||
|
private readonly region: string,
|
||||||
|
private readonly databaseRid: string,
|
||||||
|
private readonly collectionRid: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given database account, collection and region. */
|
/* Retrieves the metrics determined by the given filter for the given database account, collection and region. */
|
||||||
export async function listMetrics (
|
async listMetrics(): Promise<Types.MetricListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
region: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string
|
|
||||||
|
|
||||||
) : Promise<Types.MetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,47 +6,32 @@
|
|||||||
|
|
||||||
import * as Types from "./types";
|
import * as Types from "./types";
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given database account and database. */
|
export class DatabaseClient {
|
||||||
export async function listMetrics(
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
subscriptionId: string,
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/databases/${this.databaseRid}/`;
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseRid: string
|
|
||||||
): Promise<Types.MetricListResult> {
|
|
||||||
return window
|
|
||||||
.fetch(
|
|
||||||
`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metrics`,
|
|
||||||
{ method: "get" }
|
|
||||||
)
|
|
||||||
.then(response => response.json());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Retrieves the usages (most recent data) for the given database. */
|
constructor(
|
||||||
export async function listUsages(
|
private readonly subscriptionId: string,
|
||||||
subscriptionId: string,
|
private readonly resourceGroupName: string,
|
||||||
resourceGroupName: string,
|
private readonly accountName: string,
|
||||||
accountName: string,
|
private readonly databaseRid: string
|
||||||
databaseRid: string
|
) {}
|
||||||
): Promise<Types.UsagesResult> {
|
|
||||||
return window
|
|
||||||
.fetch(
|
|
||||||
`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/usages`,
|
|
||||||
{ method: "get" }
|
|
||||||
)
|
|
||||||
.then(response => response.json());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Retrieves metric definitions for the given database. */
|
/* Retrieves metric definitions for the given database. */
|
||||||
export async function listMetricDefinitions(
|
async listMetricDefinitions(): Promise<Types.MetricDefinitionsListResult> {
|
||||||
subscriptionId: string,
|
const path = `metricDefinitions`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
}
|
||||||
databaseRid: string
|
|
||||||
): Promise<Types.MetricDefinitionsListResult> {
|
/* Retrieves the metrics determined by the given filter for the given database account and database. */
|
||||||
return window
|
async listMetrics(): Promise<Types.MetricListResult> {
|
||||||
.fetch(
|
const path = `metrics`;
|
||||||
`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metricDefinitions`,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
{ method: "get" }
|
}
|
||||||
)
|
|
||||||
.then(response => response.json());
|
/* Retrieves the usages (most recent data) for the given database. */
|
||||||
|
async listUsages(): Promise<Types.UsagesResult> {
|
||||||
|
const path = `usages`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,17 +6,20 @@
|
|||||||
|
|
||||||
import * as Types from "./types";
|
import * as Types from "./types";
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given database account and region. */
|
export class DatabaseAccountRegionClient {
|
||||||
export async function listMetrics(
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
subscriptionId: string,
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/region/${this.region}/metrics`;
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
constructor(
|
||||||
region: string
|
private readonly subscriptionId: string,
|
||||||
): Promise<Types.MetricListResult> {
|
private readonly resourceGroupName: string,
|
||||||
return window
|
private readonly accountName: string,
|
||||||
.fetch(
|
private readonly region: string
|
||||||
`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/metrics`,
|
) {}
|
||||||
{ method: "get" }
|
|
||||||
)
|
/* Retrieves the metrics determined by the given filter for the given database account and region. */
|
||||||
.then(response => response.json());
|
async listMetrics(): Promise<Types.MetricListResult> {
|
||||||
|
const path = ``;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,215 +4,194 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
|
||||||
/* Retrieves the properties of an existing Azure Cosmos DB database account. */
|
|
||||||
export async function get (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.DatabaseAccountGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Updates the properties of an existing Azure Cosmos DB database account. */
|
|
||||||
export async function update (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
,body: Types.DatabaseAccountUpdateParameters
|
|
||||||
) : Promise<Types.DatabaseAccountGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "patch", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */
|
|
||||||
export async function createOrUpdate (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
,body: Types.DatabaseAccountCreateUpdateParameters
|
|
||||||
) : Promise<Types.DatabaseAccountGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB database account. */
|
|
||||||
export async function delete (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */
|
|
||||||
export async function failoverPriorityChange (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
,body: Types.FailoverPolicies
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/failoverPriorityChange`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists all the Azure Cosmos DB database accounts available under the subscription. */
|
|
||||||
export async function list (
|
|
||||||
subscriptionId: string
|
|
||||||
|
|
||||||
) : Promise<Types.DatabaseAccountsListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists all the Azure Cosmos DB database accounts available under the given resource group. */
|
|
||||||
export async function listByResourceGroup (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string
|
|
||||||
|
|
||||||
) : Promise<Types.DatabaseAccountsListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the access keys for the specified Azure Cosmos DB database account. */
|
|
||||||
export async function listKeys (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.DatabaseAccountListKeysResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listKeys`, { method: "post", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the connection strings for the specified Azure Cosmos DB database account. */
|
|
||||||
export async function listConnectionStrings (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.DatabaseAccountListConnectionStringsResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listConnectionStrings`, { method: "post", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Offline the specified region for the specified Azure Cosmos DB database account. */
|
|
||||||
export async function offlineRegion (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
,body: Types.RegionForOnlineOffline
|
|
||||||
) : Promise<void | void | Types.ErrorResponse> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/offlineRegion`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Online the specified region for the specified Azure Cosmos DB database account. */
|
|
||||||
export async function onlineRegion (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
,body: Types.RegionForOnlineOffline
|
|
||||||
) : Promise<void | void | Types.ErrorResponse> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/onlineRegion`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */
|
|
||||||
export async function getReadOnlyKeys (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */
|
|
||||||
export async function listReadOnlyKeys (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`, { method: "post", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Regenerates an access key for the specified Azure Cosmos DB database account. */
|
|
||||||
export async function regenerateKey (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string
|
|
||||||
,body: Types.DatabaseAccountRegenerateKeyParameters
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/regenerateKey`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
export class DatabaseAccountsClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/`;
|
||||||
|
|
||||||
/* Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. */
|
/* Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. */
|
||||||
export async function checkNameExists (
|
async checkNameExists(accountName: string): Promise<void | void> {
|
||||||
|
const path = `providers/Microsoft.DocumentDB/databaseAccountNames/${accountName}`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "head" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lists all the Azure Cosmos DB database accounts available under the subscription. */
|
||||||
|
async list(subscriptionId: string): Promise<Types.DatabaseAccountsListResult> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lists all the Azure Cosmos DB database accounts available under the given resource group. */
|
||||||
|
async listByResourceGroup(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string
|
||||||
|
): Promise<Types.DatabaseAccountsListResult> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieves the properties of an existing Azure Cosmos DB database account. */
|
||||||
|
async get(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
accountName: string
|
accountName: string
|
||||||
|
): Promise<Types.DatabaseAccountGetResults> {
|
||||||
) : Promise<void | void> {
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
|
||||||
return window.fetch(`https://management.azure.com/providers/Microsoft.DocumentDB/databaseAccountNames/${accountName}`, { method: "head", }).then((response) => response.json())
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Updates the properties of an existing Azure Cosmos DB database account. */
|
||||||
|
async update(
|
||||||
/* Retrieves the metrics determined by the given filter for the given database account. */
|
|
||||||
export async function listMetrics (
|
|
||||||
subscriptionId: string,
|
subscriptionId: string,
|
||||||
resourceGroupName: string,
|
resourceGroupName: string,
|
||||||
accountName: string
|
accountName: string,
|
||||||
|
body: Types.DatabaseAccountUpdateParameters
|
||||||
) : Promise<Types.MetricListResult> {
|
): Promise<Types.DatabaseAccountGetResults> {
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metrics`, { method: "get", }).then((response) => response.json())
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "patch", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */
|
||||||
|
async createOrUpdate(
|
||||||
/* Retrieves the usages (most recent data) for the given database account. */
|
|
||||||
export async function listUsages (
|
|
||||||
subscriptionId: string,
|
subscriptionId: string,
|
||||||
resourceGroupName: string,
|
resourceGroupName: string,
|
||||||
accountName: string
|
accountName: string,
|
||||||
|
body: Types.DatabaseAccountCreateUpdateParameters
|
||||||
) : Promise<Types.UsagesResult> {
|
): Promise<Types.DatabaseAccountGetResults> {
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/usages`, { method: "get", }).then((response) => response.json())
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB database account. */
|
||||||
|
async delete(subscriptionId: string, resourceGroupName: string, accountName: string): Promise<void | void> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */
|
||||||
|
async failoverPriorityChange(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
body: Types.FailoverPolicies
|
||||||
|
): Promise<void | void> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/failoverPriorityChange`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lists the connection strings for the specified Azure Cosmos DB database account. */
|
||||||
|
async listConnectionStrings(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
): Promise<Types.DatabaseAccountListConnectionStringsResult> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listConnectionStrings`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lists the access keys for the specified Azure Cosmos DB database account. */
|
||||||
|
async listKeys(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
): Promise<Types.DatabaseAccountListKeysResult> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listKeys`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
/* Retrieves metric definitions for the given database account. */
|
/* Retrieves metric definitions for the given database account. */
|
||||||
export async function listMetricDefinitions (
|
async listMetricDefinitions(
|
||||||
subscriptionId: string,
|
subscriptionId: string,
|
||||||
resourceGroupName: string,
|
resourceGroupName: string,
|
||||||
accountName: string
|
accountName: string
|
||||||
|
): Promise<Types.MetricDefinitionsListResult> {
|
||||||
) : Promise<Types.MetricDefinitionsListResult> {
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metricDefinitions`;
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metricDefinitions`, { method: "get", }).then((response) => response.json())
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Retrieves the metrics determined by the given filter for the given database account. */
|
||||||
|
async listMetrics(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
): Promise<Types.MetricListResult> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metrics`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Offline the specified region for the specified Azure Cosmos DB database account. */
|
||||||
|
async offlineRegion(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
body: Types.RegionForOnlineOffline
|
||||||
|
): Promise<void | void | Types.ErrorResponse> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/offlineRegion`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Online the specified region for the specified Azure Cosmos DB database account. */
|
||||||
|
async onlineRegion(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
body: Types.RegionForOnlineOffline
|
||||||
|
): Promise<void | void | Types.ErrorResponse> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/onlineRegion`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */
|
||||||
|
async getReadOnlyKeys(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
): Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */
|
||||||
|
async listReadOnlyKeys(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
): Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Regenerates an access key for the specified Azure Cosmos DB database account. */
|
||||||
|
async regenerateKey(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
body: Types.DatabaseAccountRegenerateKeyParameters
|
||||||
|
): Promise<void | void> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/regenerateKey`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieves the usages (most recent data) for the given database account. */
|
||||||
|
async listUsages(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
): Promise<Types.UsagesResult> {
|
||||||
|
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/usages`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,164 +4,112 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class GremlinResourcesClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/gremlinDatabases`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */
|
/* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */
|
||||||
export async function listGremlinDatabases (
|
async listGremlinDatabases(): Promise<Types.GremlinDatabaseListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.GremlinDatabaseListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. */
|
/* Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getGremlinDatabase (
|
async getGremlinDatabase(databaseName: string): Promise<Types.GremlinDatabaseGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.GremlinDatabaseGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB Gremlin database */
|
/* Create or update an Azure Cosmos DB Gremlin database */
|
||||||
export async function createUpdateGremlinDatabase (
|
async createUpdateGremlinDatabase(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
body: Types.GremlinDatabaseCreateUpdateParameters
|
||||||
accountName: string,
|
): Promise<Types.GremlinDatabaseGetResults | void> {
|
||||||
databaseName: string
|
const path = `/${databaseName}`;
|
||||||
,body: Types.GremlinDatabaseCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.GremlinDatabaseGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB Gremlin database. */
|
/* Deletes an existing Azure Cosmos DB Gremlin database. */
|
||||||
export async function deleteGremlinDatabase (
|
async deleteGremlinDatabase(databaseName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. */
|
|
||||||
export async function getGremlinDatabaseThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update RUs per second of an Azure Cosmos DB Gremlin database */
|
|
||||||
export async function updateGremlinDatabaseThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the Gremlin graph under an existing Azure Cosmos DB database account. */
|
/* Lists the Gremlin graph under an existing Azure Cosmos DB database account. */
|
||||||
export async function listGremlinGraphs (
|
async listGremlinGraphs(databaseName: string): Promise<Types.GremlinGraphListResult> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/graphs`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.GremlinGraphListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the Gremlin graph under an existing Azure Cosmos DB database account. */
|
/* Gets the Gremlin graph under an existing Azure Cosmos DB database account. */
|
||||||
export async function getGremlinGraph (
|
async getGremlinGraph(databaseName: string, graphName: string): Promise<Types.GremlinGraphGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/graphs/${graphName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
graphName: string
|
|
||||||
|
|
||||||
) : Promise<Types.GremlinGraphGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB Gremlin graph */
|
/* Create or update an Azure Cosmos DB Gremlin graph */
|
||||||
export async function createUpdateGremlinGraph (
|
async createUpdateGremlinGraph(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
graphName: string,
|
||||||
accountName: string,
|
body: Types.GremlinGraphCreateUpdateParameters
|
||||||
databaseName: string,
|
): Promise<Types.GremlinGraphGetResults | void> {
|
||||||
graphName: string
|
const path = `/${databaseName}/graphs/${graphName}`;
|
||||||
,body: Types.GremlinGraphCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.GremlinGraphGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB Gremlin graph. */
|
/* Deletes an existing Azure Cosmos DB Gremlin graph. */
|
||||||
export async function deleteGremlinGraph (
|
async deleteGremlinGraph(databaseName: string, graphName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/graphs/${graphName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
graphName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. */
|
/* Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getGremlinGraphThroughput (
|
async getGremlinGraphThroughput(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
graphName: string
|
||||||
accountName: string,
|
): Promise<Types.ThroughputSettingsGetResults> {
|
||||||
databaseName: string,
|
const path = `/${databaseName}/graphs/${graphName}/throughputSettings/default`;
|
||||||
graphName: string
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update RUs per second of an Azure Cosmos DB Gremlin graph */
|
/* Update RUs per second of an Azure Cosmos DB Gremlin graph */
|
||||||
export async function updateGremlinGraphThroughput (
|
async updateGremlinGraphThroughput(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
graphName: string,
|
||||||
accountName: string,
|
body: Types.ThroughputSettingsUpdateParameters
|
||||||
databaseName: string,
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
graphName: string
|
const path = `/${databaseName}/graphs/${graphName}/throughputSettings/default`;
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
return window
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
async getGremlinDatabaseThroughput(databaseName: string): Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
const path = `/${databaseName}/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 Gremlin database */
|
||||||
|
async updateGremlinDatabaseThroughput(
|
||||||
|
databaseName: string,
|
||||||
|
body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
const path = `/${databaseName}/throughputSettings/default`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,164 +4,112 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class MongoDBResourcesClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/mongodbDatabases`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */
|
/* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */
|
||||||
export async function listMongoDBDatabases (
|
async listMongoDBDatabases(): Promise<Types.MongoDBDatabaseListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.MongoDBDatabaseListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. */
|
/* Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getMongoDBDatabase (
|
async getMongoDBDatabase(databaseName: string): Promise<Types.MongoDBDatabaseGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.MongoDBDatabaseGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or updates Azure Cosmos DB MongoDB database */
|
/* Create or updates Azure Cosmos DB MongoDB database */
|
||||||
export async function createUpdateMongoDBDatabase (
|
async createUpdateMongoDBDatabase(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
body: Types.MongoDBDatabaseCreateUpdateParameters
|
||||||
accountName: string,
|
): Promise<Types.MongoDBDatabaseGetResults | void> {
|
||||||
databaseName: string
|
const path = `/${databaseName}`;
|
||||||
,body: Types.MongoDBDatabaseCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.MongoDBDatabaseGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB MongoDB database. */
|
/* Deletes an existing Azure Cosmos DB MongoDB database. */
|
||||||
export async function deleteMongoDBDatabase (
|
async deleteMongoDBDatabase(databaseName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. */
|
|
||||||
export async function getMongoDBDatabaseThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update RUs per second of the an Azure Cosmos DB MongoDB database */
|
|
||||||
export async function updateMongoDBDatabaseThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the MongoDB collection under an existing Azure Cosmos DB database account. */
|
/* Lists the MongoDB collection under an existing Azure Cosmos DB database account. */
|
||||||
export async function listMongoDBCollections (
|
async listMongoDBCollections(databaseName: string): Promise<Types.MongoDBCollectionListResult> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/collections`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.MongoDBCollectionListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the MongoDB collection under an existing Azure Cosmos DB database account. */
|
/* Gets the MongoDB collection under an existing Azure Cosmos DB database account. */
|
||||||
export async function getMongoDBCollection (
|
async getMongoDBCollection(databaseName: string, collectionName: string): Promise<Types.MongoDBCollectionGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/collections/${collectionName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
collectionName: string
|
|
||||||
|
|
||||||
) : Promise<Types.MongoDBCollectionGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB MongoDB Collection */
|
/* Create or update an Azure Cosmos DB MongoDB Collection */
|
||||||
export async function createUpdateMongoDBCollection (
|
async createUpdateMongoDBCollection(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
collectionName: string,
|
||||||
accountName: string,
|
body: Types.MongoDBCollectionCreateUpdateParameters
|
||||||
databaseName: string,
|
): Promise<Types.MongoDBCollectionGetResults | void> {
|
||||||
collectionName: string
|
const path = `/${databaseName}/collections/${collectionName}`;
|
||||||
,body: Types.MongoDBCollectionCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.MongoDBCollectionGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB MongoDB Collection. */
|
/* Deletes an existing Azure Cosmos DB MongoDB Collection. */
|
||||||
export async function deleteMongoDBCollection (
|
async deleteMongoDBCollection(databaseName: string, collectionName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/collections/${collectionName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
collectionName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. */
|
/* Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getMongoDBCollectionThroughput (
|
async getMongoDBCollectionThroughput(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
collectionName: string
|
||||||
accountName: string,
|
): Promise<Types.ThroughputSettingsGetResults> {
|
||||||
databaseName: string,
|
const path = `/${databaseName}/collections/${collectionName}/throughputSettings/default`;
|
||||||
collectionName: string
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update the RUs per second of an Azure Cosmos DB MongoDB collection */
|
/* Update the RUs per second of an Azure Cosmos DB MongoDB collection */
|
||||||
export async function updateMongoDBCollectionThroughput (
|
async updateMongoDBCollectionThroughput(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
collectionName: string,
|
||||||
accountName: string,
|
body: Types.ThroughputSettingsUpdateParameters
|
||||||
databaseName: string,
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
collectionName: string
|
const path = `/${databaseName}/collections/${collectionName}/throughputSettings/default`;
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
return window
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
async getMongoDBDatabaseThroughput(databaseName: string): Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
const path = `/${databaseName}/throughputSettings/default`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update RUs per second of the an Azure Cosmos DB MongoDB database */
|
||||||
|
async updateMongoDBDatabaseThroughput(
|
||||||
|
databaseName: string,
|
||||||
|
body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
const path = `/${databaseName}/throughputSettings/default`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,14 +4,15 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class OperationsClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/providers/Microsoft.DocumentDB/operations`;
|
||||||
|
|
||||||
/* Lists all of the available Cosmos DB Resource Provider operations. */
|
/* Lists all of the available Cosmos DB Resource Provider operations. */
|
||||||
export async function list (
|
async list(): Promise<Types.OperationListResult> {
|
||||||
|
const path = ``;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
) : Promise<Types.OperationListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/providers/Microsoft.DocumentDB/operations`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,19 +4,24 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class PartitionKeyRangeIdClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/databases/${this.databaseRid}/collections/${this.collectionRid}/partitionKeyRangeId/${this.partitionKeyRangeId}/metrics`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string,
|
||||||
|
private readonly databaseRid: string,
|
||||||
|
private readonly collectionRid: string,
|
||||||
|
private readonly partitionKeyRangeId: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given partition key range id. */
|
/* Retrieves the metrics determined by the given filter for the given partition key range id. */
|
||||||
export async function listMetrics (
|
async listMetrics(): Promise<Types.PartitionMetricListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string,
|
|
||||||
partitionKeyRangeId: string
|
|
||||||
|
|
||||||
) : Promise<Types.PartitionMetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,20 +4,25 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class PartitionKeyRangeIdRegionClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/region/${this.region}/databases/${this.databaseRid}/collections/${this.collectionRid}/partitionKeyRangeId/${this.partitionKeyRangeId}/metrics`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string,
|
||||||
|
private readonly region: string,
|
||||||
|
private readonly databaseRid: string,
|
||||||
|
private readonly collectionRid: string,
|
||||||
|
private readonly partitionKeyRangeId: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given partition key range id and region. */
|
/* Retrieves the metrics determined by the given filter for the given partition key range id and region. */
|
||||||
export async function listMetrics (
|
async listMetrics(): Promise<Types.PartitionMetricListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
region: string,
|
|
||||||
databaseRid: string,
|
|
||||||
collectionRid: string,
|
|
||||||
partitionKeyRangeId: string
|
|
||||||
|
|
||||||
) : Promise<Types.PartitionMetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,16 +4,21 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class PercentileClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/percentile/metrics`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data */
|
/* Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data */
|
||||||
export async function listMetrics (
|
async listMetrics(): Promise<Types.PercentileMetricListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.PercentileMetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/percentile/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,18 +4,23 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class PercentileSourceTargetClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/sourceRegion/${this.sourceRegion}/targetRegion/${this.targetRegion}/percentile/metrics`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string,
|
||||||
|
private readonly sourceRegion: string,
|
||||||
|
private readonly targetRegion: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data */
|
/* Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data */
|
||||||
export async function listMetrics (
|
async listMetrics(): Promise<Types.PercentileMetricListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
sourceRegion: string,
|
|
||||||
targetRegion: string
|
|
||||||
|
|
||||||
) : Promise<Types.PercentileMetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sourceRegion/${sourceRegion}/targetRegion/${targetRegion}/percentile/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,17 +4,22 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class PercentileTargetClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/targetRegion/${this.targetRegion}/percentile/metrics`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string,
|
||||||
|
private readonly targetRegion: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data */
|
/* Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data */
|
||||||
export async function listMetrics (
|
async listMetrics(): Promise<Types.PercentileMetricListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
targetRegion: string
|
|
||||||
|
|
||||||
) : Promise<Types.PercentileMetricListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/targetRegion/${targetRegion}/percentile/metrics`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,37 +4,34 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class RestorableDatabaseAccountsClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/providers/Microsoft.DocumentDB/`;
|
||||||
|
|
||||||
|
constructor(private readonly subscriptionId: string) {}
|
||||||
|
|
||||||
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. */
|
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. */
|
||||||
export async function listByLocation (
|
async listByLocation(
|
||||||
subscriptionId: string,
|
location: string
|
||||||
location: string
|
): Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
|
||||||
|
const path = `locations/${location}/restorableDatabaseAccounts`;
|
||||||
) : Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription. */
|
|
||||||
export async function list (
|
|
||||||
subscriptionId: string
|
|
||||||
|
|
||||||
) : Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Retrieves the properties of an existing Azure Cosmos DB restorable database account. */
|
/* Retrieves the properties of an existing Azure Cosmos DB restorable database account. */
|
||||||
export async function getByLocation (
|
async getByLocation(
|
||||||
subscriptionId: string,
|
location: string,
|
||||||
location: string,
|
instanceId: string
|
||||||
instanceId: string
|
): Promise<Types.RestorableDatabaseAccountGetResult | Types.ErrorResponseUpdatedFormat> {
|
||||||
|
const path = `locations/${location}/restorableDatabaseAccounts/${instanceId}`;
|
||||||
) : Promise<Types.RestorableDatabaseAccountGetResult | Types.ErrorResponseUpdatedFormat> {
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts/${instanceId}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription. */
|
||||||
|
async list(): Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
|
||||||
|
const path = `restorableDatabaseAccounts`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,341 +4,231 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class SqlResourcesClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/sqlDatabases`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Lists the SQL databases under an existing Azure Cosmos DB database account. */
|
/* Lists the SQL databases under an existing Azure Cosmos DB database account. */
|
||||||
export async function listSqlDatabases (
|
async listSqlDatabases(): Promise<Types.SqlDatabaseListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.SqlDatabaseListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */
|
/* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getSqlDatabase (
|
async getSqlDatabase(databaseName: string): Promise<Types.SqlDatabaseGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.SqlDatabaseGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB SQL database */
|
/* Create or update an Azure Cosmos DB SQL database */
|
||||||
export async function createUpdateSqlDatabase (
|
async createUpdateSqlDatabase(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
body: Types.SqlDatabaseCreateUpdateParameters
|
||||||
accountName: string,
|
): Promise<Types.SqlDatabaseGetResults | void> {
|
||||||
databaseName: string
|
const path = `/${databaseName}`;
|
||||||
,body: Types.SqlDatabaseCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.SqlDatabaseGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB SQL database. */
|
/* Deletes an existing Azure Cosmos DB SQL database. */
|
||||||
export async function deleteSqlDatabase (
|
async deleteSqlDatabase(databaseName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. */
|
|
||||||
export async function getSqlDatabaseThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update RUs per second of an Azure Cosmos DB SQL database */
|
|
||||||
export async function updateSqlDatabaseThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the SQL container under an existing Azure Cosmos DB database account. */
|
/* Lists the SQL container under an existing Azure Cosmos DB database account. */
|
||||||
export async function listSqlContainers (
|
async listSqlContainers(databaseName: string): Promise<Types.SqlContainerListResult> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/containers`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string
|
|
||||||
|
|
||||||
) : Promise<Types.SqlContainerListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the SQL container under an existing Azure Cosmos DB database account. */
|
/* Gets the SQL container under an existing Azure Cosmos DB database account. */
|
||||||
export async function getSqlContainer (
|
async getSqlContainer(databaseName: string, containerName: string): Promise<Types.SqlContainerGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/containers/${containerName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
containerName: string
|
|
||||||
|
|
||||||
) : Promise<Types.SqlContainerGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB SQL container */
|
/* Create or update an Azure Cosmos DB SQL container */
|
||||||
export async function createUpdateSqlContainer (
|
async createUpdateSqlContainer(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
containerName: string,
|
||||||
accountName: string,
|
body: Types.SqlContainerCreateUpdateParameters
|
||||||
databaseName: string,
|
): Promise<Types.SqlContainerGetResults | void> {
|
||||||
containerName: string
|
const path = `/${databaseName}/containers/${containerName}`;
|
||||||
,body: Types.SqlContainerCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.SqlContainerGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB SQL container. */
|
/* Deletes an existing Azure Cosmos DB SQL container. */
|
||||||
export async function deleteSqlContainer (
|
async deleteSqlContainer(databaseName: string, containerName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/containers/${containerName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
containerName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. */
|
|
||||||
export async function getSqlContainerThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
containerName: string
|
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update RUs per second of an Azure Cosmos DB SQL container */
|
|
||||||
export async function updateSqlContainerThroughput (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
containerName: string
|
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */
|
/* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */
|
||||||
export async function listSqlStoredProcedures (
|
async listSqlStoredProcedures(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
containerName: string
|
||||||
accountName: string,
|
): Promise<Types.SqlStoredProcedureListResult> {
|
||||||
databaseName: string,
|
const path = `/${databaseName}/containers/${containerName}/storedProcedures`;
|
||||||
containerName: string
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
|
||||||
) : Promise<Types.SqlStoredProcedureListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. */
|
/* Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. */
|
||||||
export async function getSqlStoredProcedure (
|
async getSqlStoredProcedure(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
containerName: string,
|
||||||
accountName: string,
|
storedProcedureName: string
|
||||||
databaseName: string,
|
): Promise<Types.SqlStoredProcedureGetResults> {
|
||||||
containerName: string,
|
const path = `/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
|
||||||
storedProcedureName: string
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
|
||||||
) : Promise<Types.SqlStoredProcedureGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB SQL storedProcedure */
|
/* Create or update an Azure Cosmos DB SQL storedProcedure */
|
||||||
export async function createUpdateSqlStoredProcedure (
|
async createUpdateSqlStoredProcedure(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
containerName: string,
|
||||||
accountName: string,
|
storedProcedureName: string,
|
||||||
databaseName: string,
|
body: Types.SqlStoredProcedureCreateUpdateParameters
|
||||||
containerName: string,
|
): Promise<Types.SqlStoredProcedureGetResults | void> {
|
||||||
storedProcedureName: string
|
const path = `/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
|
||||||
,body: Types.SqlStoredProcedureCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.SqlStoredProcedureGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB SQL storedProcedure. */
|
/* Deletes an existing Azure Cosmos DB SQL storedProcedure. */
|
||||||
export async function deleteSqlStoredProcedure (
|
async deleteSqlStoredProcedure(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
containerName: string,
|
||||||
accountName: string,
|
storedProcedureName: string
|
||||||
databaseName: string,
|
): Promise<void | void> {
|
||||||
containerName: string,
|
const path = `/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
|
||||||
storedProcedureName: string
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. */
|
||||||
|
async getSqlContainerThroughput(
|
||||||
/* Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */
|
databaseName: string,
|
||||||
export async function listSqlUserDefinedFunctions (
|
containerName: string
|
||||||
subscriptionId: string,
|
): Promise<Types.ThroughputSettingsGetResults> {
|
||||||
resourceGroupName: string,
|
const path = `/${databaseName}/containers/${containerName}/throughputSettings/default`;
|
||||||
accountName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
databaseName: string,
|
|
||||||
containerName: string
|
|
||||||
|
|
||||||
) : Promise<Types.SqlUserDefinedFunctionListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update RUs per second of an Azure Cosmos DB SQL container */
|
||||||
|
async updateSqlContainerThroughput(
|
||||||
/* Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */
|
databaseName: string,
|
||||||
export async function getSqlUserDefinedFunction (
|
containerName: string,
|
||||||
subscriptionId: string,
|
body: Types.ThroughputSettingsUpdateParameters
|
||||||
resourceGroupName: string,
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
accountName: string,
|
const path = `/${databaseName}/containers/${containerName}/throughputSettings/default`;
|
||||||
databaseName: string,
|
return window
|
||||||
containerName: string,
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
userDefinedFunctionName: string
|
.then(response => response.json());
|
||||||
|
|
||||||
) : Promise<Types.SqlUserDefinedFunctionGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB SQL userDefinedFunction */
|
|
||||||
export async function createUpdateSqlUserDefinedFunction (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
containerName: string,
|
|
||||||
userDefinedFunctionName: string
|
|
||||||
,body: Types.SqlUserDefinedFunctionCreateUpdateParameters
|
|
||||||
) : Promise<Types.SqlUserDefinedFunctionGetResults | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB SQL userDefinedFunction. */
|
|
||||||
export async function deleteSqlUserDefinedFunction (
|
|
||||||
subscriptionId: string,
|
|
||||||
resourceGroupName: string,
|
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
containerName: string,
|
|
||||||
userDefinedFunctionName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Lists the SQL trigger under an existing Azure Cosmos DB database account. */
|
/* Lists the SQL trigger under an existing Azure Cosmos DB database account. */
|
||||||
export async function listSqlTriggers (
|
async listSqlTriggers(databaseName: string, containerName: string): Promise<Types.SqlTriggerListResult> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/containers/${containerName}/triggers`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
containerName: string
|
|
||||||
|
|
||||||
) : Promise<Types.SqlTriggerListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the SQL trigger under an existing Azure Cosmos DB database account. */
|
/* Gets the SQL trigger under an existing Azure Cosmos DB database account. */
|
||||||
export async function getSqlTrigger (
|
async getSqlTrigger(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
containerName: string,
|
||||||
accountName: string,
|
triggerName: string
|
||||||
databaseName: string,
|
): Promise<Types.SqlTriggerGetResults> {
|
||||||
containerName: string,
|
const path = `/${databaseName}/containers/${containerName}/triggers/${triggerName}`;
|
||||||
triggerName: string
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
|
||||||
) : Promise<Types.SqlTriggerGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB SQL trigger */
|
/* Create or update an Azure Cosmos DB SQL trigger */
|
||||||
export async function createUpdateSqlTrigger (
|
async createUpdateSqlTrigger(
|
||||||
subscriptionId: string,
|
databaseName: string,
|
||||||
resourceGroupName: string,
|
containerName: string,
|
||||||
accountName: string,
|
triggerName: string,
|
||||||
databaseName: string,
|
body: Types.SqlTriggerCreateUpdateParameters
|
||||||
containerName: string,
|
): Promise<Types.SqlTriggerGetResults | void> {
|
||||||
triggerName: string
|
const path = `/${databaseName}/containers/${containerName}/triggers/${triggerName}`;
|
||||||
,body: Types.SqlTriggerCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.SqlTriggerGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB SQL trigger. */
|
/* Deletes an existing Azure Cosmos DB SQL trigger. */
|
||||||
export async function deleteSqlTrigger (
|
async deleteSqlTrigger(databaseName: string, containerName: string, triggerName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${databaseName}/containers/${containerName}/triggers/${triggerName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
databaseName: string,
|
|
||||||
containerName: string,
|
|
||||||
triggerName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */
|
||||||
|
async listSqlUserDefinedFunctions(
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string
|
||||||
|
): Promise<Types.SqlUserDefinedFunctionListResult> {
|
||||||
|
const path = `/${databaseName}/containers/${containerName}/userDefinedFunctions`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */
|
||||||
|
async getSqlUserDefinedFunction(
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
userDefinedFunctionName: string
|
||||||
|
): Promise<Types.SqlUserDefinedFunctionGetResults> {
|
||||||
|
const path = `/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB SQL userDefinedFunction */
|
||||||
|
async createUpdateSqlUserDefinedFunction(
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
userDefinedFunctionName: string,
|
||||||
|
body: Types.SqlUserDefinedFunctionCreateUpdateParameters
|
||||||
|
): Promise<Types.SqlUserDefinedFunctionGetResults | void> {
|
||||||
|
const path = `/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB SQL userDefinedFunction. */
|
||||||
|
async deleteSqlUserDefinedFunction(
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
userDefinedFunctionName: string
|
||||||
|
): Promise<void | void> {
|
||||||
|
const path = `/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`;
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
async getSqlDatabaseThroughput(databaseName: string): Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
const path = `/${databaseName}/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 SQL database */
|
||||||
|
async updateSqlDatabaseThroughput(
|
||||||
|
databaseName: string,
|
||||||
|
body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
const path = `/${databaseName}/throughputSettings/default`;
|
||||||
|
return window
|
||||||
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,81 +4,61 @@
|
|||||||
Run "npm run generateARMClients" to regenerate
|
Run "npm run generateARMClients" to regenerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from "./types"
|
import * as Types from "./types";
|
||||||
|
|
||||||
|
export class TableResourcesClient {
|
||||||
|
private readonly baseUrl = "https://management.azure.com";
|
||||||
|
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/tables`;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly subscriptionId: string,
|
||||||
|
private readonly resourceGroupName: string,
|
||||||
|
private readonly accountName: string
|
||||||
|
) {}
|
||||||
|
|
||||||
/* Lists the Tables under an existing Azure Cosmos DB database account. */
|
/* Lists the Tables under an existing Azure Cosmos DB database account. */
|
||||||
export async function listTables (
|
async listTables(): Promise<Types.TableListResult> {
|
||||||
subscriptionId: string,
|
const path = ``;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string
|
|
||||||
|
|
||||||
) : Promise<Types.TableListResult> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */
|
/* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getTable (
|
async getTable(tableName: string): Promise<Types.TableGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${tableName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
tableName: string
|
|
||||||
|
|
||||||
) : Promise<Types.TableGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create or update an Azure Cosmos DB Table */
|
/* Create or update an Azure Cosmos DB Table */
|
||||||
export async function createUpdateTable (
|
async createUpdateTable(
|
||||||
subscriptionId: string,
|
tableName: string,
|
||||||
resourceGroupName: string,
|
body: Types.TableCreateUpdateParameters
|
||||||
accountName: string,
|
): Promise<Types.TableGetResults | void> {
|
||||||
tableName: string
|
const path = `/${tableName}`;
|
||||||
,body: Types.TableCreateUpdateParameters
|
return window
|
||||||
) : Promise<Types.TableGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Deletes an existing Azure Cosmos DB Table. */
|
/* Deletes an existing Azure Cosmos DB Table. */
|
||||||
export async function deleteTable (
|
async deleteTable(tableName: string): Promise<void | void> {
|
||||||
subscriptionId: string,
|
const path = `/${tableName}`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
tableName: string
|
|
||||||
|
|
||||||
) : Promise<void | void> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "delete", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */
|
/* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
export async function getTableThroughput (
|
async getTableThroughput(tableName: string): Promise<Types.ThroughputSettingsGetResults> {
|
||||||
subscriptionId: string,
|
const path = `/${tableName}/throughputSettings/default`;
|
||||||
resourceGroupName: string,
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
|
||||||
accountName: string,
|
|
||||||
tableName: string
|
|
||||||
|
|
||||||
) : Promise<Types.ThroughputSettingsGetResults> {
|
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update RUs per second of an Azure Cosmos DB Table */
|
/* Update RUs per second of an Azure Cosmos DB Table */
|
||||||
export async function updateTableThroughput (
|
async updateTableThroughput(
|
||||||
subscriptionId: string,
|
tableName: string,
|
||||||
resourceGroupName: string,
|
body: Types.ThroughputSettingsUpdateParameters
|
||||||
accountName: string,
|
): Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
tableName: string
|
const path = `/${tableName}/throughputSettings/default`;
|
||||||
,body: Types.ThroughputSettingsUpdateParameters
|
return window
|
||||||
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
|
||||||
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
.then(response => response.json());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,7 @@
|
|||||||
"./src/Explorer/Controls/Toolbar/KeyCodes.ts",
|
"./src/Explorer/Controls/Toolbar/KeyCodes.ts",
|
||||||
"./src/Explorer/Notebook/FileSystemUtil.ts",
|
"./src/Explorer/Notebook/FileSystemUtil.ts",
|
||||||
"./src/Explorer/Notebook/NTeractUtil.ts",
|
"./src/Explorer/Notebook/NTeractUtil.ts",
|
||||||
|
"./src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
|
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/loadTransform.ts",
|
"./src/Explorer/Notebook/NotebookComponent/loadTransform.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/reducers.ts",
|
"./src/Explorer/Notebook/NotebookComponent/reducers.ts",
|
||||||
|
|||||||
@@ -24,7 +24,12 @@ const outputDir = path.join(__dirname, "../../src/Utils/arm/");
|
|||||||
mkdirp.sync(outputDir);
|
mkdirp.sync(outputDir);
|
||||||
|
|
||||||
// Buckets for grouping operations based on their name
|
// Buckets for grouping operations based on their name
|
||||||
const namespaces: { [key: string]: string[] } = {};
|
interface Client {
|
||||||
|
paths: string[];
|
||||||
|
functions: string[];
|
||||||
|
constructorParams: string[];
|
||||||
|
}
|
||||||
|
const clients: { [key: string]: Client } = {};
|
||||||
|
|
||||||
// Mapping for OpenAPI types to TypeScript types
|
// Mapping for OpenAPI types to TypeScript types
|
||||||
const propertyMap: { [key: string]: string } = {
|
const propertyMap: { [key: string]: string } = {
|
||||||
@@ -63,9 +68,7 @@ function parametersFromPath(path: string) {
|
|||||||
// TODO: Remove any. String.matchAll is a real thing.
|
// TODO: Remove any. String.matchAll is a real thing.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const matches = (path as any).matchAll(/{(\w+)}/g);
|
const matches = (path as any).matchAll(/{(\w+)}/g);
|
||||||
return Array.from(matches)
|
return Array.from(matches).map((match: string[]) => match[1]);
|
||||||
.map((match: string[]) => `${match[1]}: string`)
|
|
||||||
.join(",\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Operation = { responses: { [key: string]: { schema: { $ref: string } } } };
|
type Operation = { responses: { [key: string]: { schema: { $ref: string } } } };
|
||||||
@@ -168,43 +171,102 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// STEP 2: Convert all paths and operations to simple fetch functions.
|
// STEP 2: Group all paths by output client and extract common constructor parameters
|
||||||
// Functions are grouped into objects based on resource types
|
// Functions are grouped into clients based on operation name
|
||||||
for (const path in schema.paths) {
|
for (const path in schema.paths) {
|
||||||
for (const method in schema.paths[path]) {
|
for (const method in schema.paths[path]) {
|
||||||
const operation = schema.paths[path][method];
|
const operation = schema.paths[path][method];
|
||||||
const bodyParameter = operation.parameters.find(
|
const [namespace] = operation.operationId.split("_");
|
||||||
(parameter: { in: string; required: boolean }) => parameter.in === "body" && parameter.required === true
|
if (clients[namespace] === undefined) {
|
||||||
);
|
clients[namespace] = { paths: [], functions: [], constructorParams: [] };
|
||||||
const [namespace, operationName] = operation.operationId.split("_");
|
clients[namespace];
|
||||||
if (namespaces[namespace] === undefined) {
|
|
||||||
namespaces[namespace] = [];
|
|
||||||
}
|
}
|
||||||
namespaces[namespace].push(`
|
if (!clients[namespace].paths.includes(path)) {
|
||||||
/* ${operation.description} */
|
clients[namespace].paths.push(path);
|
||||||
export async function ${camelize(operationName)} (
|
|
||||||
${parametersFromPath(path)}
|
|
||||||
${bodyParam(bodyParameter, "Types")}
|
|
||||||
) : Promise<${responseType(operation, "Types")}> {
|
|
||||||
return window.fetch(\`https://management.azure.com${path.replace(/{/g, "${")}\`, { method: "${method}", ${
|
|
||||||
bodyParameter ? "body: JSON.stringify(body)" : ""
|
|
||||||
} }).then((response) => response.json())
|
|
||||||
}
|
}
|
||||||
`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write all grouped fetch functions to objects
|
// Write all grouped fetch functions to objects
|
||||||
for (const namespace in namespaces) {
|
for (const clientName in clients) {
|
||||||
const outputClient: string[] = [""];
|
const outputClient: string[] = [""];
|
||||||
outputClient.push(`import * as Types from "./types"\n\n`);
|
outputClient.push(`import * as Types from "./types"\n\n`);
|
||||||
outputClient.push(namespaces[namespace].join("\n\n"));
|
outputClient.push(`export class ${clientName}Client {\n\n`);
|
||||||
writeOutputFile(`./${namespace}.ts`, outputClient);
|
outputClient.push(`private readonly baseUrl = "https://management.azure.com"\n`);
|
||||||
|
const basePath = buildBasePath(clients[clientName].paths);
|
||||||
|
outputClient.push(`private readonly basePath = \`${basePath.replace(/{/g, "${this.")}\`\n\n`);
|
||||||
|
outputClient.push(buildConstructor(clients[clientName]));
|
||||||
|
for (const path of clients[clientName].paths) {
|
||||||
|
for (const method in schema.paths[path]) {
|
||||||
|
const operation = schema.paths[path][method];
|
||||||
|
const [, methodName] = operation.operationId.split("_");
|
||||||
|
const bodyParameter = operation.parameters.find(
|
||||||
|
(parameter: { in: string; required: boolean }) => parameter.in === "body" && parameter.required === true
|
||||||
|
);
|
||||||
|
const constructorParameters = constructorParams(clients[clientName]);
|
||||||
|
const methodParameters = parametersFromPath(path).filter(p => !constructorParameters.includes(p));
|
||||||
|
outputClient.push(`
|
||||||
|
/* ${operation.description} */
|
||||||
|
async ${camelize(methodName)} (
|
||||||
|
${methodParameters.map(p => `${p}: string`).join(",\n")}
|
||||||
|
${bodyParam(bodyParameter, "Types")}
|
||||||
|
) : Promise<${responseType(operation, "Types")}> {
|
||||||
|
const path = \`${path.replace(basePath, "").replace(/{/g, "${")}\`
|
||||||
|
return window.fetch(this.baseUrl + this.basePath + path, { method: "${method}", ${
|
||||||
|
bodyParameter ? "body: JSON.stringify(body)" : ""
|
||||||
|
} }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
// clients[clientName].functions.push(`
|
||||||
|
// /* ${operation.description} */
|
||||||
|
// async ${camelize(methodName)} (
|
||||||
|
// ${parametersFromPath(path)}
|
||||||
|
// ${bodyParam(bodyParameter, "Types")}
|
||||||
|
// ) : Promise<${responseType(operation, "Types")}> {
|
||||||
|
// return window.fetch(\`https://management.azure.com${path.replace(/{/g, "${")}\`, { method: "${method}", ${
|
||||||
|
// bodyParameter ? "body: JSON.stringify(body)" : ""
|
||||||
|
// } }).then((response) => response.json())
|
||||||
|
// }
|
||||||
|
// `);
|
||||||
|
// outputClient.push(clients[client].join("\n\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outputClient.push(`}`);
|
||||||
|
writeOutputFile(`./${clientName}.ts`, outputClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeOutputFile("./types.ts", outputTypes);
|
writeOutputFile("./types.ts", outputTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildBasePath(strings: string[]) {
|
||||||
|
const sortArr = strings.sort();
|
||||||
|
const arrFirstElem = strings[0];
|
||||||
|
const arrLastElem = sortArr[sortArr.length - 1];
|
||||||
|
const arrFirstElemLength = arrFirstElem.length;
|
||||||
|
let i = 0;
|
||||||
|
while (i < arrFirstElemLength && arrFirstElem.charAt(i) === arrLastElem.charAt(i)) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return arrFirstElem.substring(0, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildConstructor(client: Client) {
|
||||||
|
const params = constructorParams(client);
|
||||||
|
if (params.length === 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return `\nconstructor(${params.map(p => `private readonly ${p}: string`).join(",")}){}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function constructorParams(client: Client) {
|
||||||
|
let commonParams = parametersFromPath(client.paths[0]);
|
||||||
|
for (const path of client.paths) {
|
||||||
|
const params = parametersFromPath(path);
|
||||||
|
commonParams = commonParams.filter(p => params.includes(p));
|
||||||
|
}
|
||||||
|
return commonParams;
|
||||||
|
}
|
||||||
|
|
||||||
function writeOutputFile(outputPath: string, components: string[]) {
|
function writeOutputFile(outputPath: string, components: string[]) {
|
||||||
components.unshift(`/*
|
components.unshift(`/*
|
||||||
AUTOGENERATED FILE
|
AUTOGENERATED FILE
|
||||||
|
|||||||
Reference in New Issue
Block a user