mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-21 11:47:14 +00:00
Split up generators
This commit is contained in:
parent
cfe9bd8303
commit
f1812077e9
146
package-lock.json
generated
146
package-lock.json
generated
@ -6024,6 +6024,16 @@
|
|||||||
"natural-compare": "^1.4.0",
|
"natural-compare": "^1.4.0",
|
||||||
"pretty-format": "^24.9.0",
|
"pretty-format": "^24.9.0",
|
||||||
"semver": "^6.2.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": {
|
"jest-validate": {
|
||||||
@ -7577,6 +7587,14 @@
|
|||||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
|
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
|
||||||
"dev": true
|
"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": {
|
"@types/node": {
|
||||||
"version": "12.11.1",
|
"version": "12.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.11.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.11.1.tgz",
|
||||||
@ -8424,7 +8442,6 @@
|
|||||||
"graceful-fs": "^4.1.11",
|
"graceful-fs": "^4.1.11",
|
||||||
"lru-cache": "^4.1.1",
|
"lru-cache": "^4.1.1",
|
||||||
"mississippi": "^2.0.0",
|
"mississippi": "^2.0.0",
|
||||||
"mkdirp": "^0.5.1",
|
|
||||||
"move-concurrently": "^1.0.1",
|
"move-concurrently": "^1.0.1",
|
||||||
"promise-inflight": "^1.0.1",
|
"promise-inflight": "^1.0.1",
|
||||||
"rimraf": "^2.6.2",
|
"rimraf": "^2.6.2",
|
||||||
@ -9363,6 +9380,15 @@
|
|||||||
"pkg-dir": "^3.0.0"
|
"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": {
|
"pify": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
|
||||||
@ -10677,6 +10703,14 @@
|
|||||||
"run-queue": "^1.0.0"
|
"run-queue": "^1.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"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": {
|
"rimraf": {
|
||||||
"version": "2.7.1",
|
"version": "2.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||||
@ -19775,6 +19809,16 @@
|
|||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"slash": "^2.0.0",
|
"slash": "^2.0.0",
|
||||||
"source-map": "^0.6.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": {
|
"jest-validate": {
|
||||||
@ -20358,6 +20402,16 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": 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": {
|
"promise": {
|
||||||
"version": "7.3.1",
|
"version": "7.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
|
||||||
@ -21308,12 +21362,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "0.5.5",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||||
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
|
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
|
||||||
"requires": {
|
|
||||||
"minimist": "^1.2.5"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"mkdirp-classic": {
|
"mkdirp-classic": {
|
||||||
"version": "0.5.3",
|
"version": "0.5.3",
|
||||||
@ -21359,6 +21410,14 @@
|
|||||||
"run-queue": "^1.0.3"
|
"run-queue": "^1.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"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": {
|
"rimraf": {
|
||||||
"version": "2.7.1",
|
"version": "2.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||||
@ -21698,6 +21757,14 @@
|
|||||||
"tar": "^4"
|
"tar": "^4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"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": {
|
"rimraf": {
|
||||||
"version": "2.7.1",
|
"version": "2.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||||
@ -22597,6 +22664,15 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"ms": "^2.1.1"
|
"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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -25497,6 +25573,16 @@
|
|||||||
"mkdirp": "^0.5.0",
|
"mkdirp": "^0.5.0",
|
||||||
"safe-buffer": "^5.1.2",
|
"safe-buffer": "^5.1.2",
|
||||||
"yallist": "^3.0.3"
|
"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": {
|
"tar-fs": {
|
||||||
@ -25854,6 +25940,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
|
||||||
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
|
"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": {
|
"yargs-parser": {
|
||||||
"version": "10.1.0",
|
"version": "10.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
|
||||||
@ -26922,6 +27016,15 @@
|
|||||||
"readable-stream": "^2.0.1"
|
"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": {
|
"readable-stream": {
|
||||||
"version": "2.3.7",
|
"version": "2.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||||
@ -27033,6 +27136,15 @@
|
|||||||
"integrity": "sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==",
|
"integrity": "sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==",
|
||||||
"dev": true
|
"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": {
|
"ws": {
|
||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||||
@ -27245,6 +27357,15 @@
|
|||||||
"readable-stream": "^2.0.1"
|
"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": {
|
"readable-stream": {
|
||||||
"version": "2.3.7",
|
"version": "2.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||||
@ -27552,6 +27673,17 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"mkdirp": "^0.5.1"
|
"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": {
|
"write-file-atomic": {
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
"@nteract/transform-vega": "7.0.6",
|
"@nteract/transform-vega": "7.0.6",
|
||||||
"@octokit/rest": "17.9.2",
|
"@octokit/rest": "17.9.2",
|
||||||
"@phosphor/widgets": "1.9.3",
|
"@phosphor/widgets": "1.9.3",
|
||||||
|
"@types/mkdirp": "1.0.1",
|
||||||
"@types/node-fetch": "2.5.7",
|
"@types/node-fetch": "2.5.7",
|
||||||
"@uifabric/react-cards": "0.109.110",
|
"@uifabric/react-cards": "0.109.110",
|
||||||
"@uifabric/styling": "7.13.7",
|
"@uifabric/styling": "7.13.7",
|
||||||
@ -61,6 +62,7 @@
|
|||||||
"jquery-typeahead": "2.10.6",
|
"jquery-typeahead": "2.10.6",
|
||||||
"jquery-ui-dist": "1.12.1",
|
"jquery-ui-dist": "1.12.1",
|
||||||
"knockout": "3.5.1",
|
"knockout": "3.5.1",
|
||||||
|
"mkdirp": "1.0.4",
|
||||||
"monaco-editor": "0.15.6",
|
"monaco-editor": "0.15.6",
|
||||||
"object.entries": "1.1.0",
|
"object.entries": "1.1.0",
|
||||||
"office-ui-fabric-react": "7.121.10",
|
"office-ui-fabric-react": "7.121.10",
|
||||||
@ -190,7 +192,7 @@
|
|||||||
"strictEligibleFiles": "node ./strict-migration-tools/index.js",
|
"strictEligibleFiles": "node ./strict-migration-tools/index.js",
|
||||||
"autoAddStrictEligibleFiles": "node ./strict-migration-tools/autoAdd.js",
|
"autoAddStrictEligibleFiles": "node ./strict-migration-tools/autoAdd.js",
|
||||||
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks",
|
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks",
|
||||||
"generateARMClient": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts"
|
"generateARMClients": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
167
src/Utils/arm/CassandraResources.ts
Normal file
167
src/Utils/arm/CassandraResources.ts
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getCassandraKeyspace (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string
|
||||||
|
|
||||||
|
) : Promise<Types.CassandraKeyspaceGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB Cassandra keyspace */
|
||||||
|
export async function createUpdateCassandraKeyspace (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string
|
||||||
|
,body: Types.CassandraKeyspaceCreateUpdateParameters
|
||||||
|
) : Promise<Types.CassandraKeyspaceGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB Cassandra keyspace. */
|
||||||
|
export async function deleteCassandraKeyspace (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string
|
||||||
|
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getCassandraKeyspaceThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RUs per second of an Azure Cosmos DB Cassandra Keyspace */
|
||||||
|
export async function updateCassandraKeyspaceThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the Cassandra table under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function listCassandraTables (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string
|
||||||
|
|
||||||
|
) : Promise<Types.CassandraTableListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the Cassandra table under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function getCassandraTable (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string,
|
||||||
|
tableName: string
|
||||||
|
|
||||||
|
) : Promise<Types.CassandraTableGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB Cassandra Table */
|
||||||
|
export async function createUpdateCassandraTable (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string,
|
||||||
|
tableName: string
|
||||||
|
,body: Types.CassandraTableCreateUpdateParameters
|
||||||
|
) : Promise<Types.CassandraTableGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getCassandraTableThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string,
|
||||||
|
tableName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RUs per second of an Azure Cosmos DB Cassandra table */
|
||||||
|
export async function updateCassandraTableThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
keyspaceName: string,
|
||||||
|
tableName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
49
src/Utils/arm/Collection.ts
Normal file
49
src/Utils/arm/Collection.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Retrieves the usages (most recent storage data) for the given collection. */
|
||||||
|
export async function listUsages (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseRid: string,
|
||||||
|
collectionRid: string
|
||||||
|
|
||||||
|
) : Promise<Types.UsagesResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/usages`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Retrieves metric definitions for the given collection. */
|
||||||
|
export async function listMetricDefinitions (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseRid: string,
|
||||||
|
collectionRid: string
|
||||||
|
|
||||||
|
) : Promise<Types.MetricDefinitionsListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metricDefinitions`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
35
src/Utils/arm/CollectionPartition.ts
Normal file
35
src/Utils/arm/CollectionPartition.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Retrieves the usages (most recent storage data) for the given collection, split by partition. */
|
||||||
|
export async function listUsages (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseRid: string,
|
||||||
|
collectionRid: string
|
||||||
|
|
||||||
|
) : Promise<Types.PartitionUsagesResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/usages`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
22
src/Utils/arm/CollectionPartitionRegion.ts
Normal file
22
src/Utils/arm/CollectionPartitionRegion.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
22
src/Utils/arm/CollectionRegion.ts
Normal file
22
src/Utils/arm/CollectionRegion.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
52
src/Utils/arm/Database.ts
Normal file
52
src/Utils/arm/Database.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window
|
||||||
|
.fetch(
|
||||||
|
`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metrics`,
|
||||||
|
{ method: "get" }
|
||||||
|
)
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieves the usages (most recent data) for the given database. */
|
||||||
|
export async function listUsages(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseRid: string
|
||||||
|
): Promise<Types.UsagesResult> {
|
||||||
|
return window
|
||||||
|
.fetch(
|
||||||
|
`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/usages`,
|
||||||
|
{ method: "get" }
|
||||||
|
)
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieves metric definitions for the given database. */
|
||||||
|
export async function listMetricDefinitions(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseRid: string
|
||||||
|
): Promise<Types.MetricDefinitionsListResult> {
|
||||||
|
return window
|
||||||
|
.fetch(
|
||||||
|
`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metricDefinitions`,
|
||||||
|
{ method: "get" }
|
||||||
|
)
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
22
src/Utils/arm/DatabaseAccountRegion.ts
Normal file
22
src/Utils/arm/DatabaseAccountRegion.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window
|
||||||
|
.fetch(
|
||||||
|
`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/metrics`,
|
||||||
|
{ method: "get" }
|
||||||
|
)
|
||||||
|
.then(response => response.json());
|
||||||
|
}
|
218
src/Utils/arm/DatabaseAccounts.ts
Normal file
218
src/Utils/arm/DatabaseAccounts.ts
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Updates the properties of an existing Azure Cosmos DB database account. */
|
||||||
|
export async function update (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
,body: Types.DatabaseAccountUpdateParameters
|
||||||
|
) : Promise<Types.DatabaseAccountGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "patch", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */
|
||||||
|
export async function createOrUpdate (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
,body: Types.DatabaseAccountCreateUpdateParameters
|
||||||
|
) : Promise<Types.DatabaseAccountGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB database account. */
|
||||||
|
export async function delete (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */
|
||||||
|
export async function failoverPriorityChange (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
,body: Types.FailoverPolicies
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/failoverPriorityChange`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists all the Azure Cosmos DB database accounts available under the subscription. */
|
||||||
|
export async function list (
|
||||||
|
subscriptionId: string
|
||||||
|
|
||||||
|
) : Promise<Types.DatabaseAccountsListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists all the Azure Cosmos DB database accounts available under the given resource group. */
|
||||||
|
export async function listByResourceGroup (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string
|
||||||
|
|
||||||
|
) : Promise<Types.DatabaseAccountsListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the access keys for the specified Azure Cosmos DB database account. */
|
||||||
|
export async function listKeys (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
|
||||||
|
) : Promise<Types.DatabaseAccountListKeysResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listKeys`, { method: "post", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the connection strings for the specified Azure Cosmos DB database account. */
|
||||||
|
export async function listConnectionStrings (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
|
||||||
|
) : Promise<Types.DatabaseAccountListConnectionStringsResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listConnectionStrings`, { method: "post", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Offline the specified region for the specified Azure Cosmos DB database account. */
|
||||||
|
export async function offlineRegion (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
,body: Types.RegionForOnlineOffline
|
||||||
|
) : Promise<void | void | Types.ErrorResponse> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/offlineRegion`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Online the specified region for the specified Azure Cosmos DB database account. */
|
||||||
|
export async function onlineRegion (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
,body: Types.RegionForOnlineOffline
|
||||||
|
) : Promise<void | void | Types.ErrorResponse> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/onlineRegion`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */
|
||||||
|
export async function getReadOnlyKeys (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
|
||||||
|
) : Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the read-only access keys for the specified Azure Cosmos DB database account. */
|
||||||
|
export async function listReadOnlyKeys (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
|
||||||
|
) : Promise<Types.DatabaseAccountListReadOnlyKeysResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`, { method: "post", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Regenerates an access key for the specified Azure Cosmos DB database account. */
|
||||||
|
export async function regenerateKey (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string
|
||||||
|
,body: Types.DatabaseAccountRegenerateKeyParameters
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/regenerateKey`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/providers/Microsoft.DocumentDB/databaseAccountNames/${accountName}`, { 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metrics`, { 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/usages`, { 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metricDefinitions`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
167
src/Utils/arm/GremlinResources.ts
Normal file
167
src/Utils/arm/GremlinResources.ts
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getGremlinDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.GremlinDatabaseGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB Gremlin database */
|
||||||
|
export async function createUpdateGremlinDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
,body: Types.GremlinDatabaseCreateUpdateParameters
|
||||||
|
) : Promise<Types.GremlinDatabaseGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB Gremlin database. */
|
||||||
|
export async function deleteGremlinDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getGremlinDatabaseThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RUs per second of an Azure Cosmos DB Gremlin database */
|
||||||
|
export async function updateGremlinDatabaseThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the Gremlin graph under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function listGremlinGraphs (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.GremlinGraphListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the Gremlin graph under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function getGremlinGraph (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
graphName: string
|
||||||
|
|
||||||
|
) : Promise<Types.GremlinGraphGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB Gremlin graph */
|
||||||
|
export async function createUpdateGremlinGraph (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
graphName: string
|
||||||
|
,body: Types.GremlinGraphCreateUpdateParameters
|
||||||
|
) : Promise<Types.GremlinGraphGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getGremlinGraphThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
graphName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RUs per second of an Azure Cosmos DB Gremlin graph */
|
||||||
|
export async function updateGremlinGraphThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
graphName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
167
src/Utils/arm/MongoDBResources.ts
Normal file
167
src/Utils/arm/MongoDBResources.ts
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getMongoDBDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.MongoDBDatabaseGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or updates Azure Cosmos DB MongoDB database */
|
||||||
|
export async function createUpdateMongoDBDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
,body: Types.MongoDBDatabaseCreateUpdateParameters
|
||||||
|
) : Promise<Types.MongoDBDatabaseGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB MongoDB database. */
|
||||||
|
export async function deleteMongoDBDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getMongoDBDatabaseThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RUs per second of the an Azure Cosmos DB MongoDB database */
|
||||||
|
export async function updateMongoDBDatabaseThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the MongoDB collection under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function listMongoDBCollections (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.MongoDBCollectionListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the MongoDB collection under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function getMongoDBCollection (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
collectionName: string
|
||||||
|
|
||||||
|
) : Promise<Types.MongoDBCollectionGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB MongoDB Collection */
|
||||||
|
export async function createUpdateMongoDBCollection (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
collectionName: string
|
||||||
|
,body: Types.MongoDBCollectionCreateUpdateParameters
|
||||||
|
) : Promise<Types.MongoDBCollectionGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getMongoDBCollectionThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
collectionName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update the RUs per second of an Azure Cosmos DB MongoDB collection */
|
||||||
|
export async function updateMongoDBCollectionThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
collectionName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
17
src/Utils/arm/Operations.ts
Normal file
17
src/Utils/arm/Operations.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/providers/Microsoft.DocumentDB/operations`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
22
src/Utils/arm/PartitionKeyRangeId.ts
Normal file
22
src/Utils/arm/PartitionKeyRangeId.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
23
src/Utils/arm/PartitionKeyRangeIdRegion.ts
Normal file
23
src/Utils/arm/PartitionKeyRangeIdRegion.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
19
src/Utils/arm/Percentile.ts
Normal file
19
src/Utils/arm/Percentile.ts
Normal 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 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/percentile/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
21
src/Utils/arm/PercentileSourceTarget.ts
Normal file
21
src/Utils/arm/PercentileSourceTarget.ts
Normal 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 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sourceRegion/${sourceRegion}/targetRegion/${targetRegion}/percentile/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
20
src/Utils/arm/PercentileTarget.ts
Normal file
20
src/Utils/arm/PercentileTarget.ts
Normal 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 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/targetRegion/${targetRegion}/percentile/metrics`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
40
src/Utils/arm/RestorableDatabaseAccounts.ts
Normal file
40
src/Utils/arm/RestorableDatabaseAccounts.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists all the restorable Azure Cosmos DB database accounts available under the subscription. */
|
||||||
|
export async function list (
|
||||||
|
subscriptionId: string
|
||||||
|
|
||||||
|
) : Promise<Types.RestorableDatabaseAccountsListResult | Types.ErrorResponseUpdatedFormat> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Retrieves the properties of an existing Azure Cosmos DB restorable database account. */
|
||||||
|
export async function getByLocation (
|
||||||
|
subscriptionId: string,
|
||||||
|
location: string,
|
||||||
|
instanceId: string
|
||||||
|
|
||||||
|
) : Promise<Types.RestorableDatabaseAccountGetResult | Types.ErrorResponseUpdatedFormat> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts/${instanceId}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
344
src/Utils/arm/SqlResources.ts
Normal file
344
src/Utils/arm/SqlResources.ts
Normal file
@ -0,0 +1,344 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getSqlDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.SqlDatabaseGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB SQL database */
|
||||||
|
export async function createUpdateSqlDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
,body: Types.SqlDatabaseCreateUpdateParameters
|
||||||
|
) : Promise<Types.SqlDatabaseGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB SQL database. */
|
||||||
|
export async function deleteSqlDatabase (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getSqlDatabaseThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RUs per second of an Azure Cosmos DB SQL database */
|
||||||
|
export async function updateSqlDatabaseThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the SQL container under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function listSqlContainers (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string
|
||||||
|
|
||||||
|
) : Promise<Types.SqlContainerListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the SQL container under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function getSqlContainer (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string
|
||||||
|
|
||||||
|
) : Promise<Types.SqlContainerGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB SQL container */
|
||||||
|
export async function createUpdateSqlContainer (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string
|
||||||
|
,body: Types.SqlContainerCreateUpdateParameters
|
||||||
|
) : Promise<Types.SqlContainerGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function getSqlContainerThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RUs per second of an Azure Cosmos DB SQL container */
|
||||||
|
export async function updateSqlContainerThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function listSqlStoredProcedures (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string
|
||||||
|
|
||||||
|
) : Promise<Types.SqlStoredProcedureListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function getSqlStoredProcedure (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
storedProcedureName: string
|
||||||
|
|
||||||
|
) : Promise<Types.SqlStoredProcedureGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB SQL storedProcedure */
|
||||||
|
export async function createUpdateSqlStoredProcedure (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
storedProcedureName: string
|
||||||
|
,body: Types.SqlStoredProcedureCreateUpdateParameters
|
||||||
|
) : Promise<Types.SqlStoredProcedureGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB SQL userDefinedFunction */
|
||||||
|
export async function createUpdateSqlUserDefinedFunction (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
userDefinedFunctionName: string
|
||||||
|
,body: Types.SqlUserDefinedFunctionCreateUpdateParameters
|
||||||
|
) : Promise<Types.SqlUserDefinedFunctionGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB SQL userDefinedFunction. */
|
||||||
|
export async function deleteSqlUserDefinedFunction (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
userDefinedFunctionName: string
|
||||||
|
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Lists the SQL trigger under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function listSqlTriggers (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string
|
||||||
|
|
||||||
|
) : Promise<Types.SqlTriggerListResult> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the SQL trigger under an existing Azure Cosmos DB database account. */
|
||||||
|
export async function getSqlTrigger (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
triggerName: string
|
||||||
|
|
||||||
|
) : Promise<Types.SqlTriggerGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB SQL trigger */
|
||||||
|
export async function createUpdateSqlTrigger (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
databaseName: string,
|
||||||
|
containerName: string,
|
||||||
|
triggerName: string
|
||||||
|
,body: Types.SqlTriggerCreateUpdateParameters
|
||||||
|
) : Promise<Types.SqlTriggerGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
84
src/Utils/arm/TableResources.ts
Normal file
84
src/Utils/arm/TableResources.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
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> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getTable (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
tableName: string
|
||||||
|
|
||||||
|
) : Promise<Types.TableGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create or update an Azure Cosmos DB Table */
|
||||||
|
export async function createUpdateTable (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
tableName: string
|
||||||
|
,body: Types.TableCreateUpdateParameters
|
||||||
|
) : Promise<Types.TableGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Deletes an existing Azure Cosmos DB Table. */
|
||||||
|
export async function deleteTable (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
tableName: string
|
||||||
|
|
||||||
|
) : Promise<void | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "delete", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */
|
||||||
|
export async function getTableThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
tableName: string
|
||||||
|
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`, { method: "get", }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RUs per second of an Azure Cosmos DB Table */
|
||||||
|
export async function updateTableThroughput (
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroupName: string,
|
||||||
|
accountName: string,
|
||||||
|
tableName: string
|
||||||
|
,body: Types.ThroughputSettingsUpdateParameters
|
||||||
|
) : Promise<Types.ThroughputSettingsGetResults | void> {
|
||||||
|
return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json())
|
||||||
|
}
|
||||||
|
|
1261
src/Utils/arm/types.ts
Normal file
1261
src/Utils/arm/types.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -75,6 +75,25 @@
|
|||||||
"./src/Utils/MessageValidation.ts",
|
"./src/Utils/MessageValidation.ts",
|
||||||
"./src/Utils/OfferUtils.ts",
|
"./src/Utils/OfferUtils.ts",
|
||||||
"./src/Utils/StringUtils.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/quickstart.ts",
|
||||||
"./src/setupTests.ts",
|
"./src/setupTests.ts",
|
||||||
"./src/workers/upload/definitions.ts"
|
"./src/workers/upload/definitions.ts"
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import { writeFileSync } from "fs";
|
import { writeFileSync } from "fs";
|
||||||
|
import * as path from "path";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
|
import mkdirp from "mkdirp";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Open API TypeScript Client Generator
|
Open API TypeScript Client Generator
|
||||||
|
|
||||||
This is a quickly made bespoke Open API 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.
|
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.
|
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.
|
But it does work well enough to generate a fully typed tree-shakeable client for the Cosmos resource provider.
|
||||||
@ -13,11 +15,14 @@ Results of this file should be checked into the repo.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Array of strings to use for eventual output
|
// Array of strings to use for eventual output
|
||||||
const output: string[] = [""];
|
const outputTypes: string[] = [""];
|
||||||
|
|
||||||
const schemaURL =
|
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";
|
"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
|
// Buckets for grouping operations based on their name
|
||||||
const namespaces: { [key: string]: string[] } = {};
|
const namespaces: { [key: string]: string[] } = {};
|
||||||
|
|
||||||
@ -27,10 +32,11 @@ const propertyMap: { [key: string]: string } = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Converts a Open API reference: "#/definitions/Foo" to a type name: Foo
|
// Converts a Open API reference: "#/definitions/Foo" to a type name: Foo
|
||||||
function refToType(path: string | undefined) {
|
function refToType(path: string | undefined, namespace?: string) {
|
||||||
// References must be in the same file. Bail to `unknown` types for remote references
|
// References must be in the same file. Bail to `unknown` types for remote references
|
||||||
if (path && path.startsWith("#")) {
|
if (path && path.startsWith("#")) {
|
||||||
return path.split("/").pop();
|
const type = path.split("/").pop();
|
||||||
|
return namespace ? `${namespace}.${type}` : type;
|
||||||
}
|
}
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
@ -45,11 +51,11 @@ function camelize(str: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Converts a body paramter to the equivalent typescript function parameter type
|
// Converts a body paramter to the equivalent typescript function parameter type
|
||||||
function bodyParam(parameter: { schema: { $ref: string } }) {
|
function bodyParam(parameter: { schema: { $ref: string } }, namespace: string) {
|
||||||
if (!parameter) {
|
if (!parameter) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return `,body: ${refToType(parameter.schema.$ref)}`;
|
return `,body: ${refToType(parameter.schema.$ref, namespace)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
@ -65,14 +71,14 @@ function parametersFromPath(path: string) {
|
|||||||
type Operation = { responses: { [key: string]: { schema: { $ref: string } } } };
|
type Operation = { responses: { [key: string]: { schema: { $ref: string } } } };
|
||||||
|
|
||||||
// Converts OpenAPI response definition to TypeScript return type. Uses unions if possible. Bails to unknown
|
// Converts OpenAPI response definition to TypeScript return type. Uses unions if possible. Bails to unknown
|
||||||
function responseType(operation: Operation) {
|
function responseType(operation: Operation, namespace: string) {
|
||||||
if (operation.responses) {
|
if (operation.responses) {
|
||||||
return Object.keys(operation.responses)
|
return Object.keys(operation.responses)
|
||||||
.map((responseCode: string) => {
|
.map((responseCode: string) => {
|
||||||
if (!operation.responses[responseCode].schema) {
|
if (!operation.responses[responseCode].schema) {
|
||||||
return "void";
|
return "void";
|
||||||
}
|
}
|
||||||
return refToType(operation.responses[responseCode].schema.$ref);
|
return refToType(operation.responses[responseCode].schema.$ref, namespace);
|
||||||
})
|
})
|
||||||
.join(" | ");
|
.join(" | ");
|
||||||
}
|
}
|
||||||
@ -91,33 +97,33 @@ async function main() {
|
|||||||
const baseTypes = schema.definitions[definition].allOf
|
const baseTypes = schema.definitions[definition].allOf
|
||||||
.map((allof: { $ref: string }) => refToType(allof.$ref))
|
.map((allof: { $ref: string }) => refToType(allof.$ref))
|
||||||
.join(" & ");
|
.join(" & ");
|
||||||
output.push(`type ${definition} = ${baseTypes} & {`);
|
outputTypes.push(`export type ${definition} = ${baseTypes} & {`);
|
||||||
} else {
|
} else {
|
||||||
output.push(`interface ${definition} {`);
|
outputTypes.push(`export interface ${definition} {`);
|
||||||
}
|
}
|
||||||
for (const prop in schema.definitions[definition].properties) {
|
for (const prop in schema.definitions[definition].properties) {
|
||||||
const property = schema.definitions[definition].properties[prop];
|
const property = schema.definitions[definition].properties[prop];
|
||||||
if (property) {
|
if (property) {
|
||||||
if (property.$ref) {
|
if (property.$ref) {
|
||||||
const type = refToType(property.$ref);
|
const type = refToType(property.$ref);
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${property.description} */
|
/* ${property.description} */
|
||||||
${property.readOnly ? "readonly " : ""}${prop}: ${type}
|
${property.readOnly ? "readonly " : ""}${prop}: ${type}
|
||||||
`);
|
`);
|
||||||
} else if (property.type === "array") {
|
} else if (property.type === "array") {
|
||||||
const type = refToType(property.items.$ref);
|
const type = refToType(property.items.$ref);
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${property.description} */
|
/* ${property.description} */
|
||||||
${property.readOnly ? "readonly " : ""}${prop}: ${type}[]
|
${property.readOnly ? "readonly " : ""}${prop}: ${type}[]
|
||||||
`);
|
`);
|
||||||
} else if (property.type === "object") {
|
} else if (property.type === "object") {
|
||||||
const type = refToType(property.$ref);
|
const type = refToType(property.$ref);
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${property.description} */
|
/* ${property.description} */
|
||||||
${property.readOnly ? "readonly " : ""}${prop}: ${type}
|
${property.readOnly ? "readonly " : ""}${prop}: ${type}
|
||||||
`);
|
`);
|
||||||
} else {
|
} else {
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${property.description} */
|
/* ${property.description} */
|
||||||
${property.readOnly ? "readonly " : ""}${prop}: ${
|
${property.readOnly ? "readonly " : ""}${prop}: ${
|
||||||
propertyMap[property.type] ? propertyMap[property.type] : property.type
|
propertyMap[property.type] ? propertyMap[property.type] : property.type
|
||||||
@ -125,36 +131,36 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output.push(`}`);
|
outputTypes.push(`}`);
|
||||||
output.push("\n\n");
|
outputTypes.push("\n\n");
|
||||||
} else {
|
} else {
|
||||||
const def = schema.definitions[definition];
|
const def = schema.definitions[definition];
|
||||||
if (def.enum) {
|
if (def.enum) {
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${def.description} */
|
/* ${def.description} */
|
||||||
type ${definition} = ${def.enum.map((v: string) => `"${v}"`).join(" | ")}`);
|
export type ${definition} = ${def.enum.map((v: string) => `"${v}"`).join(" | ")}`);
|
||||||
output.push("\n");
|
outputTypes.push("\n");
|
||||||
} else if (def.type === "string") {
|
} else if (def.type === "string") {
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${def.description} */
|
/* ${def.description} */
|
||||||
type ${definition} = string
|
export type ${definition} = string
|
||||||
`);
|
`);
|
||||||
} else if (def.type === "array") {
|
} else if (def.type === "array") {
|
||||||
const type = refToType(def.items.$ref);
|
const type = refToType(def.items.$ref);
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${def.description} */
|
/* ${def.description} */
|
||||||
type ${definition} = ${type}[]
|
export type ${definition} = ${type}[]
|
||||||
`);
|
`);
|
||||||
} else if (def.type === "object" && def.additionalProperties) {
|
} else if (def.type === "object" && def.additionalProperties) {
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${def.description} */
|
/* ${def.description} */
|
||||||
type ${definition} = { [key: string]: ${def.additionalProperties.type}}
|
export type ${definition} = { [key: string]: ${def.additionalProperties.type}}
|
||||||
`);
|
`);
|
||||||
} else if (def.type === "object" && def.allOf) {
|
} else if (def.type === "object" && def.allOf) {
|
||||||
const type = refToType(def.allOf[0].$ref);
|
const type = refToType(def.allOf[0].$ref);
|
||||||
output.push(`
|
outputTypes.push(`
|
||||||
/* ${def.description} */
|
/* ${def.description} */
|
||||||
type ${definition} = ${type}
|
export type ${definition} = ${type}
|
||||||
`);
|
`);
|
||||||
} else {
|
} else {
|
||||||
console.log("UNHANDLED MODEL:", def, schema.definitions[def]);
|
console.log("UNHANDLED MODEL:", def, schema.definitions[def]);
|
||||||
@ -176,10 +182,10 @@ async function main() {
|
|||||||
}
|
}
|
||||||
namespaces[namespace].push(`
|
namespaces[namespace].push(`
|
||||||
/* ${operation.description} */
|
/* ${operation.description} */
|
||||||
async ${camelize(operationName)} (
|
export async function ${camelize(operationName)} (
|
||||||
${parametersFromPath(path)}
|
${parametersFromPath(path)}
|
||||||
${bodyParam(bodyParameter)}
|
${bodyParam(bodyParameter, "Types")}
|
||||||
) : Promise<${responseType(operation)}> {
|
) : Promise<${responseType(operation, "Types")}> {
|
||||||
return window.fetch(\`https://management.azure.com${path.replace(/{/g, "${")}\`, { method: "${method}", ${
|
return window.fetch(\`https://management.azure.com${path.replace(/{/g, "${")}\`, { method: "${method}", ${
|
||||||
bodyParameter ? "body: JSON.stringify(body)" : ""
|
bodyParameter ? "body: JSON.stringify(body)" : ""
|
||||||
} }).then((response) => response.json())
|
} }).then((response) => response.json())
|
||||||
@ -190,12 +196,22 @@ async function main() {
|
|||||||
|
|
||||||
// Write all grouped fetch functions to objects
|
// Write all grouped fetch functions to objects
|
||||||
for (const namespace in namespaces) {
|
for (const namespace in namespaces) {
|
||||||
output.push(`export const ${namespace} = {`);
|
const outputClient: string[] = [""];
|
||||||
output.push(namespaces[namespace].join(",\n"));
|
outputClient.push(`import * as Types from "./types"\n\n`);
|
||||||
output.push(`}\n`);
|
outputClient.push(namespaces[namespace].join("\n\n"));
|
||||||
|
writeOutputFile(`./${namespace}.ts`, outputClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeFileSync("./client.ts", output.join(""));
|
writeOutputFile("./types.ts", outputTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 => {
|
main().catch(e => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user