Compare commits

...

14 Commits

Author SHA1 Message Date
Steve Faulkner
6870bd9b54 Tweaks 2020-07-23 21:53:46 -05:00
Steve Faulkner
8aeff8fb45 Tweaks 2020-07-23 21:52:05 -05:00
Steve Faulkner
ee6f635458 Tweak 2020-07-23 19:03:43 -05:00
Steve Faulkner
ad115a2cce Functional version 2020-07-23 19:02:09 -05:00
Steve Faulkner
0c255a55c8 Fix strict 2020-07-23 18:40:55 -05:00
Steve Faulkner
08e84d93b5 Delete -> destory 2020-07-23 18:20:16 -05:00
Steve Faulkner
e2895b62b4 More updates 2020-07-23 18:18:58 -05:00
Steve Faulkner
155aacdf63 Sanitize usage of delete 2020-07-23 18:17:30 -05:00
Steve Faulkner
f4f2d00d7f More tweaks 2020-07-23 18:12:58 -05:00
Steve Faulkner
f1812077e9 Split up generators 2020-07-23 16:35:05 -05:00
Steve Faulkner
cfe9bd8303 More updates 2020-07-23 11:17:20 -05:00
Steve Faulkner
9db8d11801 Setup Namespaces 2020-07-22 22:40:29 -05:00
Steve Faulkner
769a2e7d1c more tweaks 2020-07-22 21:56:45 -05:00
Steve Faulkner
df544f88b2 First pass at a generated ARM client 2020-07-22 21:37:13 -05:00
25 changed files with 10870 additions and 90 deletions

167
package-lock.json generated
View File

@@ -6024,6 +6024,16 @@
"natural-compare": "^1.4.0",
"pretty-format": "^24.9.0",
"semver": "^6.2.0"
},
"dependencies": {
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
}
}
},
"jest-validate": {
@@ -7577,11 +7587,40 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
"dev": true
},
"@types/mkdirp": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
"integrity": "sha512-HkGSK7CGAXncr8Qn/0VqNtExEE+PHMWb+qlR1faHMao7ng6P3tAaoWWBMdva0gL5h4zprjIO89GJOLXsMcDm1Q==",
"requires": {
"@types/node": "*"
}
},
"@types/node": {
"version": "12.11.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.11.1.tgz",
"integrity": "sha512-TJtwsqZ39pqcljJpajeoofYRfeZ7/I/OMUQ5pR4q5wOKf2ocrUvBAZUMhWsOvKx3dVc/aaV5GluBivt0sWqA5A=="
},
"@types/node-fetch": {
"version": "2.5.7",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz",
"integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==",
"requires": {
"@types/node": "*",
"form-data": "^3.0.0"
},
"dependencies": {
"form-data": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz",
"integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"@types/normalize-package-data": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
@@ -8403,7 +8442,6 @@
"graceful-fs": "^4.1.11",
"lru-cache": "^4.1.1",
"mississippi": "^2.0.0",
"mkdirp": "^0.5.1",
"move-concurrently": "^1.0.1",
"promise-inflight": "^1.0.1",
"rimraf": "^2.6.2",
@@ -9342,6 +9380,15 @@
"pkg-dir": "^3.0.0"
}
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
},
"pify": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
@@ -10656,6 +10703,14 @@
"run-queue": "^1.0.0"
},
"dependencies": {
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
},
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@@ -19754,6 +19809,16 @@
"mkdirp": "^0.5.1",
"slash": "^2.0.0",
"source-map": "^0.6.0"
},
"dependencies": {
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
}
}
},
"jest-validate": {
@@ -20337,6 +20402,16 @@
"dev": true,
"optional": true
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"optional": true,
"requires": {
"minimist": "^1.2.5"
}
},
"promise": {
"version": "7.3.1",
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
@@ -21287,12 +21362,9 @@
}
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
"mkdirp-classic": {
"version": "0.5.3",
@@ -21338,6 +21410,14 @@
"run-queue": "^1.0.3"
},
"dependencies": {
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
},
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@@ -21677,6 +21757,14 @@
"tar": "^4"
},
"dependencies": {
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
},
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@@ -22576,6 +22664,15 @@
"requires": {
"ms": "^2.1.1"
}
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
}
}
},
@@ -25476,6 +25573,16 @@
"mkdirp": "^0.5.0",
"safe-buffer": "^5.1.2",
"yallist": "^3.0.3"
},
"dependencies": {
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
}
}
},
"tar-fs": {
@@ -25833,6 +25940,14 @@
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
},
"yargs-parser": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
@@ -26901,6 +27016,15 @@
"readable-stream": "^2.0.1"
}
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
},
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
@@ -27012,6 +27136,15 @@
"integrity": "sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==",
"dev": true
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
},
"ws": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
@@ -27224,6 +27357,15 @@
"readable-stream": "^2.0.1"
}
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
},
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
@@ -27531,6 +27673,17 @@
"dev": true,
"requires": {
"mkdirp": "^0.5.1"
},
"dependencies": {
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
}
}
},
"write-file-atomic": {

View File

@@ -34,6 +34,8 @@
"@nteract/transform-vega": "7.0.6",
"@octokit/rest": "17.9.2",
"@phosphor/widgets": "1.9.3",
"@types/mkdirp": "1.0.1",
"@types/node-fetch": "2.5.7",
"@uifabric/react-cards": "0.109.110",
"@uifabric/styling": "7.13.7",
"abort-controller": "3.0.0",
@@ -60,6 +62,7 @@
"jquery-typeahead": "2.10.6",
"jquery-ui-dist": "1.12.1",
"knockout": "3.5.1",
"mkdirp": "1.0.4",
"monaco-editor": "0.15.6",
"object.entries": "1.1.0",
"office-ui-fabric-react": "7.121.10",
@@ -147,6 +150,7 @@
"less-vars-loader": "1.1.0",
"mini-css-extract-plugin": "0.4.3",
"monaco-editor-webpack-plugin": "1.7.0",
"node-fetch": "2.6.0",
"prettier": "1.19.1",
"puppeteer": "4.0.0",
"raw-loader": "0.5.1",
@@ -187,7 +191,8 @@
"build:contracts": "npm run compile:contracts",
"strictEligibleFiles": "node ./strict-migration-tools/index.js",
"autoAddStrictEligibleFiles": "node ./strict-migration-tools/autoAdd.js",
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks"
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks",
"generateARMClients": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts"
},
"repository": {
"type": "git",

View File

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

View File

@@ -0,0 +1,43 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given database account and collection. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseRid: string,
collectionRid: string
): Promise<Types.MetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Retrieves the usages (most recent storage data) for the given collection. */
export async function listUsages(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseRid: string,
collectionRid: string
): Promise<Types.UsagesResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/usages`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Retrieves metric definitions for the given collection. */
export async function listMetricDefinitions(
subscriptionId: string,
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(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,31 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given collection, split by partition. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseRid: string,
collectionRid: string
): Promise<Types.PartitionMetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Retrieves the usages (most recent storage data) for the given collection, split by partition. */
export async function listUsages(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseRid: string,
collectionRid: string
): Promise<Types.PartitionUsagesResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/usages`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,20 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
region: string,
databaseRid: string,
collectionRid: string
): Promise<Types.PartitionMetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,20 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given database account, collection and region. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
region: string,
databaseRid: string,
collectionRid: string
): Promise<Types.MetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

40
src/Utils/arm/Database.ts Normal file
View File

@@ -0,0 +1,40 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given database account and database. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseRid: string
): Promise<Types.MetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Retrieves the usages (most recent data) for the given database. */
export async function listUsages(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseRid: string
): Promise<Types.UsagesResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/usages`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Retrieves metric definitions for the given database. */
export async function listMetricDefinitions(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseRid: string
): Promise<Types.MetricDefinitionsListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metricDefinitions`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,18 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given database account and region. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
region: string
): Promise<Types.MetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,184 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the properties of an existing Azure Cosmos DB database account. */
export async function get(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.DatabaseAccountGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Updates the properties of an existing Azure Cosmos DB database account. */
export async function update(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
body: Types.DatabaseAccountUpdateParameters
): Promise<Types.DatabaseAccountGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
return window.fetch(path, { method: "patch", body: JSON.stringify(body) }).then(response => response.json());
}
/* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */
export async function createOrUpdate(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
body: Types.DatabaseAccountCreateUpdateParameters
): Promise<Types.DatabaseAccountGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB database account. */
export async function destroy(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
return window.fetch(path, { method: "delete" }).then(response => response.json());
}
/* Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */
export async function failoverPriorityChange(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
body: Types.FailoverPolicies
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/failoverPriorityChange`;
return window.fetch(path, { method: "post", body: JSON.stringify(body) }).then(response => response.json());
}
/* Lists all the Azure Cosmos DB database accounts available under the subscription. */
export async function list(subscriptionId: string): Promise<Types.DatabaseAccountsListResult> {
const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Lists all the Azure Cosmos DB database accounts available under the given resource group. */
export async function listByResourceGroup(
subscriptionId: string,
resourceGroupName: string
): Promise<Types.DatabaseAccountsListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Lists the access keys for the specified Azure Cosmos DB database account. */
export async function listKeys(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.DatabaseAccountListKeysResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listKeys`;
return window.fetch(path, { method: "post" }).then(response => response.json());
}
/* Lists the connection strings for the specified Azure Cosmos DB database account. */
export async function listConnectionStrings(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.DatabaseAccountListConnectionStringsResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listConnectionStrings`;
return window.fetch(path, { method: "post" }).then(response => response.json());
}
/* Offline the specified region for the specified Azure Cosmos DB database account. */
export async function offlineRegion(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
body: Types.RegionForOnlineOffline
): Promise<void | void | Types.ErrorResponse> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/offlineRegion`;
return window.fetch(path, { method: "post", body: JSON.stringify(body) }).then(response => response.json());
}
/* Online the specified region for the specified Azure Cosmos DB database account. */
export async function onlineRegion(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
body: Types.RegionForOnlineOffline
): Promise<void | void | Types.ErrorResponse> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/onlineRegion`;
return window.fetch(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 getReadOnlyKeys(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */
export async function listReadOnlyKeys(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`;
return window.fetch(path, { method: "post" }).then(response => response.json());
}
/* Regenerates an access key for the specified Azure Cosmos DB database account. */
export async function regenerateKey(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
body: Types.DatabaseAccountRegenerateKeyParameters
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/regenerateKey`;
return window.fetch(path, { method: "post", body: JSON.stringify(body) }).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}`;
return window.fetch(path, { method: "head" }).then(response => response.json());
}
/* Retrieves the metrics determined by the given filter for the given database account. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.MetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Retrieves the usages (most recent data) for the given database account. */
export async function listUsages(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.UsagesResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/usages`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Retrieves metric definitions for the given database account. */
export async function listMetricDefinitions(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.MetricDefinitionsListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metricDefinitions`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,147 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */
export async function listGremlinDatabases(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.GremlinDatabaseListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. */
export async function getGremlinDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.GremlinDatabaseGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB Gremlin database */
export async function createUpdateGremlinDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
body: Types.GremlinDatabaseCreateUpdateParameters
): Promise<Types.GremlinDatabaseGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB Gremlin database. */
export async function deleteGremlinDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`;
return window.fetch(path, { method: "delete" }).then(response => response.json());
}
/* Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. */
export async function getGremlinDatabaseThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.ThroughputSettingsGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Update RUs per second of an Azure Cosmos DB Gremlin database */
export async function updateGremlinDatabaseThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Lists the Gremlin graph under an existing Azure Cosmos DB database account. */
export async function listGremlinGraphs(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.GremlinGraphListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the Gremlin graph under an existing Azure Cosmos DB database account. */
export async function getGremlinGraph(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
graphName: string
): Promise<Types.GremlinGraphGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB Gremlin graph */
export async function createUpdateGremlinGraph(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
graphName: string,
body: Types.GremlinGraphCreateUpdateParameters
): Promise<Types.GremlinGraphGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`;
return window.fetch(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(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(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(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}

View File

@@ -0,0 +1,147 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */
export async function listMongoDBDatabases(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.MongoDBDatabaseListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. */
export async function getMongoDBDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.MongoDBDatabaseGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Create or updates Azure Cosmos DB MongoDB database */
export async function createUpdateMongoDBDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
body: Types.MongoDBDatabaseCreateUpdateParameters
): Promise<Types.MongoDBDatabaseGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB MongoDB database. */
export async function deleteMongoDBDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`;
return window.fetch(path, { method: "delete" }).then(response => response.json());
}
/* Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. */
export async function getMongoDBDatabaseThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.ThroughputSettingsGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Update RUs per second of the an Azure Cosmos DB MongoDB database */
export async function updateMongoDBDatabaseThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Lists the MongoDB collection under an existing Azure Cosmos DB database account. */
export async function listMongoDBCollections(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.MongoDBCollectionListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the MongoDB collection under an existing Azure Cosmos DB database account. */
export async function getMongoDBCollection(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
collectionName: string
): Promise<Types.MongoDBCollectionGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB MongoDB Collection */
export async function createUpdateMongoDBCollection(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
collectionName: string,
body: Types.MongoDBCollectionCreateUpdateParameters
): Promise<Types.MongoDBCollectionGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`;
return window.fetch(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(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(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(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}

View File

@@ -0,0 +1,13 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Lists all of the available Cosmos DB Resource Provider operations. */
export async function list(): Promise<Types.OperationListResult> {
const path = `/providers/Microsoft.DocumentDB/operations`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,20 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given partition key range id. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseRid: string,
collectionRid: string,
partitionKeyRangeId: string
): Promise<Types.PartitionMetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,21 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given partition key range id and region. */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
region: string,
databaseRid: string,
collectionRid: string,
partitionKeyRangeId: string
): Promise<Types.PartitionMetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,17 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.PercentileMetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/percentile/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,19 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
sourceRegion: string,
targetRegion: string
): Promise<Types.PercentileMetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sourceRegion/${sourceRegion}/targetRegion/${targetRegion}/percentile/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,18 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data */
export async function listMetrics(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
targetRegion: string
): Promise<Types.PercentileMetricListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/targetRegion/${targetRegion}/percentile/metrics`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,34 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. */
export async function listByLocation(
subscriptionId: string,
location: string
): Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription. */
export async function list(
subscriptionId: string
): Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Retrieves the properties of an existing Azure Cosmos DB restorable database account. */
export async function getByLocation(
subscriptionId: string,
location: string,
instanceId: string
): Promise<Types.RestorableDatabaseAccountGetResult | Types.ErrorResponseUpdatedFormat> {
const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts/${instanceId}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}

View File

@@ -0,0 +1,303 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Lists the SQL databases under an existing Azure Cosmos DB database account. */
export async function listSqlDatabases(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.SqlDatabaseListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */
export async function getSqlDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.SqlDatabaseGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB SQL database */
export async function createUpdateSqlDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
body: Types.SqlDatabaseCreateUpdateParameters
): Promise<Types.SqlDatabaseGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB SQL database. */
export async function deleteSqlDatabase(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`;
return window.fetch(path, { method: "delete" }).then(response => response.json());
}
/* Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. */
export async function getSqlDatabaseThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.ThroughputSettingsGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Update RUs per second of an Azure Cosmos DB SQL database */
export async function updateSqlDatabaseThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Lists the SQL container under an existing Azure Cosmos DB database account. */
export async function listSqlContainers(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.SqlContainerListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the SQL container under an existing Azure Cosmos DB database account. */
export async function getSqlContainer(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string
): Promise<Types.SqlContainerGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB SQL container */
export async function createUpdateSqlContainer(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
body: Types.SqlContainerCreateUpdateParameters
): Promise<Types.SqlContainerGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB SQL container. */
export async function deleteSqlContainer(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`;
return window.fetch(path, { method: "delete" }).then(response => response.json());
}
/* Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. */
export async function getSqlContainerThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string
): Promise<Types.ThroughputSettingsGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Update RUs per second of an Azure Cosmos DB SQL container */
export async function updateSqlContainerThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
body: Types.ThroughputSettingsUpdateParameters
): Promise<Types.ThroughputSettingsGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */
export async function listSqlStoredProcedures(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string
): Promise<Types.SqlStoredProcedureListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. */
export async function getSqlStoredProcedure(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
storedProcedureName: string
): Promise<Types.SqlStoredProcedureGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB SQL storedProcedure */
export async function createUpdateSqlStoredProcedure(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
storedProcedureName: string,
body: Types.SqlStoredProcedureCreateUpdateParameters
): Promise<Types.SqlStoredProcedureGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB SQL storedProcedure. */
export async function deleteSqlStoredProcedure(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
storedProcedureName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`;
return window.fetch(path, { method: "delete" }).then(response => response.json());
}
/* Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */
export async function listSqlUserDefinedFunctions(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string
): Promise<Types.SqlUserDefinedFunctionListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */
export async function getSqlUserDefinedFunction(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
containerName: string,
userDefinedFunctionName: string
): Promise<Types.SqlUserDefinedFunctionGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`;
return window.fetch(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(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(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(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(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(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(path, { method: "delete" }).then(response => response.json());
}

View File

@@ -0,0 +1,74 @@
/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/
import * as Types from "./types";
/* Lists the Tables under an existing Azure Cosmos DB database account. */
export async function listTables(
subscriptionId: string,
resourceGroupName: string,
accountName: string
): Promise<Types.TableListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */
export async function getTable(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
tableName: string
): Promise<Types.TableGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
return window.fetch(path, { method: "get" }).then(response => response.json());
}
/* Create or update an Azure Cosmos DB Table */
export async function createUpdateTable(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
tableName: string,
body: Types.TableCreateUpdateParameters
): Promise<Types.TableGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
return window.fetch(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}
/* Deletes an existing Azure Cosmos DB Table. */
export async function deleteTable(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
tableName: string
): Promise<void | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`;
return window.fetch(path, { method: "delete" }).then(response => response.json());
}
/* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */
export async function getTableThroughput(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
tableName: string
): Promise<Types.ThroughputSettingsGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`;
return window.fetch(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(path, { method: "put", body: JSON.stringify(body) }).then(response => response.json());
}

1314
src/Utils/arm/types.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -75,6 +75,25 @@
"./src/Utils/MessageValidation.ts",
"./src/Utils/OfferUtils.ts",
"./src/Utils/StringUtils.ts",
"./src/Utils/arm/CassandraResources.ts",
"./src/Utils/arm/Collection.ts",
"./src/Utils/arm/CollectionPartition.ts",
"./src/Utils/arm/CollectionPartitionRegion.ts",
"./src/Utils/arm/CollectionRegion.ts",
"./src/Utils/arm/Database.ts",
"./src/Utils/arm/DatabaseAccountRegion.ts",
"./src/Utils/arm/GremlinResources.ts",
"./src/Utils/arm/MongoDBResources.ts",
"./src/Utils/arm/Operations.ts",
"./src/Utils/arm/PartitionKeyRangeId.ts",
"./src/Utils/arm/PartitionKeyRangeIdRegion.ts",
"./src/Utils/arm/Percentile.ts",
"./src/Utils/arm/PercentileSourceTarget.ts",
"./src/Utils/arm/PercentileTarget.ts",
"./src/Utils/arm/RestorableDatabaseAccounts.ts",
"./src/Utils/arm/SqlResources.ts",
"./src/Utils/arm/TableResources.ts",
"./src/Utils/arm/types.ts",
"./src/quickstart.ts",
"./src/setupTests.ts",
"./src/workers/upload/definitions.ts"

View File

@@ -0,0 +1,242 @@
/// <reference types="node" />
import { writeFileSync } from "fs";
import * as path from "path";
import fetch from "node-fetch";
import mkdirp from "mkdirp";
/*
Open API TypeScript Client Generator
This is a bespoke Open API client generator not intended for general public use.
It is not designed to handle the full OpenAPI spec.
Many other more general purpose generators exist, but their output is very verbose and overly complex for our use case.
But it does work well enough to generate a fully typed tree-shakeable client for the Cosmos resource provider.
Results of this file should be checked into the repo.
*/
// Array of strings to use for eventual output
const outputTypes: string[] = [""];
const schemaURL =
"https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/cosmos-db.json";
const outputDir = path.join(__dirname, "../../src/Utils/arm/");
mkdirp.sync(outputDir);
// Buckets for grouping operations based on their name
interface Client {
paths: string[];
functions: string[];
constructorParams: string[];
}
const clients: { [key: string]: Client } = {};
// Mapping for OpenAPI types to TypeScript types
const propertyMap: { [key: string]: string } = {
integer: "number"
};
// Converts a Open API reference: "#/definitions/Foo" to a type name: Foo
function refToType(path: string | undefined, namespace?: string) {
// References must be in the same file. Bail to `unknown` types for remote references
if (path && path.startsWith("#")) {
const type = path.split("/").pop();
return namespace ? `${namespace}.${type}` : type;
}
return "unknown";
}
// Converts "Something_Foo" -> "somethingFoo"
function camelize(str: string) {
return str
.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word: string, index: number) {
return index === 0 ? word.toLowerCase() : word.toUpperCase();
})
.replace(/\s+/g, "");
}
// Converts a body paramter to the equivalent typescript function parameter type
function bodyParam(parameter: { schema: { $ref: string } }, namespace: string) {
if (!parameter) {
return "";
}
return `,body: ${refToType(parameter.schema.$ref, namespace)}`;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function parametersFromPath(path: string) {
// TODO: Remove any. String.matchAll is a real thing.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const matches = (path as any).matchAll(/{(\w+)}/g);
return Array.from(matches).map((match: string[]) => match[1]);
}
type Operation = { responses: { [key: string]: { schema: { $ref: string } } } };
// Converts OpenAPI response definition to TypeScript return type. Uses unions if possible. Bails to unknown
function responseType(operation: Operation, namespace: string) {
if (operation.responses) {
return Object.keys(operation.responses)
.map((responseCode: string) => {
if (!operation.responses[responseCode].schema) {
return "void";
}
return refToType(operation.responses[responseCode].schema.$ref, namespace);
})
.join(" | ");
}
return "unknown";
}
async function main() {
const response = await fetch(schemaURL);
const schema = await response.json();
// STEP 1: Convert all definitions to TypeScript types and interfaces
for (const definition in schema.definitions) {
const properties = schema.definitions[definition].properties;
if (properties) {
if (schema.definitions[definition].allOf) {
const baseTypes = schema.definitions[definition].allOf
.map((allof: { $ref: string }) => refToType(allof.$ref))
.join(" & ");
outputTypes.push(`export type ${definition} = ${baseTypes} & {`);
} else {
outputTypes.push(`export interface ${definition} {`);
}
for (const prop in schema.definitions[definition].properties) {
const property = schema.definitions[definition].properties[prop];
if (property) {
if (property.$ref) {
const type = refToType(property.$ref);
outputTypes.push(`
/* ${property.description} */
${property.readOnly ? "readonly " : ""}${prop}: ${type}
`);
} else if (property.type === "array") {
const type = refToType(property.items.$ref);
outputTypes.push(`
/* ${property.description} */
${property.readOnly ? "readonly " : ""}${prop}: ${type}[]
`);
} else if (property.type === "object") {
const type = refToType(property.$ref);
outputTypes.push(`
/* ${property.description} */
${property.readOnly ? "readonly " : ""}${prop}: ${type}
`);
} else {
outputTypes.push(`
/* ${property.description} */
${property.readOnly ? "readonly " : ""}${prop}: ${
propertyMap[property.type] ? propertyMap[property.type] : property.type
}`);
}
}
}
outputTypes.push(`}`);
outputTypes.push("\n\n");
} else {
const def = schema.definitions[definition];
if (def.enum) {
outputTypes.push(`
/* ${def.description} */
export type ${definition} = ${def.enum.map((v: string) => `"${v}"`).join(" | ")}`);
outputTypes.push("\n");
} else if (def.type === "string") {
outputTypes.push(`
/* ${def.description} */
export type ${definition} = string
`);
} else if (def.type === "array") {
const type = refToType(def.items.$ref);
outputTypes.push(`
/* ${def.description} */
export type ${definition} = ${type}[]
`);
} else if (def.type === "object" && def.additionalProperties) {
outputTypes.push(`
/* ${def.description} */
export type ${definition} = { [key: string]: ${def.additionalProperties.type}}
`);
} else if (def.type === "object" && def.allOf) {
const type = refToType(def.allOf[0].$ref);
outputTypes.push(`
/* ${def.description} */
export type ${definition} = ${type}
`);
} else {
console.log("UNHANDLED MODEL:", def, schema.definitions[def]);
}
}
}
// STEP 2: Group all paths by output client and extract common constructor parameters
// Functions are grouped into clients based on operation name
for (const path in schema.paths) {
for (const method in schema.paths[path]) {
const operation = schema.paths[path][method];
const [namespace] = operation.operationId.split("_");
if (clients[namespace] === undefined) {
clients[namespace] = { paths: [], functions: [], constructorParams: [] };
clients[namespace];
}
if (!clients[namespace].paths.includes(path)) {
clients[namespace].paths.push(path);
}
}
}
// Write all grouped fetch functions to objects
for (const clientName in clients) {
const outputClient: string[] = [""];
outputClient.push(`import * as Types from "./types"\n\n`);
for (const path of clients[clientName].paths) {
for (const method in schema.paths[path]) {
const operation = schema.paths[path][method];
const [, methodName] = operation.operationId.split("_");
const bodyParameter = operation.parameters.find(
(parameter: { in: string; required: boolean }) => parameter.in === "body" && parameter.required === true
);
outputClient.push(`
/* ${operation.description} */
export async function ${sanitize(camelize(methodName))} (
${parametersFromPath(path)
.map(p => `${p}: string`)
.join(",\n")}
${bodyParam(bodyParameter, "Types")}
) : Promise<${responseType(operation, "Types")}> {
const path = \`${path.replace(/{/g, "${")}\`
return window.fetch(path, { method: "${method}", ${
bodyParameter ? "body: JSON.stringify(body)" : ""
} }).then((response) => response.json())
}
`);
}
}
writeOutputFile(`./${clientName}.ts`, outputClient);
}
writeOutputFile("./types.ts", outputTypes);
}
function sanitize(name: string) {
if (name === "delete") {
return "destroy";
}
return name;
}
function writeOutputFile(outputPath: string, components: string[]) {
components.unshift(`/*
AUTOGENERATED FILE
Do not manually edit
Run "npm run generateARMClients" to regenerate
*/\n\n`);
writeFileSync(path.join(outputDir, outputPath), components.join(""));
}
main().catch(e => {
console.error(e);
process.exit(1);
});

File diff suppressed because it is too large Load Diff