Functional version

This commit is contained in:
Steve Faulkner
2020-07-23 19:02:09 -05:00
parent 0c255a55c8
commit ad115a2cce
20 changed files with 1204 additions and 1080 deletions

View File

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

View File

@@ -6,33 +6,38 @@
import * as Types from "./types"; import * as Types from "./types";
export class CollectionClient { /* Retrieves the metrics determined by the given filter for the given database account and collection. */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/databases/${this.databaseRid}/collections/${this.collectionRid}/`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, databaseRid: string,
private readonly resourceGroupName: string, collectionRid: string
private readonly accountName: string, ): Promise<Types.MetricListResult> {
private readonly databaseRid: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metrics`;
private readonly collectionRid: string return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
) {} }
/* Retrieves metric definitions for the given collection. */ /* Retrieves the usages (most recent storage data) for the given collection. */
async listMetricDefinitions(): Promise<Types.MetricDefinitionsListResult> { export async function listUsages(
const path = `metricDefinitions`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseRid: string,
/* Retrieves the metrics determined by the given filter for the given database account and collection. */ collectionRid: string
async listMetrics(): Promise<Types.MetricListResult> { ): Promise<Types.UsagesResult> {
const path = `metrics`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/usages`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); 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. */ /* Retrieves metric definitions for the given collection. */
async listUsages(): Promise<Types.UsagesResult> { export async function listMetricDefinitions(
const path = `usages`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseRid: string,
collectionRid: string
): Promise<Types.MetricDefinitionsListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metricDefinitions`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
} }

View File

@@ -6,27 +6,26 @@
import * as Types from "./types"; import * as Types from "./types";
export class CollectionPartitionClient { /* Retrieves the metrics determined by the given filter for the given collection, split by partition. */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/databases/${this.databaseRid}/collections/${this.collectionRid}/partitions/`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, databaseRid: string,
private readonly resourceGroupName: string, collectionRid: string
private readonly accountName: string, ): Promise<Types.PartitionMetricListResult> {
private readonly databaseRid: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`;
private readonly collectionRid: string 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 collection, split by partition. */ /* Retrieves the usages (most recent storage data) for the given collection, split by partition. */
async listMetrics(): Promise<Types.PartitionMetricListResult> { export async function listUsages(
const path = `metrics`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseRid: string,
/* Retrieves the usages (most recent storage data) for the given collection, split by partition. */ collectionRid: string
async listUsages(): Promise<Types.PartitionUsagesResult> { ): Promise<Types.PartitionUsagesResult> {
const path = `usages`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/usages`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,22 +6,15 @@
import * as Types from "./types"; import * as Types from "./types";
export class CollectionPartitionRegionClient { /* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
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`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, region: string,
private readonly resourceGroupName: string, databaseRid: string,
private readonly accountName: string, collectionRid: string
private readonly region: string, ): Promise<Types.PartitionMetricListResult> {
private readonly databaseRid: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`;
private readonly collectionRid: string 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 collection and region, split by partition. */
async listMetrics(): Promise<Types.PartitionMetricListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,22 +6,15 @@
import * as Types from "./types"; import * as Types from "./types";
export class CollectionRegionClient { /* Retrieves the metrics determined by the given filter for the given database account, collection and region. */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
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`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, region: string,
private readonly resourceGroupName: string, databaseRid: string,
private readonly accountName: string, collectionRid: string
private readonly region: string, ): Promise<Types.MetricListResult> {
private readonly databaseRid: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/metrics`;
private readonly collectionRid: string 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, collection and region. */
async listMetrics(): Promise<Types.MetricListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,32 +6,35 @@
import * as Types from "./types"; import * as Types from "./types";
export class DatabaseClient { /* Retrieves the metrics determined by the given filter for the given database account and database. */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/databases/${this.databaseRid}/`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, databaseRid: string
private readonly resourceGroupName: string, ): Promise<Types.MetricListResult> {
private readonly accountName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metrics`;
private readonly databaseRid: string return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
) {} }
/* Retrieves metric definitions for the given database. */ /* Retrieves the usages (most recent data) for the given database. */
async listMetricDefinitions(): Promise<Types.MetricDefinitionsListResult> { export async function listUsages(
const path = `metricDefinitions`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseRid: string
/* Retrieves the metrics determined by the given filter for the given database account and database. */ ): Promise<Types.UsagesResult> {
async listMetrics(): Promise<Types.MetricListResult> { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/usages`;
const path = `metrics`; return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); }
}
/* Retrieves metric definitions for the given database. */
/* Retrieves the usages (most recent data) for the given database. */ export async function listMetricDefinitions(
async listUsages(): Promise<Types.UsagesResult> { 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
): Promise<Types.MetricDefinitionsListResult> {
const path = `/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());
} }

View File

@@ -6,20 +6,13 @@
import * as Types from "./types"; import * as Types from "./types";
export class DatabaseAccountRegionClient { /* Retrieves the metrics determined by the given filter for the given database account and region. */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/region/${this.region}/metrics`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, region: string
private readonly resourceGroupName: string, ): Promise<Types.MetricListResult> {
private readonly accountName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/metrics`;
private readonly region: string 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 and region. */
async listMetrics(): Promise<Types.MetricListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,192 +6,191 @@
import * as Types from "./types"; import * as Types from "./types";
export class DatabaseAccountsClient { /* Retrieves the properties of an existing Azure Cosmos DB database account. */
private readonly baseUrl = "https://management.azure.com"; export async function get(
private readonly basePath = `/`; subscriptionId: string,
resourceGroupName: string,
/* 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. */ accountName: string
async checkNameExists(accountName: string): Promise<void | void> { ): Promise<Types.DatabaseAccountGetResults> {
const path = `providers/Microsoft.DocumentDB/databaseAccountNames/${accountName}`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "head" }).then(response => response.json()); 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 subscription. */ /* Updates the properties of an existing Azure Cosmos DB database account. */
async list(subscriptionId: string): Promise<Types.DatabaseAccountsListResult> { export async function update(
const path = `subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
body: Types.DatabaseAccountUpdateParameters
/* Lists all the Azure Cosmos DB database accounts available under the given resource group. */ ): Promise<Types.DatabaseAccountGetResults> {
async listByResourceGroup( const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
subscriptionId: string, return window
resourceGroupName: string .fetch(this.baseUrl + this.basePath + path, { method: "patch", body: JSON.stringify(body) })
): Promise<Types.DatabaseAccountsListResult> { .then(response => response.json());
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts`; }
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).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(
/* Retrieves the properties of an existing Azure Cosmos DB database account. */ subscriptionId: string,
async get( resourceGroupName: string,
subscriptionId: string, accountName: string,
resourceGroupName: string, body: Types.DatabaseAccountCreateUpdateParameters
accountName: string ): Promise<Types.DatabaseAccountGetResults> {
): Promise<Types.DatabaseAccountGetResults> { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`; return window
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
} .then(response => response.json());
}
/* Updates the properties of an existing Azure Cosmos DB database account. */
async update( /* Deletes an existing Azure Cosmos DB database account. */
subscriptionId: string, export async function destroy(
resourceGroupName: string, subscriptionId: string,
accountName: string, resourceGroupName: string,
body: Types.DatabaseAccountUpdateParameters accountName: string
): Promise<Types.DatabaseAccountGetResults> { ): Promise<void | void> {
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
return window return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
.fetch(this.baseUrl + this.basePath + path, { method: "patch", body: JSON.stringify(body) }) }
.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(
/* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */ subscriptionId: string,
async createOrUpdate( resourceGroupName: string,
subscriptionId: string, accountName: string,
resourceGroupName: string, body: Types.FailoverPolicies
accountName: string, ): Promise<void | void> {
body: Types.DatabaseAccountCreateUpdateParameters const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/failoverPriorityChange`;
): Promise<Types.DatabaseAccountGetResults> { return window
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`; .fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) })
return window .then(response => response.json());
.fetch(this.baseUrl + this.basePath + path, { method: "put", 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> {
/* Deletes an existing Azure Cosmos DB database account. */ const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts`;
async destroy(subscriptionId: string, resourceGroupName: string, accountName: string): Promise<void | void> { return window.fetch(this.baseUrl + this.basePath + path, { 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: "delete" }).then(response => response.json());
} /* Lists all the Azure Cosmos DB database accounts available under the given resource group. */
export async function listByResourceGroup(
/* 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. */ subscriptionId: string,
async failoverPriorityChange( resourceGroupName: string
subscriptionId: string, ): Promise<Types.DatabaseAccountsListResult> {
resourceGroupName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts`;
accountName: string, return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
body: Types.FailoverPolicies }
): Promise<void | void> {
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/failoverPriorityChange`; /* Lists the access keys for the specified Azure Cosmos DB database account. */
return window export async function listKeys(
.fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) }) subscriptionId: string,
.then(response => response.json()); resourceGroupName: string,
} accountName: string
): Promise<Types.DatabaseAccountListKeysResult> {
/* Lists the connection strings for the specified Azure Cosmos DB database account. */ const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listKeys`;
async listConnectionStrings( return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json());
subscriptionId: string, }
resourceGroupName: string,
accountName: string /* Lists the connection strings for the specified Azure Cosmos DB database account. */
): Promise<Types.DatabaseAccountListConnectionStringsResult> { export async function listConnectionStrings(
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listConnectionStrings`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json()); resourceGroupName: string,
} accountName: string
): Promise<Types.DatabaseAccountListConnectionStringsResult> {
/* Lists the access keys for the specified Azure Cosmos DB database account. */ const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listConnectionStrings`;
async listKeys( return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json());
subscriptionId: string, }
resourceGroupName: string,
accountName: string /* Offline the specified region for the specified Azure Cosmos DB database account. */
): Promise<Types.DatabaseAccountListKeysResult> { export async function offlineRegion(
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listKeys`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
body: Types.RegionForOnlineOffline
/* Retrieves metric definitions for the given database account. */ ): Promise<void | void | Types.ErrorResponse> {
async listMetricDefinitions( const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/offlineRegion`;
subscriptionId: string, return window
resourceGroupName: string, .fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) })
accountName: string .then(response => response.json());
): Promise<Types.MetricDefinitionsListResult> { }
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metricDefinitions`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); /* Online the specified region for the specified Azure Cosmos DB database account. */
} export async function onlineRegion(
subscriptionId: string,
/* Retrieves the metrics determined by the given filter for the given database account. */ resourceGroupName: string,
async listMetrics( accountName: string,
subscriptionId: string, body: Types.RegionForOnlineOffline
resourceGroupName: string, ): Promise<void | void | Types.ErrorResponse> {
accountName: string const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/onlineRegion`;
): Promise<Types.MetricListResult> { return window
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metrics`; .fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) })
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); .then(response => response.json());
} }
/* Offline the specified region for the specified Azure Cosmos DB database account. */ /* Lists the read-only access keys for the specified Azure Cosmos DB database account. */
async offlineRegion( export async function getReadOnlyKeys(
subscriptionId: string, subscriptionId: string,
resourceGroupName: string, resourceGroupName: string,
accountName: string, accountName: string
body: Types.RegionForOnlineOffline ): Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
): Promise<void | void | Types.ErrorResponse> { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`;
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/offlineRegion`; return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
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. */
} export async function listReadOnlyKeys(
subscriptionId: string,
/* Online the specified region for the specified Azure Cosmos DB database account. */ resourceGroupName: string,
async onlineRegion( accountName: string
subscriptionId: string, ): Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
resourceGroupName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`;
accountName: string, return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json());
body: Types.RegionForOnlineOffline }
): Promise<void | void | Types.ErrorResponse> {
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/onlineRegion`; /* Regenerates an access key for the specified Azure Cosmos DB database account. */
return window export async function regenerateKey(
.fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) }) subscriptionId: string,
.then(response => response.json()); resourceGroupName: string,
} accountName: string,
body: Types.DatabaseAccountRegenerateKeyParameters
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */ ): Promise<void | void> {
async getReadOnlyKeys( const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/regenerateKey`;
subscriptionId: string, return window
resourceGroupName: string, .fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) })
accountName: string .then(response => response.json());
): 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()); /* 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(accountName: string): Promise<void | void> {
const path = `/providers/Microsoft.DocumentDB/databaseAccountNames/${accountName}`;
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */ return window.fetch(this.baseUrl + this.basePath + path, { method: "head" }).then(response => response.json());
async listReadOnlyKeys( }
subscriptionId: string,
resourceGroupName: string, /* Retrieves the metrics determined by the given filter for the given database account. */
accountName: string export async function listMetrics(
): Promise<Types.DatabaseAccountListReadOnlyKeysResult> { subscriptionId: string,
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`; resourceGroupName: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "post" }).then(response => response.json()); accountName: string
} ): Promise<Types.MetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metrics`;
/* Regenerates an access key for the specified Azure Cosmos DB database account. */ return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
async regenerateKey( }
subscriptionId: string,
resourceGroupName: string, /* Retrieves the usages (most recent data) for the given database account. */
accountName: string, export async function listUsages(
body: Types.DatabaseAccountRegenerateKeyParameters subscriptionId: string,
): Promise<void | void> { resourceGroupName: string,
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/regenerateKey`; accountName: string
return window ): Promise<Types.UsagesResult> {
.fetch(this.baseUrl + this.basePath + path, { method: "post", body: JSON.stringify(body) }) const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/usages`;
.then(response => response.json()); return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
} }
/* Retrieves the usages (most recent data) for the given database account. */ /* Retrieves metric definitions for the given database account. */
async listUsages( export async function listMetricDefinitions(
subscriptionId: string, subscriptionId: string,
resourceGroupName: string, resourceGroupName: string,
accountName: string accountName: string
): Promise<Types.UsagesResult> { ): Promise<Types.MetricDefinitionsListResult> {
const path = `subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/usages`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metricDefinitions`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,110 +6,150 @@
import * as Types from "./types"; import * as Types from "./types";
export class GremlinResourcesClient { /* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */
private readonly baseUrl = "https://management.azure.com"; export async function listGremlinDatabases(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/gremlinDatabases`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string
private readonly subscriptionId: string, ): Promise<Types.GremlinDatabaseListResult> {
private readonly resourceGroupName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases`;
private readonly accountName: string return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
) {} }
/* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */ /* Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. */
async listGremlinDatabases(): Promise<Types.GremlinDatabaseListResult> { export async function getGremlinDatabase(
const path = ``; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseName: string
/* Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. */ ): Promise<Types.GremlinDatabaseGetResults> {
async getGremlinDatabase(databaseName: string): Promise<Types.GremlinDatabaseGetResults> { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`;
const path = `/${databaseName}`; return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
return window.fetch(this.baseUrl + this.basePath + path, { 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) }) const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`;
.then(response => response.json()); return window
} .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
/* Deletes an existing Azure Cosmos DB Gremlin database. */ }
async deleteGremlinDatabase(databaseName: string): Promise<void | void> {
const path = `/${databaseName}`; /* Deletes an existing Azure Cosmos DB Gremlin database. */
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json()); export async function deleteGremlinDatabase(
} subscriptionId: string,
resourceGroupName: string,
/* Lists the Gremlin graph under an existing Azure Cosmos DB database account. */ accountName: string,
async listGremlinGraphs(databaseName: string): Promise<Types.GremlinGraphListResult> { databaseName: string
const path = `/${databaseName}/graphs`; ): Promise<void | void> {
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`;
} return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Gets the Gremlin graph under an existing Azure Cosmos DB database account. */
async getGremlinGraph(databaseName: string, graphName: string): Promise<Types.GremlinGraphGetResults> { /* Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. */
const path = `/${databaseName}/graphs/${graphName}`; export async function getGremlinDatabaseThroughput(
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); subscriptionId: string,
} resourceGroupName: string,
accountName: string,
/* Create or update an Azure Cosmos DB Gremlin graph */ databaseName: string
async createUpdateGremlinGraph( ): Promise<Types.ThroughputSettingsGetResults> {
databaseName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`;
graphName: string, return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
body: Types.GremlinGraphCreateUpdateParameters }
): Promise<Types.GremlinGraphGetResults | void> {
const path = `/${databaseName}/graphs/${graphName}`; /* Update RUs per second of an Azure Cosmos DB Gremlin database */
return window export async function updateGremlinDatabaseThroughput(
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) subscriptionId: string,
.then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseName: string,
/* Deletes an existing Azure Cosmos DB Gremlin graph. */ body: Types.ThroughputSettingsUpdateParameters
async deleteGremlinGraph(databaseName: string, graphName: string): Promise<void | void> { ): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/${databaseName}/graphs/${graphName}`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json()); return window
} .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
/* Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. */ }
async getGremlinGraphThroughput(
databaseName: string, /* Lists the Gremlin graph under an existing Azure Cosmos DB database account. */
graphName: string export async function listGremlinGraphs(
): Promise<Types.ThroughputSettingsGetResults> { subscriptionId: string,
const path = `/${databaseName}/graphs/${graphName}/throughputSettings/default`; resourceGroupName: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); accountName: string,
} databaseName: string
): Promise<Types.GremlinGraphListResult> {
/* Update RUs per second of an Azure Cosmos DB Gremlin graph */ const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs`;
async updateGremlinGraphThroughput( return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
databaseName: string, }
graphName: string,
body: Types.ThroughputSettingsUpdateParameters /* Gets the Gremlin graph under an existing Azure Cosmos DB database account. */
): Promise<Types.ThroughputSettingsGetResults | void> { export async function getGremlinGraph(
const path = `/${databaseName}/graphs/${graphName}/throughputSettings/default`; subscriptionId: string,
return window resourceGroupName: string,
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) accountName: string,
.then(response => response.json()); databaseName: string,
} graphName: string
): Promise<Types.GremlinGraphGetResults> {
/* Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. */ const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`;
async getGremlinDatabaseThroughput(databaseName: string): Promise<Types.ThroughputSettingsGetResults> { return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
const path = `/${databaseName}/throughputSettings/default`; }
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
} /* Create or update an Azure Cosmos DB Gremlin graph */
export async function createUpdateGremlinGraph(
/* Update RUs per second of an Azure Cosmos DB Gremlin database */ subscriptionId: string,
async updateGremlinDatabaseThroughput( resourceGroupName: string,
databaseName: string, accountName: string,
body: Types.ThroughputSettingsUpdateParameters databaseName: string,
): Promise<Types.ThroughputSettingsGetResults | void> { graphName: string,
const path = `/${databaseName}/throughputSettings/default`; body: Types.GremlinGraphCreateUpdateParameters
return window ): Promise<Types.GremlinGraphGetResults | void> {
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`;
.then(response => response.json()); return window
} .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB Gremlin graph. */
export async function deleteGremlinGraph(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
graphName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. */
export async function getGremlinGraphThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
graphName: string
): Promise<Types.ThroughputSettingsGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/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 graph */
export async function updateGremlinGraphThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
graphName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`;
return window
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
} }

View File

@@ -6,110 +6,150 @@
import * as Types from "./types"; import * as Types from "./types";
export class MongoDBResourcesClient { /* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */
private readonly baseUrl = "https://management.azure.com"; export async function listMongoDBDatabases(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/mongodbDatabases`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string
private readonly subscriptionId: string, ): Promise<Types.MongoDBDatabaseListResult> {
private readonly resourceGroupName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases`;
private readonly accountName: string return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
) {} }
/* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */ /* Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. */
async listMongoDBDatabases(): Promise<Types.MongoDBDatabaseListResult> { export async function getMongoDBDatabase(
const path = ``; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseName: string
/* Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. */ ): Promise<Types.MongoDBDatabaseGetResults> {
async getMongoDBDatabase(databaseName: string): Promise<Types.MongoDBDatabaseGetResults> { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`;
const path = `/${databaseName}`; return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
return window.fetch(this.baseUrl + this.basePath + path, { 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) }) const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`;
.then(response => response.json()); return window
} .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
/* Deletes an existing Azure Cosmos DB MongoDB database. */ }
async deleteMongoDBDatabase(databaseName: string): Promise<void | void> {
const path = `/${databaseName}`; /* Deletes an existing Azure Cosmos DB MongoDB database. */
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json()); export async function deleteMongoDBDatabase(
} subscriptionId: string,
resourceGroupName: string,
/* Lists the MongoDB collection under an existing Azure Cosmos DB database account. */ accountName: string,
async listMongoDBCollections(databaseName: string): Promise<Types.MongoDBCollectionListResult> { databaseName: string
const path = `/${databaseName}/collections`; ): Promise<void | void> {
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`;
} return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Gets the MongoDB collection under an existing Azure Cosmos DB database account. */
async getMongoDBCollection(databaseName: string, collectionName: string): Promise<Types.MongoDBCollectionGetResults> { /* Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. */
const path = `/${databaseName}/collections/${collectionName}`; export async function getMongoDBDatabaseThroughput(
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); subscriptionId: string,
} resourceGroupName: string,
accountName: string,
/* Create or update an Azure Cosmos DB MongoDB Collection */ databaseName: string
async createUpdateMongoDBCollection( ): Promise<Types.ThroughputSettingsGetResults> {
databaseName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`;
collectionName: string, return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
body: Types.MongoDBCollectionCreateUpdateParameters }
): Promise<Types.MongoDBCollectionGetResults | void> {
const path = `/${databaseName}/collections/${collectionName}`; /* Update RUs per second of the an Azure Cosmos DB MongoDB database */
return window export async function updateMongoDBDatabaseThroughput(
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) subscriptionId: string,
.then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseName: string,
/* Deletes an existing Azure Cosmos DB MongoDB Collection. */ body: Types.ThroughputSettingsUpdateParameters
async deleteMongoDBCollection(databaseName: string, collectionName: string): Promise<void | void> { ): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/${databaseName}/collections/${collectionName}`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json()); return window
} .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
/* Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. */ }
async getMongoDBCollectionThroughput(
databaseName: string, /* Lists the MongoDB collection under an existing Azure Cosmos DB database account. */
collectionName: string export async function listMongoDBCollections(
): Promise<Types.ThroughputSettingsGetResults> { subscriptionId: string,
const path = `/${databaseName}/collections/${collectionName}/throughputSettings/default`; resourceGroupName: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); accountName: string,
} databaseName: string
): Promise<Types.MongoDBCollectionListResult> {
/* Update the RUs per second of an Azure Cosmos DB MongoDB collection */ const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections`;
async updateMongoDBCollectionThroughput( return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
databaseName: string, }
collectionName: string,
body: Types.ThroughputSettingsUpdateParameters /* Gets the MongoDB collection under an existing Azure Cosmos DB database account. */
): Promise<Types.ThroughputSettingsGetResults | void> { export async function getMongoDBCollection(
const path = `/${databaseName}/collections/${collectionName}/throughputSettings/default`; subscriptionId: string,
return window resourceGroupName: string,
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) accountName: string,
.then(response => response.json()); databaseName: string,
} collectionName: string
): Promise<Types.MongoDBCollectionGetResults> {
/* Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. */ const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`;
async getMongoDBDatabaseThroughput(databaseName: string): Promise<Types.ThroughputSettingsGetResults> { return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
const path = `/${databaseName}/throughputSettings/default`; }
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
} /* Create or update an Azure Cosmos DB MongoDB Collection */
export async function createUpdateMongoDBCollection(
/* Update RUs per second of the an Azure Cosmos DB MongoDB database */ subscriptionId: string,
async updateMongoDBDatabaseThroughput( resourceGroupName: string,
databaseName: string, accountName: string,
body: Types.ThroughputSettingsUpdateParameters databaseName: string,
): Promise<Types.ThroughputSettingsGetResults | void> { collectionName: string,
const path = `/${databaseName}/throughputSettings/default`; body: Types.MongoDBCollectionCreateUpdateParameters
return window ): Promise<Types.MongoDBCollectionGetResults | void> {
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`;
.then(response => response.json()); return window
} .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB MongoDB Collection. */
export async function deleteMongoDBCollection(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
collectionName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`;
return window.fetch(this.baseUrl + this.basePath + path, { 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. */
export async function getMongoDBCollectionThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
collectionName: string
): Promise<Types.ThroughputSettingsGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Update the RUs per second of an Azure Cosmos DB MongoDB collection */
export async function updateMongoDBCollectionThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
collectionName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`;
return window
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
} }

View File

@@ -6,13 +6,8 @@
import * as Types from "./types"; import * as Types from "./types";
export class OperationsClient { /* Lists all of the available Cosmos DB Resource Provider operations. */
private readonly baseUrl = "https://management.azure.com"; export async function list(): Promise<Types.OperationListResult> {
private readonly basePath = `/providers/Microsoft.DocumentDB/operations`; const path = `/providers/Microsoft.DocumentDB/operations`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
/* Lists all of the available Cosmos DB Resource Provider operations. */
async list(): Promise<Types.OperationListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,22 +6,15 @@
import * as Types from "./types"; import * as Types from "./types";
export class PartitionKeyRangeIdClient { /* Retrieves the metrics determined by the given filter for the given partition key range id. */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
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`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, databaseRid: string,
private readonly resourceGroupName: string, collectionRid: string,
private readonly accountName: string, partitionKeyRangeId: string
private readonly databaseRid: string, ): Promise<Types.PartitionMetricListResult> {
private readonly collectionRid: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`;
private readonly partitionKeyRangeId: string 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 partition key range id. */
async listMetrics(): Promise<Types.PartitionMetricListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,23 +6,16 @@
import * as Types from "./types"; import * as Types from "./types";
export class PartitionKeyRangeIdRegionClient { /* Retrieves the metrics determined by the given filter for the given partition key range id and region. */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
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`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, region: string,
private readonly resourceGroupName: string, databaseRid: string,
private readonly accountName: string, collectionRid: string,
private readonly region: string, partitionKeyRangeId: string
private readonly databaseRid: string, ): Promise<Types.PartitionMetricListResult> {
private readonly collectionRid: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`;
private readonly partitionKeyRangeId: string 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 partition key range id and region. */
async listMetrics(): Promise<Types.PartitionMetricListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,19 +6,12 @@
import * as Types from "./types"; import * as Types from "./types";
export class PercentileClient { /* Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/percentile/metrics`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string
private readonly subscriptionId: string, ): Promise<Types.PercentileMetricListResult> {
private readonly resourceGroupName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/percentile/metrics`;
private readonly accountName: string 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. This url is only for PBS and Replication Latency data */
async listMetrics(): Promise<Types.PercentileMetricListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,21 +6,14 @@
import * as Types from "./types"; import * as Types from "./types";
export class PercentileSourceTargetClient { /* 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 */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/sourceRegion/${this.sourceRegion}/targetRegion/${this.targetRegion}/percentile/metrics`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, sourceRegion: string,
private readonly resourceGroupName: string, targetRegion: string
private readonly accountName: string, ): Promise<Types.PercentileMetricListResult> {
private readonly sourceRegion: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sourceRegion/${sourceRegion}/targetRegion/${targetRegion}/percentile/metrics`;
private readonly targetRegion: string 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 account, source and target region. This url is only for PBS and Replication Latency data */
async listMetrics(): Promise<Types.PercentileMetricListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,20 +6,13 @@
import * as Types from "./types"; import * as Types from "./types";
export class PercentileTargetClient { /* Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data */
private readonly baseUrl = "https://management.azure.com"; export async function listMetrics(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/targetRegion/${this.targetRegion}/percentile/metrics`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string,
private readonly subscriptionId: string, targetRegion: string
private readonly resourceGroupName: string, ): Promise<Types.PercentileMetricListResult> {
private readonly accountName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/targetRegion/${targetRegion}/percentile/metrics`;
private readonly targetRegion: string 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 account target region. This url is only for PBS and Replication Latency data */
async listMetrics(): Promise<Types.PercentileMetricListResult> {
const path = ``;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,32 +6,29 @@
import * as Types from "./types"; import * as Types from "./types";
export class RestorableDatabaseAccountsClient { /* Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. */
private readonly baseUrl = "https://management.azure.com"; export async function listByLocation(
private readonly basePath = `/subscriptions/${this.subscriptionId}/providers/Microsoft.DocumentDB/`; subscriptionId: string,
location: string
constructor(private readonly subscriptionId: string) {} ): Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts`;
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. */ return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
async listByLocation( }
location: string
): Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> { /* Lists all the restorable Azure Cosmos DB database accounts available under the subscription. */
const path = `locations/${location}/restorableDatabaseAccounts`; export async function list(
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); subscriptionId: string
} ): Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts`;
/* Retrieves the properties of an existing Azure Cosmos DB restorable database account. */ return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
async getByLocation( }
location: string,
instanceId: string /* Retrieves the properties of an existing Azure Cosmos DB restorable database account. */
): Promise<Types.RestorableDatabaseAccountGetResult | Types.ErrorResponseUpdatedFormat> { export async function getByLocation(
const path = `locations/${location}/restorableDatabaseAccounts/${instanceId}`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); location: string,
} instanceId: string
): Promise<Types.RestorableDatabaseAccountGetResult | Types.ErrorResponseUpdatedFormat> {
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription. */ const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts/${instanceId}`;
async list(): Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> { return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
const path = `restorableDatabaseAccounts`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
} }

View File

@@ -6,229 +6,312 @@
import * as Types from "./types"; import * as Types from "./types";
export class SqlResourcesClient { /* Lists the SQL databases under an existing Azure Cosmos DB database account. */
private readonly baseUrl = "https://management.azure.com"; export async function listSqlDatabases(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/sqlDatabases`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string
private readonly subscriptionId: string, ): Promise<Types.SqlDatabaseListResult> {
private readonly resourceGroupName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases`;
private readonly accountName: string return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
) {} }
/* Lists the SQL databases under an existing Azure Cosmos DB database account. */ /* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */
async listSqlDatabases(): Promise<Types.SqlDatabaseListResult> { export async function getSqlDatabase(
const path = ``; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseName: string
/* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */ ): Promise<Types.SqlDatabaseGetResults> {
async getSqlDatabase(databaseName: string): Promise<Types.SqlDatabaseGetResults> { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`;
const path = `/${databaseName}`; return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
return window.fetch(this.baseUrl + this.basePath + path, { 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) }) const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`;
.then(response => response.json()); 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 database. */ }
async deleteSqlDatabase(databaseName: string): Promise<void | void> {
const path = `/${databaseName}`; /* Deletes an existing Azure Cosmos DB SQL database. */
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json()); export async function deleteSqlDatabase(
} subscriptionId: string,
resourceGroupName: string,
/* Lists the SQL container under an existing Azure Cosmos DB database account. */ accountName: string,
async listSqlContainers(databaseName: string): Promise<Types.SqlContainerListResult> { databaseName: string
const path = `/${databaseName}/containers`; ): Promise<void | void> {
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`;
} return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Gets the SQL container under an existing Azure Cosmos DB database account. */
async getSqlContainer(databaseName: string, containerName: string): Promise<Types.SqlContainerGetResults> { /* Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. */
const path = `/${databaseName}/containers/${containerName}`; export async function getSqlDatabaseThroughput(
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); subscriptionId: string,
} resourceGroupName: string,
accountName: string,
/* Create or update an Azure Cosmos DB SQL container */ databaseName: string
async createUpdateSqlContainer( ): Promise<Types.ThroughputSettingsGetResults> {
databaseName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`;
containerName: string, return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
body: Types.SqlContainerCreateUpdateParameters }
): Promise<Types.SqlContainerGetResults | void> {
const path = `/${databaseName}/containers/${containerName}`; /* Update RUs per second of an Azure Cosmos DB SQL database */
return window export async function updateSqlDatabaseThroughput(
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) subscriptionId: string,
.then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseName: string,
/* Deletes an existing Azure Cosmos DB SQL container. */ body: Types.ThroughputSettingsUpdateParameters
async deleteSqlContainer(databaseName: string, containerName: string): Promise<void | void> { ): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/${databaseName}/containers/${containerName}`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json()); return window
} .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
/* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */ }
async listSqlStoredProcedures(
databaseName: string, /* Lists the SQL container under an existing Azure Cosmos DB database account. */
containerName: string export async function listSqlContainers(
): Promise<Types.SqlStoredProcedureListResult> { subscriptionId: string,
const path = `/${databaseName}/containers/${containerName}/storedProcedures`; resourceGroupName: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); accountName: string,
} databaseName: string
): Promise<Types.SqlContainerListResult> {
/* Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. */ const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers`;
async getSqlStoredProcedure( return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
databaseName: string, }
containerName: string,
storedProcedureName: string /* Gets the SQL container under an existing Azure Cosmos DB database account. */
): Promise<Types.SqlStoredProcedureGetResults> { export async function getSqlContainer(
const path = `/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
databaseName: string,
/* Create or update an Azure Cosmos DB SQL storedProcedure */ containerName: string
async createUpdateSqlStoredProcedure( ): Promise<Types.SqlContainerGetResults> {
databaseName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`;
containerName: string, return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
storedProcedureName: string, }
body: Types.SqlStoredProcedureCreateUpdateParameters
): Promise<Types.SqlStoredProcedureGetResults | void> { /* Create or update an Azure Cosmos DB SQL container */
const path = `/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`; export async function createUpdateSqlContainer(
return window subscriptionId: string,
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) resourceGroupName: string,
.then(response => response.json()); accountName: string,
} databaseName: string,
containerName: string,
/* Deletes an existing Azure Cosmos DB SQL storedProcedure. */ body: Types.SqlContainerCreateUpdateParameters
async deleteSqlStoredProcedure( ): Promise<Types.SqlContainerGetResults | void> {
databaseName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`;
containerName: string, return window
storedProcedureName: string .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
): Promise<void | void> { .then(response => response.json());
const path = `/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`; }
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
} /* Deletes an existing Azure Cosmos DB SQL container. */
export async function deleteSqlContainer(
/* Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. */ subscriptionId: string,
async getSqlContainerThroughput( resourceGroupName: string,
databaseName: string, accountName: string,
containerName: string databaseName: string,
): Promise<Types.ThroughputSettingsGetResults> { containerName: string
const path = `/${databaseName}/containers/${containerName}/throughputSettings/default`; ): Promise<void | void> {
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`;
} return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Update RUs per second of an Azure Cosmos DB SQL container */
async updateSqlContainerThroughput( /* Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. */
databaseName: string, export async function getSqlContainerThroughput(
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) }) ): Promise<Types.ThroughputSettingsGetResults> {
.then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`;
} return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Lists the SQL trigger under an existing Azure Cosmos DB database account. */
async listSqlTriggers(databaseName: string, containerName: string): Promise<Types.SqlTriggerListResult> { /* Update RUs per second of an Azure Cosmos DB SQL container */
const path = `/${databaseName}/containers/${containerName}/triggers`; export async function updateSqlContainerThroughput(
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); subscriptionId: string,
} resourceGroupName: string,
accountName: string,
/* Gets the SQL trigger under an existing Azure Cosmos DB database account. */ databaseName: string,
async getSqlTrigger( containerName: string,
databaseName: string, body: Types.ThroughputSettingsUpdateParameters
containerName: string, ): Promise<Types.ThroughputSettingsGetResults | void> {
triggerName: string const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`;
): Promise<Types.SqlTriggerGetResults> { return window
const path = `/${databaseName}/containers/${containerName}/triggers/${triggerName}`; .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); .then(response => response.json());
} }
/* Create or update an Azure Cosmos DB SQL trigger */ /* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */
async createUpdateSqlTrigger( export async function listSqlStoredProcedures(
databaseName: string, subscriptionId: string,
containerName: string, resourceGroupName: string,
triggerName: string, accountName: string,
body: Types.SqlTriggerCreateUpdateParameters databaseName: string,
): Promise<Types.SqlTriggerGetResults | void> { containerName: string
const path = `/${databaseName}/containers/${containerName}/triggers/${triggerName}`; ): Promise<Types.SqlStoredProcedureListResult> {
return window const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures`;
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
.then(response => response.json()); }
}
/* Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. */
/* Deletes an existing Azure Cosmos DB SQL trigger. */ export async function getSqlStoredProcedure(
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,
/* Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */ storedProcedureName: string
async listSqlUserDefinedFunctions( ): Promise<Types.SqlStoredProcedureGetResults> {
databaseName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
containerName: string return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
): Promise<Types.SqlUserDefinedFunctionListResult> { }
const path = `/${databaseName}/containers/${containerName}/userDefinedFunctions`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); /* Create or update an Azure Cosmos DB SQL storedProcedure */
} export async function createUpdateSqlStoredProcedure(
subscriptionId: string,
/* Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */ resourceGroupName: string,
async getSqlUserDefinedFunction( accountName: string,
databaseName: string, databaseName: string,
containerName: string, containerName: string,
userDefinedFunctionName: string storedProcedureName: string,
): Promise<Types.SqlUserDefinedFunctionGetResults> { body: Types.SqlStoredProcedureCreateUpdateParameters
const path = `/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`; ): Promise<Types.SqlStoredProcedureGetResults | void> {
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
} return window
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
/* Create or update an Azure Cosmos DB SQL userDefinedFunction */ .then(response => response.json());
async createUpdateSqlUserDefinedFunction( }
databaseName: string,
containerName: string, /* Deletes an existing Azure Cosmos DB SQL storedProcedure. */
userDefinedFunctionName: string, export async function deleteSqlStoredProcedure(
body: Types.SqlUserDefinedFunctionCreateUpdateParameters subscriptionId: string,
): Promise<Types.SqlUserDefinedFunctionGetResults | void> { resourceGroupName: string,
const path = `/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`; accountName: string,
return window databaseName: string,
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) containerName: string,
.then(response => response.json()); storedProcedureName: string
} ): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
/* Deletes an existing Azure Cosmos DB SQL userDefinedFunction. */ return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
async deleteSqlUserDefinedFunction( }
databaseName: string,
containerName: string, /* Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */
userDefinedFunctionName: string export async function listSqlUserDefinedFunctions(
): Promise<void | void> { subscriptionId: string,
const path = `/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`; resourceGroupName: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json()); accountName: string,
} databaseName: string,
containerName: string
/* Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. */ ): Promise<Types.SqlUserDefinedFunctionListResult> {
async getSqlDatabaseThroughput(databaseName: string): Promise<Types.ThroughputSettingsGetResults> { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions`;
const path = `/${databaseName}/throughputSettings/default`; return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
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. */
/* Update RUs per second of an Azure Cosmos DB SQL database */ export async function getSqlUserDefinedFunction(
async updateSqlDatabaseThroughput( subscriptionId: string,
databaseName: string, resourceGroupName: string,
body: Types.ThroughputSettingsUpdateParameters accountName: string,
): Promise<Types.ThroughputSettingsGetResults | void> { databaseName: string,
const path = `/${databaseName}/throughputSettings/default`; containerName: string,
return window userDefinedFunctionName: string
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) ): Promise<Types.SqlUserDefinedFunctionGetResults> {
.then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${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 */
export async function createUpdateSqlUserDefinedFunction(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
userDefinedFunctionName: string,
body: Types.SqlUserDefinedFunctionCreateUpdateParameters
): Promise<Types.SqlUserDefinedFunctionGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${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. */
export async function deleteSqlUserDefinedFunction(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
userDefinedFunctionName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Lists the SQL trigger under an existing Azure Cosmos DB database account. */
export async function listSqlTriggers(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string
): Promise<Types.SqlTriggerListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Gets the SQL trigger under an existing Azure Cosmos DB database account. */
export async function getSqlTrigger(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
triggerName: string
): Promise<Types.SqlTriggerGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB SQL trigger */
export async function createUpdateSqlTrigger(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
triggerName: string,
body: Types.SqlTriggerCreateUpdateParameters
): Promise<Types.SqlTriggerGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`;
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 trigger. */
export async function deleteSqlTrigger(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
triggerName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`;
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
} }

View File

@@ -6,59 +6,73 @@
import * as Types from "./types"; import * as Types from "./types";
export class TableResourcesClient { /* Lists the Tables under an existing Azure Cosmos DB database account. */
private readonly baseUrl = "https://management.azure.com"; export async function listTables(
private readonly basePath = `/subscriptions/${this.subscriptionId}/resourceGroups/${this.resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${this.accountName}/tables`; subscriptionId: string,
resourceGroupName: string,
constructor( accountName: string
private readonly subscriptionId: string, ): Promise<Types.TableListResult> {
private readonly resourceGroupName: string, const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables`;
private readonly accountName: string return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
) {} }
/* Lists the Tables under an existing Azure Cosmos DB database account. */ /* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */
async listTables(): Promise<Types.TableListResult> { export async function getTable(
const path = ``; subscriptionId: string,
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); resourceGroupName: string,
} accountName: string,
tableName: string
/* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */ ): Promise<Types.TableGetResults> {
async getTable(tableName: string): Promise<Types.TableGetResults> { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
const path = `/${tableName}`; return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
return window.fetch(this.baseUrl + this.basePath + path, { 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) }) const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
.then(response => response.json()); return window
} .fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
/* Deletes an existing Azure Cosmos DB Table. */ }
async deleteTable(tableName: string): Promise<void | void> {
const path = `/${tableName}`; /* Deletes an existing Azure Cosmos DB Table. */
return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json()); export async function deleteTable(
} subscriptionId: string,
resourceGroupName: string,
/* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */ accountName: string,
async getTableThroughput(tableName: string): Promise<Types.ThroughputSettingsGetResults> { tableName: string
const path = `/${tableName}/throughputSettings/default`; ): Promise<void | void> {
return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
} return window.fetch(this.baseUrl + this.basePath + path, { method: "delete" }).then(response => response.json());
}
/* Update RUs per second of an Azure Cosmos DB Table */
async updateTableThroughput( /* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */
tableName: string, export async function getTableThroughput(
body: Types.ThroughputSettingsUpdateParameters subscriptionId: string,
): Promise<Types.ThroughputSettingsGetResults | void> { resourceGroupName: string,
const path = `/${tableName}/throughputSettings/default`; accountName: string,
return window tableName: string
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) }) ): Promise<Types.ThroughputSettingsGetResults> {
.then(response => response.json()); const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`;
} return window.fetch(this.baseUrl + this.basePath + path, { method: "get" }).then(response => response.json());
}
/* Update RUs per second of an Azure Cosmos DB Table */
export async function updateTableThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
tableName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`;
return window
.fetch(this.baseUrl + this.basePath + path, { method: "put", body: JSON.stringify(body) })
.then(response => response.json());
} }

View File

@@ -191,11 +191,6 @@ async function main() {
for (const clientName in clients) { 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(`export class ${clientName}Client {\n\n`);
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 path of clients[clientName].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];
@@ -203,15 +198,15 @@ async function main() {
const bodyParameter = operation.parameters.find( const bodyParameter = operation.parameters.find(
(parameter: { in: string; required: boolean }) => parameter.in === "body" && parameter.required === true (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(` outputClient.push(`
/* ${operation.description} */ /* ${operation.description} */
async ${sanitize(camelize(methodName))} ( export async function ${sanitize(camelize(methodName))} (
${methodParameters.map(p => `${p}: string`).join(",\n")} ${parametersFromPath(path)
.map(p => `${p}: string`)
.join(",\n")}
${bodyParam(bodyParameter, "Types")} ${bodyParam(bodyParameter, "Types")}
) : Promise<${responseType(operation, "Types")}> { ) : Promise<${responseType(operation, "Types")}> {
const path = \`${path.replace(basePath, "").replace(/{/g, "${")}\` const path = \`${path.replace(/{/g, "${")}\`
return window.fetch(this.baseUrl + this.basePath + path, { method: "${method}", ${ return window.fetch(this.baseUrl + this.basePath + path, { method: "${method}", ${
bodyParameter ? "body: JSON.stringify(body)" : "" bodyParameter ? "body: JSON.stringify(body)" : ""
} }).then((response) => response.json()) } }).then((response) => response.json())
@@ -219,25 +214,12 @@ async function main() {
`); `);
} }
} }
outputClient.push(`}`);
writeOutputFile(`./${clientName}.ts`, outputClient); 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 sanitize(name: string) { function sanitize(name: string) {
if (name === "delete") { if (name === "delete") {
return "destroy"; return "destroy";
@@ -245,23 +227,6 @@ function sanitize(name: string) {
return name; return name;
} }
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