reservations-resourcegraph-resourcemover-serialconsole-servicemap-signalr-storagecache-storagesync-track2 (#19962)
* reservations-release * resourcemover * serialconsole-release * servicemap * signalr-relesae * storagecache * reservations-resourcegraph-resourcemover-serialconsole-servicemap-signalr-storagecache-storagesync-track2 * resourcegraph * update
This commit is contained in:
Родитель
7e89b2288e
Коммит
bc742d50bb
|
@ -110,17 +110,25 @@ specifiers:
|
|||
'@rush-temp/arm-rediscache': file:./projects/arm-rediscache.tgz
|
||||
'@rush-temp/arm-redisenterprisecache': file:./projects/arm-redisenterprisecache.tgz
|
||||
'@rush-temp/arm-relay': file:./projects/arm-relay.tgz
|
||||
'@rush-temp/arm-reservations': file:./projects/arm-reservations.tgz
|
||||
'@rush-temp/arm-resourcegraph': file:./projects/arm-resourcegraph.tgz
|
||||
'@rush-temp/arm-resourcehealth': file:./projects/arm-resourcehealth.tgz
|
||||
'@rush-temp/arm-resourcemover': file:./projects/arm-resourcemover.tgz
|
||||
'@rush-temp/arm-resources': file:./projects/arm-resources.tgz
|
||||
'@rush-temp/arm-resources-subscriptions': file:./projects/arm-resources-subscriptions.tgz
|
||||
'@rush-temp/arm-search': file:./projects/arm-search.tgz
|
||||
'@rush-temp/arm-security': file:./projects/arm-security.tgz
|
||||
'@rush-temp/arm-securityinsight': file:./projects/arm-securityinsight.tgz
|
||||
'@rush-temp/arm-serialconsole': file:./projects/arm-serialconsole.tgz
|
||||
'@rush-temp/arm-servicebus': file:./projects/arm-servicebus.tgz
|
||||
'@rush-temp/arm-servicefabric': file:./projects/arm-servicefabric.tgz
|
||||
'@rush-temp/arm-servicemap': file:./projects/arm-servicemap.tgz
|
||||
'@rush-temp/arm-signalr': file:./projects/arm-signalr.tgz
|
||||
'@rush-temp/arm-sql': file:./projects/arm-sql.tgz
|
||||
'@rush-temp/arm-sqlvirtualmachine': file:./projects/arm-sqlvirtualmachine.tgz
|
||||
'@rush-temp/arm-storage': file:./projects/arm-storage.tgz
|
||||
'@rush-temp/arm-storagecache': file:./projects/arm-storagecache.tgz
|
||||
'@rush-temp/arm-storagesync': file:./projects/arm-storagesync.tgz
|
||||
'@rush-temp/arm-streamanalytics': file:./projects/arm-streamanalytics.tgz
|
||||
'@rush-temp/arm-subscriptions': file:./projects/arm-subscriptions.tgz
|
||||
'@rush-temp/arm-synapse': file:./projects/arm-synapse.tgz
|
||||
|
@ -342,17 +350,25 @@ dependencies:
|
|||
'@rush-temp/arm-rediscache': file:projects/arm-rediscache.tgz
|
||||
'@rush-temp/arm-redisenterprisecache': file:projects/arm-redisenterprisecache.tgz
|
||||
'@rush-temp/arm-relay': file:projects/arm-relay.tgz
|
||||
'@rush-temp/arm-reservations': file:projects/arm-reservations.tgz
|
||||
'@rush-temp/arm-resourcegraph': file:projects/arm-resourcegraph.tgz
|
||||
'@rush-temp/arm-resourcehealth': file:projects/arm-resourcehealth.tgz
|
||||
'@rush-temp/arm-resourcemover': file:projects/arm-resourcemover.tgz
|
||||
'@rush-temp/arm-resources': file:projects/arm-resources.tgz
|
||||
'@rush-temp/arm-resources-subscriptions': file:projects/arm-resources-subscriptions.tgz
|
||||
'@rush-temp/arm-search': file:projects/arm-search.tgz
|
||||
'@rush-temp/arm-security': file:projects/arm-security.tgz
|
||||
'@rush-temp/arm-securityinsight': file:projects/arm-securityinsight.tgz
|
||||
'@rush-temp/arm-serialconsole': file:projects/arm-serialconsole.tgz
|
||||
'@rush-temp/arm-servicebus': file:projects/arm-servicebus.tgz
|
||||
'@rush-temp/arm-servicefabric': file:projects/arm-servicefabric.tgz
|
||||
'@rush-temp/arm-servicemap': file:projects/arm-servicemap.tgz
|
||||
'@rush-temp/arm-signalr': file:projects/arm-signalr.tgz
|
||||
'@rush-temp/arm-sql': file:projects/arm-sql.tgz
|
||||
'@rush-temp/arm-sqlvirtualmachine': file:projects/arm-sqlvirtualmachine.tgz
|
||||
'@rush-temp/arm-storage': file:projects/arm-storage.tgz
|
||||
'@rush-temp/arm-storagecache': file:projects/arm-storagecache.tgz
|
||||
'@rush-temp/arm-storagesync': file:projects/arm-storagesync.tgz
|
||||
'@rush-temp/arm-streamanalytics': file:projects/arm-streamanalytics.tgz
|
||||
'@rush-temp/arm-subscriptions': file:projects/arm-subscriptions.tgz
|
||||
'@rush-temp/arm-synapse': file:projects/arm-synapse.tgz
|
||||
|
@ -11190,6 +11206,56 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-reservations.tgz:
|
||||
resolution: {integrity: sha512-3W8+jfJsjrwXC+hllrUv2+vWu1ePqVcZyaVwUck8IQjlQ48QRBrbg8DQRlYUWxEV3jQevqv+qyVnGCkFzza86Q==, tarball: file:projects/arm-reservations.tgz}
|
||||
name: '@rush-temp/arm-reservations'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@microsoft/api-extractor': 7.19.4
|
||||
'@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@1.32.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 1.32.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.14.5
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-resourcegraph.tgz:
|
||||
resolution: {integrity: sha512-76aD1wFiDz2tO2T/G0Mhx95UvRGRI0pOYLQvo7PmCCOhU4LBxF2qG6Q+PsIfxbzbOmufYsMCn8t4TeH0ok/mkA==, tarball: file:projects/arm-resourcegraph.tgz}
|
||||
name: '@rush-temp/arm-resourcegraph'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@microsoft/api-extractor': 7.19.4
|
||||
'@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@1.32.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 1.32.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.14.5
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-resourcehealth.tgz:
|
||||
resolution: {integrity: sha512-ssLCh8GgbsVtwLFyE5qlPtC6OjpWdCtYeIbKxvNKerfJOMH/Vb15Osy2TMpWEvUmLPSSeyiRXz5ZBMYg+AKK5g==, tarball: file:projects/arm-resourcehealth.tgz}
|
||||
name: '@rush-temp/arm-resourcehealth'
|
||||
|
@ -11215,6 +11281,31 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-resourcemover.tgz:
|
||||
resolution: {integrity: sha512-ZIqOtcTkGKQrl2gsE7UibEgBu3B8cRnDRXZrlZu2m5HRd03ULoMPKGDhWeoCot0CZq7rTin3jZ/JM9ueg2DLmQ==, tarball: file:projects/arm-resourcemover.tgz}
|
||||
name: '@rush-temp/arm-resourcemover'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@microsoft/api-extractor': 7.19.4
|
||||
'@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@1.32.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 1.32.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.14.5
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-resources-subscriptions.tgz:
|
||||
resolution: {integrity: sha512-Y8XL95tGixEM0br4pDJgRVqqa4CZWJRbu1SGkBtHZNKbpJ1aU3OXeei1dk84bEtu+FvjDh3j2QOFKKhnMoSFgA==, tarball: file:projects/arm-resources-subscriptions.tgz}
|
||||
name: '@rush-temp/arm-resources-subscriptions'
|
||||
|
@ -11340,6 +11431,31 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-serialconsole.tgz:
|
||||
resolution: {integrity: sha512-sDmYrBhQPPUMsQmmkYwAk3uimeBXnxkpCYrNjU1AWuIBMlkEkpLdVoR2t6B/0At7TqvxVJuFRlWjZabYsMKX4g==, tarball: file:projects/arm-serialconsole.tgz}
|
||||
name: '@rush-temp/arm-serialconsole'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@microsoft/api-extractor': 7.19.4
|
||||
'@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@1.32.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 1.32.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.14.5
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-servicebus.tgz:
|
||||
resolution: {integrity: sha512-xUyJSlaPZccUpQ99rOf2TIUziaa7K1Ch4vcz0Jp+Dj/eam95rdQFtidaAoubJTI+Wcom0OsKDHWVqLbUyS8GpA==, tarball: file:projects/arm-servicebus.tgz}
|
||||
name: '@rush-temp/arm-servicebus'
|
||||
|
@ -11390,6 +11506,56 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-servicemap.tgz:
|
||||
resolution: {integrity: sha512-Y8Q9PXQu+1Piyy9trUSdIgpFJWoPNbyg4HI2WT5Y0Dy2bOIMOGu78n1hSGenwXtBJ4KqX5U6fkZkR0k/X8mZoA==, tarball: file:projects/arm-servicemap.tgz}
|
||||
name: '@rush-temp/arm-servicemap'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@microsoft/api-extractor': 7.19.4
|
||||
'@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@1.32.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 1.32.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.14.5
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-signalr.tgz:
|
||||
resolution: {integrity: sha512-MQjQG3zQ9rZktJJr2gdGGF8EMaQGgAntAXTqcwzaQAVbi3J4jDo2DDfvxo5MWP5Ptv2cZlL9TbrReu0GKmMgRg==, tarball: file:projects/arm-signalr.tgz}
|
||||
name: '@rush-temp/arm-signalr'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@microsoft/api-extractor': 7.19.4
|
||||
'@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@1.32.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 1.32.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.14.5
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-sql.tgz:
|
||||
resolution: {integrity: sha512-CEtDIxHX9rKD5MgweS7t+aOwxGDS8ozHLc5Ur5POzatrFrpSFF37FeM7rT80sdAuG/YVfRVq0VCQZ5OXr18GLw==, tarball: file:projects/arm-sql.tgz}
|
||||
name: '@rush-temp/arm-sql'
|
||||
|
@ -11467,6 +11633,56 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-storagecache.tgz:
|
||||
resolution: {integrity: sha512-59403AImIIuWQutODkwlYLprQ9XdenZ0r8LGxR+WQUE+41BVpdNp6yYdUh0aX6A9aS7y9aP4b4xYpp/miQprbw==, tarball: file:projects/arm-storagecache.tgz}
|
||||
name: '@rush-temp/arm-storagecache'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@microsoft/api-extractor': 7.19.4
|
||||
'@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@1.32.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 1.32.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.14.5
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-storagesync.tgz:
|
||||
resolution: {integrity: sha512-P6CH4ZGJgS6t6K9jdc72GjLv3HFXrUIYyoax20RTHxe7MMLep6ChwehcKF8RpYH4BUEJTHiMEVRGI0Lt6DP6Gw==, tarball: file:projects/arm-storagesync.tgz}
|
||||
name: '@rush-temp/arm-storagesync'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@microsoft/api-extractor': 7.19.4
|
||||
'@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@1.32.1
|
||||
'@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1
|
||||
'@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1
|
||||
cross-env: 7.0.3
|
||||
mkdirp: 1.0.4
|
||||
mocha: 7.2.0
|
||||
rimraf: 3.0.2
|
||||
rollup: 1.32.1
|
||||
rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.14.5
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/arm-streamanalytics.tgz:
|
||||
resolution: {integrity: sha512-anS7TXMqYdobBqt4VnMVXs6geNykd9Wod2fgz7EEfpPT4lMmA2I9MSeBA+zAZp5JvmuiWS+2SRFhjmfwWRFIzA==, tarball: file:projects/arm-streamanalytics.tgz}
|
||||
name: '@rush-temp/arm-streamanalytics'
|
||||
|
|
|
@ -28,3 +28,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-peering
|
|||
https://docs.microsoft.com/javascript/api/@azure/arm-peering?view=azure-node-preview
|
||||
https://docs.microsoft.com/javascript/api/@azure/arm-postgresql-flexible
|
||||
https://docs.microsoft.com/javascript/api/@azure/arm-postgresql-flexible?view=azure-node-preview
|
||||
https://docs.microsoft.com/javascript/api/@azure/arm-serialconsole
|
||||
|
|
44
rush.json
44
rush.json
|
@ -1468,7 +1468,47 @@
|
|||
},
|
||||
{
|
||||
"packageName": "@azure/arm-redisenterprisecache",
|
||||
"projectFolder": "sdk/redisenterprise/arm-redisenterprisecache",
|
||||
"projectFolder": "sdk/redisenterprise/arm-redisenterprisecache"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-reservations",
|
||||
"projectFolder": "sdk/reservations/arm-reservations",
|
||||
"versionPolicyName": "management"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-resourcemover",
|
||||
"projectFolder": "sdk/resourcemover/arm-resourcemover",
|
||||
"versionPolicyName": "management"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-serialconsole",
|
||||
"projectFolder": "sdk/serialconsole/arm-serialconsole",
|
||||
"versionPolicyName": "management"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-servicemap",
|
||||
"projectFolder": "sdk/service-map/arm-servicemap",
|
||||
"versionPolicyName": "management"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-signalr",
|
||||
"projectFolder": "sdk/signalr/arm-signalr",
|
||||
"versionPolicyName": "management"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-storagecache",
|
||||
"projectFolder": "sdk/storagecache/arm-storagecache",
|
||||
"versionPolicyName": "management"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-storagesync",
|
||||
"projectFolder": "sdk/storagesync/arm-storagesync",
|
||||
"versionPolicyName": "management"
|
||||
},
|
||||
{
|
||||
"packageName": "@azure/arm-resourcegraph",
|
||||
"projectFolder": "sdk/resourcegraph/arm-resourcegraph",
|
||||
"versionPolicyName": "management"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
# Release History
|
||||
|
||||
## 7.0.0 (2022-01-21)
|
||||
|
||||
The package of @azure/arm-reservations is using our next generation design principles since version 7.0.0, which contains breaking changes.
|
||||
|
||||
To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog).
|
||||
|
||||
To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide).
|
||||
|
||||
To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 Microsoft
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,103 +1,98 @@
|
|||
## Azure AzureReservationAPI SDK for JavaScript
|
||||
# Azure Service client library for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for AzureReservationAPI.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client.
|
||||
|
||||
This API describe Azure Reservation
|
||||
|
||||
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations) |
|
||||
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-reservations) |
|
||||
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-reservations) |
|
||||
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
|
||||
|
||||
## Getting started
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
- Latest versions of Safari, Chrome, Edge and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
- An [Azure subscription][azure_sub].
|
||||
|
||||
### Install the `@azure/arm-reservations` package
|
||||
|
||||
Install the Azure Service client library for JavaScript with `npm`:
|
||||
|
||||
```bash
|
||||
npm install @azure/arm-reservations
|
||||
```
|
||||
|
||||
### How to use
|
||||
### Create and authenticate a `AzureReservationAPI`
|
||||
|
||||
#### nodejs - Authentication, client creation and get quota as an example written in TypeScript.
|
||||
To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate.
|
||||
You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal].
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
|
||||
|
||||
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
|
||||
|
||||
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth@"^3.0.0"
|
||||
npm install @azure/identity
|
||||
```
|
||||
|
||||
##### Sample code
|
||||
You will also need to **register a new AAD application and grant access to Azure Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
|
||||
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
|
||||
|
||||
For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
|
||||
|
||||
```javascript
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { interactiveLogin } = require("@azure/ms-rest-nodeauth");
|
||||
|
||||
interactiveLogin().then((creds) => {
|
||||
const client = new AzureReservationAPI(creds);
|
||||
const subscriptionId = "testsubscriptionId";
|
||||
const providerId = "testproviderId";
|
||||
const location = "westus";
|
||||
const resourceName = "testresourceName";
|
||||
client.quota.get(subscriptionId, providerId, location, resourceName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const client = new AzureReservationAPI(new DefaultAzureCredential(), subscriptionId);
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and get quota as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
### JavaScript Bundle
|
||||
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
## Key concepts
|
||||
|
||||
### AzureReservationAPI
|
||||
|
||||
`AzureReservationAPI` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service service that you can access.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Logging
|
||||
|
||||
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
||||
|
||||
```javascript
|
||||
const { setLogLevel } = require("@azure/logger");
|
||||
setLogLevel("info");
|
||||
```
|
||||
|
||||
##### Sample code
|
||||
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
## Next steps
|
||||
|
||||
- index.html
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-reservations sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/arm-reservations/dist/arm-reservations.js"></script>
|
||||
<script type="text/javascript">
|
||||
const authManager = new msAuth.AuthManager({
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmReservations.AzureReservationAPI(res.creds);
|
||||
const subscriptionId = "testsubscriptionId";
|
||||
const providerId = "testproviderId";
|
||||
const location = "westus";
|
||||
const resourceName = "testresourceName";
|
||||
client.quota.get(subscriptionId, providerId, location, resourceName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
```
|
||||
Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library.
|
||||
|
||||
## Contributing
|
||||
|
||||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
|
||||
|
||||
## Related projects
|
||||
|
||||
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
|
||||
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
|
||||
|
||||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/reservations/arm-reservations/README.png)
|
||||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Freservations%2Farm-reservations%2FREADME.png)
|
||||
|
||||
[azure_cli]: https://docs.microsoft.com/cli/azure
|
||||
[azure_sub]: https://azure.microsoft.com/free/
|
||||
[azure_sub]: https://azure.microsoft.com/free/
|
||||
[azure_portal]: https://portal.azure.com
|
||||
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
|
||||
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb",
|
||||
"readme": "specification/reservations/resource-manager/readme.md",
|
||||
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/reservations/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true",
|
||||
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
|
||||
"use": "@autorest/typescript@6.0.0-alpha.16.20220114.1"
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
|
||||
"docModel": { "enabled": true },
|
||||
"apiReport": { "enabled": true, "reportFolder": "./review" },
|
||||
"dtsRollup": {
|
||||
"enabled": true,
|
||||
"untrimmedFilePath": "",
|
||||
"publicTrimmedFilePath": "./types/arm-reservations.d.ts"
|
||||
},
|
||||
"messages": {
|
||||
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
|
||||
"extractorMessageReporting": {
|
||||
"ae-missing-release-tag": { "logLevel": "none" },
|
||||
"ae-unresolved-link": { "logLevel": "none" }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +1,103 @@
|
|||
{
|
||||
"name": "@azure/arm-reservations",
|
||||
"sdk-type": "mgmt",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "AzureReservationAPI Library with typescript type definitions for node.js and browser.",
|
||||
"version": "6.0.0",
|
||||
"description": "A generated SDK for AzureReservationAPI.",
|
||||
"version": "7.0.0",
|
||||
"engines": { "node": ">=12.0.0" },
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^2.0.1",
|
||||
"@azure/ms-rest-js": "^2.0.4",
|
||||
"tslib": "^1.10.0"
|
||||
"@azure/core-lro": "^2.2.0",
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"@azure/core-paging": "^1.2.0",
|
||||
"@azure/core-client": "^1.0.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-rest-pipeline": "^1.1.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"azure",
|
||||
"typescript",
|
||||
"browser",
|
||||
"isomorphic"
|
||||
],
|
||||
"keywords": ["node", "azure", "typescript", "browser", "isomorphic"],
|
||||
"license": "MIT",
|
||||
"main": "./dist/arm-reservations.js",
|
||||
"module": "./esm/azureReservationAPI.js",
|
||||
"types": "./esm/azureReservationAPI.d.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist-esm/src/index.js",
|
||||
"types": "./types/arm-reservations.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.3",
|
||||
"rollup": "^1.18.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"@microsoft/api-extractor": "^7.18.11",
|
||||
"@rollup/plugin-commonjs": "11.0.2",
|
||||
"@rollup/plugin-json": "^4.0.0",
|
||||
"@rollup/plugin-multi-entry": "^3.0.0",
|
||||
"@rollup/plugin-node-resolve": "^8.0.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"rollup": "^1.16.3",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
"uglify-js": "^3.6.0"
|
||||
"typescript": "~4.2.0",
|
||||
"uglify-js": "^3.4.9",
|
||||
"rimraf": "^3.0.0",
|
||||
"@azure/identity": "^2.0.1",
|
||||
"@azure-tools/test-recorder": "^1.0.0",
|
||||
"mocha": "^7.1.1",
|
||||
"cross-env": "^7.0.2"
|
||||
},
|
||||
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Azure/azure-sdk-for-js.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
|
||||
},
|
||||
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
|
||||
"files": [
|
||||
"dist/**/*.js",
|
||||
"dist/**/*.js.map",
|
||||
"dist/**/*.d.ts",
|
||||
"dist/**/*.d.ts.map",
|
||||
"esm/**/*.js",
|
||||
"esm/**/*.js.map",
|
||||
"esm/**/*.d.ts",
|
||||
"esm/**/*.d.ts.map",
|
||||
"dist-esm/**/*.js",
|
||||
"dist-esm/**/*.js.map",
|
||||
"dist-esm/**/*.d.ts",
|
||||
"dist-esm/**/*.d.ts.map",
|
||||
"src/**/*.ts",
|
||||
"README.md",
|
||||
"LICENSE",
|
||||
"rollup.config.js",
|
||||
"tsconfig.json"
|
||||
"tsconfig.json",
|
||||
"review/*",
|
||||
"CHANGELOG.md",
|
||||
"types/*"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc && rollup -c rollup.config.js && npm run minify",
|
||||
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-reservations.js.map'\" -o ./dist/arm-reservations.min.js ./dist/arm-reservations.js",
|
||||
"prepack": "npm install && npm run build"
|
||||
"build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
|
||||
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
|
||||
"prepack": "npm run build",
|
||||
"pack": "npm pack 2>&1",
|
||||
"extract-api": "api-extractor run --local",
|
||||
"lint": "echo skipped",
|
||||
"audit": "echo skipped",
|
||||
"clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
||||
"build:node": "echo skipped",
|
||||
"build:browser": "echo skipped",
|
||||
"build:test": "echo skipped",
|
||||
"build:samples": "echo skipped.",
|
||||
"check-format": "echo skipped",
|
||||
"execute:samples": "echo skipped",
|
||||
"format": "echo skipped",
|
||||
"test": "npm run integration-test",
|
||||
"test:node": "echo skipped",
|
||||
"test:browser": "echo skipped",
|
||||
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
||||
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
|
||||
"unit-test:browser": "echo skipped",
|
||||
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
||||
"integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
|
||||
"integration-test:browser": "echo skipped",
|
||||
"docs": "echo skipped"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"autoPublish": true
|
||||
"//metadata": {
|
||||
"constantPaths": [
|
||||
{ "path": "src/AzureReservationAPI.ts", "prefix": "packageDetails" }
|
||||
]
|
||||
},
|
||||
"autoPublish": true,
|
||||
"//sampleConfiguration": {
|
||||
"productName": "",
|
||||
"productSlugs": ["azure"],
|
||||
"disableDocsMs": true,
|
||||
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview"
|
||||
}
|
||||
}
|
||||
|
|
5
sdk/reservations/arm-reservations/recordings/node/my_test/recording_sample_test.js
сгенерированный
Normal file
5
sdk/reservations/arm-reservations/recordings/node/my_test/recording_sample_test.js
сгенерированный
Normal file
|
@ -0,0 +1,5 @@
|
|||
let nock = require('nock');
|
||||
|
||||
module.exports.hash = "7a6be38bb8cb644d64b4094802301751";
|
||||
|
||||
module.exports.testInfo = {"uniqueName":{},"newDate":{}}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,37 +1,188 @@
|
|||
import rollup from "rollup";
|
||||
import nodeResolve from "rollup-plugin-node-resolve";
|
||||
import sourcemaps from "rollup-plugin-sourcemaps";
|
||||
|
||||
/**
|
||||
* @type {rollup.RollupFileOptions}
|
||||
*/
|
||||
const config = {
|
||||
input: "./esm/azureReservationAPI.js",
|
||||
external: [
|
||||
"@azure/ms-rest-js",
|
||||
"@azure/ms-rest-azure-js"
|
||||
],
|
||||
output: {
|
||||
file: "./dist/arm-reservations.js",
|
||||
format: "umd",
|
||||
name: "Azure.ArmReservations",
|
||||
sourcemap: true,
|
||||
globals: {
|
||||
"@azure/ms-rest-js": "msRest",
|
||||
"@azure/ms-rest-azure-js": "msRestAzure"
|
||||
},
|
||||
banner: `/*
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/`
|
||||
},
|
||||
plugins: [
|
||||
nodeResolve({ mainFields: ['module', 'main'] }),
|
||||
sourcemaps()
|
||||
]
|
||||
*/
|
||||
|
||||
import nodeResolve from "@rollup/plugin-node-resolve";
|
||||
import cjs from "@rollup/plugin-commonjs";
|
||||
import sourcemaps from "rollup-plugin-sourcemaps";
|
||||
import multiEntry from "@rollup/plugin-multi-entry";
|
||||
import json from "@rollup/plugin-json";
|
||||
|
||||
import nodeBuiltins from "builtin-modules";
|
||||
|
||||
/**
|
||||
* Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
|
||||
*
|
||||
* NOTE: this manual configuration is only needed because OpenTelemetry uses an
|
||||
* __exportStar downleveled helper function to declare its exports which confuses
|
||||
* rollup's automatic discovery mechanism.
|
||||
*
|
||||
* @returns an object reference that can be `...`'d into your cjs() configuration.
|
||||
*/
|
||||
export function openTelemetryCommonJs() {
|
||||
const namedExports = {};
|
||||
|
||||
for (const key of [
|
||||
"@opentelemetry/api",
|
||||
"@azure/core-tracing/node_modules/@opentelemetry/api"
|
||||
]) {
|
||||
namedExports[key] = [
|
||||
"SpanKind",
|
||||
"TraceFlags",
|
||||
"getSpan",
|
||||
"setSpan",
|
||||
"SpanStatusCode",
|
||||
"getSpanContext",
|
||||
"setSpanContext"
|
||||
];
|
||||
}
|
||||
|
||||
const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
|
||||
|
||||
for (const version of releasedOpenTelemetryVersions) {
|
||||
namedExports[
|
||||
// working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
|
||||
`../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
|
||||
] = [
|
||||
"SpanKind",
|
||||
"TraceFlags",
|
||||
"getSpan",
|
||||
"setSpan",
|
||||
"StatusCode",
|
||||
"CanonicalCode",
|
||||
"getSpanContext",
|
||||
"setSpanContext"
|
||||
];
|
||||
}
|
||||
|
||||
return namedExports;
|
||||
}
|
||||
|
||||
// #region Warning Handler
|
||||
|
||||
/**
|
||||
* A function that can determine whether a rollupwarning should be ignored. If
|
||||
* the function returns `true`, then the warning will not be displayed.
|
||||
*/
|
||||
|
||||
function ignoreNiseSinonEvalWarnings(warning) {
|
||||
return (
|
||||
warning.code === "EVAL" &&
|
||||
warning.id &&
|
||||
(warning.id.includes("node_modules/nise") ||
|
||||
warning.id.includes("node_modules/sinon")) === true
|
||||
);
|
||||
}
|
||||
|
||||
function ignoreChaiCircularDependencyWarnings(warning) {
|
||||
return (
|
||||
warning.code === "CIRCULAR_DEPENDENCY" &&
|
||||
warning.importer && warning.importer.includes("node_modules/chai") === true
|
||||
);
|
||||
}
|
||||
|
||||
const warningInhibitors = [
|
||||
ignoreChaiCircularDependencyWarnings,
|
||||
ignoreNiseSinonEvalWarnings
|
||||
];
|
||||
|
||||
/**
|
||||
* Construct a warning handler for the shared rollup configuration
|
||||
* that ignores certain warnings that are not relevant to testing.
|
||||
*/
|
||||
function makeOnWarnForTesting() {
|
||||
return (warning, warn) => {
|
||||
// If every inhibitor returns false (i.e. no inhibitors), then show the warning
|
||||
if (warningInhibitors.every((inhib) => !inhib(warning))) {
|
||||
warn(warning);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
function makeBrowserTestConfig() {
|
||||
const config = {
|
||||
input: {
|
||||
include: ["dist-esm/test/**/*.spec.js"],
|
||||
exclude: ["dist-esm/test/**/node/**"]
|
||||
},
|
||||
output: {
|
||||
file: `dist-test/index.browser.js`,
|
||||
format: "umd",
|
||||
sourcemap: true
|
||||
},
|
||||
preserveSymlinks: false,
|
||||
plugins: [
|
||||
multiEntry({ exports: false }),
|
||||
nodeResolve({
|
||||
mainFields: ["module", "browser"]
|
||||
}),
|
||||
cjs({
|
||||
namedExports: {
|
||||
// Chai's strange internal architecture makes it impossible to statically
|
||||
// analyze its exports.
|
||||
chai: [
|
||||
"version",
|
||||
"use",
|
||||
"util",
|
||||
"config",
|
||||
"expect",
|
||||
"should",
|
||||
"assert"
|
||||
],
|
||||
...openTelemetryCommonJs()
|
||||
}
|
||||
}),
|
||||
json(),
|
||||
sourcemaps()
|
||||
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
|
||||
],
|
||||
onwarn: makeOnWarnForTesting(),
|
||||
// Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
|
||||
// rollup started respecting the "sideEffects" field in package.json. Since
|
||||
// our package.json sets "sideEffects=false", this also applies to test
|
||||
// code, which causes all tests to be removed by tree-shaking.
|
||||
treeshake: false
|
||||
};
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
const defaultConfigurationOptions = {
|
||||
disableBrowserBundle: false
|
||||
};
|
||||
|
||||
export default config;
|
||||
export function makeConfig(pkg, options) {
|
||||
options = {
|
||||
...defaultConfigurationOptions,
|
||||
...(options || {})
|
||||
};
|
||||
|
||||
const baseConfig = {
|
||||
// Use the package's module field if it has one
|
||||
input: pkg["module"] || "dist-esm/src/index.js",
|
||||
external: [
|
||||
...nodeBuiltins,
|
||||
...Object.keys(pkg.dependencies),
|
||||
...Object.keys(pkg.devDependencies)
|
||||
],
|
||||
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
|
||||
preserveSymlinks: false,
|
||||
plugins: [sourcemaps(), nodeResolve(), cjs()]
|
||||
};
|
||||
|
||||
const config = [baseConfig];
|
||||
|
||||
if (!options.disableBrowserBundle) {
|
||||
config.push(makeBrowserTestConfig());
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
export default makeConfig(require("./package.json"));
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# App registration secret for AAD authentication
|
||||
AZURE_CLIENT_SECRET=
|
||||
AZURE_CLIENT_ID=
|
||||
AZURE_TENANT_ID=
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription.
|
||||
*
|
||||
* @summary Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function appliedReservationList() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.getAppliedReservationList(subscriptionId);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
appliedReservationList().catch(console.error);
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get Available Scopes for `Reservation`.
|
||||
|
||||
*
|
||||
* @summary Get Available Scopes for `Reservation`.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json
|
||||
*/
|
||||
import {
|
||||
AvailableScopeRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function availableScopes() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const reservationId = "356e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body: AvailableScopeRequest = {
|
||||
properties: {
|
||||
scopes: ["/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9"]
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginAvailableScopesAndWait(
|
||||
reservationOrderId,
|
||||
reservationId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
availableScopes().catch(console.error);
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors.
|
||||
|
||||
*
|
||||
* @summary Calculates price for exchanging `Reservations` if there are no policy errors.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json
|
||||
*/
|
||||
import {
|
||||
CalculateExchangeRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function calculateExchange() {
|
||||
const body: CalculateExchangeRequest = {
|
||||
properties: {
|
||||
reservationsToExchange: [
|
||||
{
|
||||
quantity: 1,
|
||||
reservationId:
|
||||
"/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6"
|
||||
}
|
||||
],
|
||||
reservationsToPurchase: [
|
||||
{
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Upfront",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "testDisplayName",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
renew: false,
|
||||
reservedResourceProperties: { instanceFlexibility: "On" },
|
||||
reservedResourceType: "VirtualMachines",
|
||||
sku: { name: "Standard_B1ls" },
|
||||
term: "P1Y"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.calculateExchange.beginPostAndWait(body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
calculateExchange().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the regions and skus that are available for RI purchase for the specified Azure subscription.
|
||||
*
|
||||
* @summary Get the regions and skus that are available for RI purchase for the specified Azure subscription.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function catalog() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const reservedResourceType = "VirtualMachines";
|
||||
const location = "eastus";
|
||||
const options = {
|
||||
reservedResourceType: reservedResourceType,
|
||||
location: location
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.getCatalog(subscriptionId, options);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
catalog().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id
|
||||
*
|
||||
* @summary Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json
|
||||
*/
|
||||
import {
|
||||
ChangeDirectoryRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function changeDirectory() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const body: ChangeDirectoryRequest = {
|
||||
destinationTenantId: "906655ea-30be-4587-9d12-b50e077b0f32"
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.changeDirectory(
|
||||
reservationOrderId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
changeDirectory().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases.
|
||||
|
||||
*
|
||||
* @summary Returns one or more `Reservations` in exchange for one or more `Reservation` purchases.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json
|
||||
*/
|
||||
import { ExchangeRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function exchange() {
|
||||
const body: ExchangeRequest = {
|
||||
properties: { sessionId: "66e2ac8f-439e-4345-8235-6fef07608081" }
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.exchange.beginPostAndWait(body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
exchange().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List all the operations.
|
||||
*
|
||||
* @summary List all the operations.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function getOperations() {
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.operation.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
getOperations().catch(console.error);
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the details of the `ReservationOrder`.
|
||||
*
|
||||
* @summary Get the details of the `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function getReservation() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.get(reservationOrderId);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservation().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the details of the `ReservationOrder`.
|
||||
*
|
||||
* @summary Get the details of the `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function getReservationWithExpandPayments() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const expand = "schedule";
|
||||
const options = { expand: expand };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.get(reservationOrderId, options);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservationWithExpandPayments().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties.
|
||||
*
|
||||
* @summary Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json
|
||||
*/
|
||||
import { MergeRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function merge() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body: MergeRequest = {
|
||||
sources: [
|
||||
"/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73",
|
||||
"/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799"
|
||||
]
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginMergeAndWait(
|
||||
reservationOrderId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
merge().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Updates the applied scopes of the `Reservation`.
|
||||
*
|
||||
* @summary Updates the applied scopes of the `Reservation`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json
|
||||
*/
|
||||
import { Patch, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function patchReservation() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const parameters: Patch = {
|
||||
appliedScopeType: "Shared",
|
||||
instanceFlexibility: "Off"
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginUpdateAndWait(
|
||||
reservationOrderId,
|
||||
reservationId,
|
||||
parameters
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
patchReservation().catch(console.error);
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Purchase `ReservationOrder` and create resource under the specified URI.
|
||||
*
|
||||
* @summary Purchase `ReservationOrder` and create resource under the specified URI.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json
|
||||
*/
|
||||
import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function purchase() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const body: PurchaseRequest = {
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Monthly",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "TestReservationOrder",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
renew: false,
|
||||
reservedResourceProperties: { instanceFlexibility: "On" },
|
||||
reservedResourceType: "VirtualMachines",
|
||||
sku: { name: "standard_D1" },
|
||||
term: "P1Y"
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.beginPurchaseAndWait(
|
||||
reservationOrderId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
purchase().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotaRequestFailed() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
id
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestFailed().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotaRequestHistory() {
|
||||
const subscriptionId = "3f75fdf7-977e-44ad-990d-99f14f0f299f";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quotaRequestStatus.list(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotaRequestHistory().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotaRequestInProgress() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
id
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestInProgress().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotaRequestStatus() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
id
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestStatus().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
*
|
||||
* @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasListUsagesForCompute() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quota.list(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotasListUsagesForCompute().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
*
|
||||
* @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasListUsagesMachineLearningServices() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quota.list(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotasListUsagesMachineLearningServices().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request.
|
||||
*
|
||||
* @summary Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestForCompute() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardNDSFamily";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.get(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestForCompute().catch(console.error);
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Update the quota (service limits) of this resource to the requested value.
|
||||
|
||||
• To get the quota information for specific resource, send a GET request.
|
||||
|
||||
• To increase the quota, update the limit field from the GET response to a new value.
|
||||
|
||||
• To update the quota value, submit the JSON response to the quota request API to update the quota.
|
||||
• To update the quota. use the PATCH operation.
|
||||
*
|
||||
* @summary Update the quota (service limits) of this resource to the requested value.
|
||||
|
||||
• To get the quota information for specific resource, send a GET request.
|
||||
|
||||
• To increase the quota, update the limit field from the GET response to a new value.
|
||||
|
||||
• To update the quota value, submit the JSON response to the quota request API to update the quota.
|
||||
• To update the quota. use the PATCH operation.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json
|
||||
*/
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestPatchForCompute() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardFSv2Family";
|
||||
const createQuotaRequest: CurrentQuotaLimitBase = {
|
||||
properties: {
|
||||
name: { value: "standardFSv2Family" },
|
||||
limit: 200,
|
||||
unit: "Count"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPatchForCompute().catch(console.error);
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json
|
||||
*/
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestPutForCompute() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardFSv2Family";
|
||||
const createQuotaRequest: CurrentQuotaLimitBase = {
|
||||
properties: {
|
||||
name: { value: "standardFSv2Family" },
|
||||
limit: 200,
|
||||
unit: "Count"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForCompute().catch(console.error);
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json
|
||||
*/
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestPutForMachineLearningServicesDedicatedResource() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const resourceName = "StandardDv2Family";
|
||||
const createQuotaRequest: CurrentQuotaLimitBase = {
|
||||
properties: {
|
||||
name: { value: "StandardDv2Family" },
|
||||
limit: 200,
|
||||
resourceType: "dedicated",
|
||||
unit: "Count"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForMachineLearningServicesDedicatedResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json
|
||||
*/
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestPutForMachineLearningServicesLowPriorityResource() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const resourceName = "TotalLowPriorityCores";
|
||||
const createQuotaRequest: CurrentQuotaLimitBase = {
|
||||
properties: {
|
||||
name: { value: "TotalLowPriorityCores" },
|
||||
limit: 200,
|
||||
resourceType: "lowPriority",
|
||||
unit: "Count"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForMachineLearningServicesLowPriorityResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List `Reservation`s within a single `ReservationOrder`.
|
||||
*
|
||||
* @summary List `Reservation`s within a single `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function reservationList() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.list(reservationOrderId)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationList().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List of all the `ReservationOrder`s that the user has access to in the current tenant.
|
||||
*
|
||||
* @summary List of all the `ReservationOrder`s that the user has access to in the current tenant.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function reservationOrderList() {
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservationOrder.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationOrderList().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List of all the revisions for the `Reservation`.
|
||||
*
|
||||
* @summary List of all the revisions for the `Reservation`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function reservationRevisions() {
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.listRevisions(
|
||||
reservationId,
|
||||
reservationOrderId
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationRevisions().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Split a `Reservation` into two `Reservation`s with specified quantity distribution.
|
||||
*
|
||||
* @summary Split a `Reservation` into two `Reservation`s with specified quantity distribution.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json
|
||||
*/
|
||||
import { SplitRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function split() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body: SplitRequest = {
|
||||
quantities: [1, 2],
|
||||
reservationId:
|
||||
"/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a"
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginSplitAndWait(
|
||||
reservationOrderId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
split().catch(console.error);
|
|
@ -0,0 +1,102 @@
|
|||
# client library samples for JavaScript
|
||||
|
||||
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
|
||||
|
||||
| **File Name** | **Description** |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [appliedReservationList.js][appliedreservationlist] | Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json |
|
||||
| [availableScopes.js][availablescopes] | Get Available Scopes for `Reservation`. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json |
|
||||
| [calculateExchange.js][calculateexchange] | Calculates price for exchanging `Reservations` if there are no policy errors. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json |
|
||||
| [catalog.js][catalog] | Get the regions and skus that are available for RI purchase for the specified Azure subscription. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json |
|
||||
| [changeDirectory.js][changedirectory] | Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json |
|
||||
| [exchange.js][exchange] | Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json |
|
||||
| [getOperations.js][getoperations] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json |
|
||||
| [getReservation.js][getreservation] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json |
|
||||
| [getReservationWithExpandPayments.js][getreservationwithexpandpayments] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json |
|
||||
| [merge.js][merge] | Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json |
|
||||
| [patchReservation.js][patchreservation] | Updates the applied scopes of the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json |
|
||||
| [purchase.js][purchase] | Purchase `ReservationOrder` and create resource under the specified URI. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json |
|
||||
| [quotaRequestFailed.js][quotarequestfailed] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json |
|
||||
| [quotaRequestHistory.js][quotarequesthistory] | For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json |
|
||||
| [quotaRequestInProgress.js][quotarequestinprogress] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json |
|
||||
| [quotaRequestStatus.js][quotarequeststatus] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json |
|
||||
| [quotasListUsagesForCompute.js][quotaslistusagesforcompute] | Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json |
|
||||
| [quotasListUsagesMachineLearningServices.js][quotaslistusagesmachinelearningservices] | Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json |
|
||||
| [quotasRequestForCompute.js][quotasrequestforcompute] | Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json |
|
||||
| [quotasRequestPatchForCompute.js][quotasrequestpatchforcompute] | Update the quota (service limits) of this resource to the requested value. //@@TS-MAGIC-NEWLINE@@ • To get the quota information for specific resource, send a GET request. //@@TS-MAGIC-NEWLINE@@ • To increase the quota, update the limit field from the GET response to a new value. //@@TS-MAGIC-NEWLINE@@ • To update the quota value, submit the JSON response to the quota request API to update the quota. • To update the quota. use the PATCH operation. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json |
|
||||
| [quotasRequestPutForCompute.js][quotasrequestputforcompute] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json |
|
||||
| [quotasRequestPutForMachineLearningServicesDedicatedResource.js][quotasrequestputformachinelearningservicesdedicatedresource] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json |
|
||||
| [quotasRequestPutForMachineLearningServicesLowPriorityResource.js][quotasrequestputformachinelearningserviceslowpriorityresource] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json |
|
||||
| [reservationList.js][reservationlist] | List `Reservation`s within a single `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json |
|
||||
| [reservationOrderList.js][reservationorderlist] | List of all the `ReservationOrder`s that the user has access to in the current tenant. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json |
|
||||
| [reservationRevisions.js][reservationrevisions] | List of all the revisions for the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json |
|
||||
| [split.js][split] | Split a `Reservation` into two `Reservation`s with specified quantity distribution. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
|
||||
|
||||
You need [an Azure subscription][freesub] to run these sample programs.
|
||||
|
||||
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
|
||||
|
||||
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
|
||||
|
||||
## Setup
|
||||
|
||||
To run the samples using the published version of the package:
|
||||
|
||||
1. Install the dependencies using `npm`:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
|
||||
|
||||
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
|
||||
|
||||
```bash
|
||||
node appliedReservationList.js
|
||||
```
|
||||
|
||||
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
|
||||
|
||||
```bash
|
||||
npx cross-env node appliedReservationList.js
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
|
||||
|
||||
[appliedreservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/appliedReservationList.js
|
||||
[availablescopes]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/availableScopes.js
|
||||
[calculateexchange]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchange.js
|
||||
[catalog]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/catalog.js
|
||||
[changedirectory]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/changeDirectory.js
|
||||
[exchange]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/exchange.js
|
||||
[getoperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/getOperations.js
|
||||
[getreservation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/getReservation.js
|
||||
[getreservationwithexpandpayments]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/getReservationWithExpandPayments.js
|
||||
[merge]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/merge.js
|
||||
[patchreservation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/patchReservation.js
|
||||
[purchase]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/purchase.js
|
||||
[quotarequestfailed]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestFailed.js
|
||||
[quotarequesthistory]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestHistory.js
|
||||
[quotarequestinprogress]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestInProgress.js
|
||||
[quotarequeststatus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatus.js
|
||||
[quotaslistusagesforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesForCompute.js
|
||||
[quotaslistusagesmachinelearningservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesMachineLearningServices.js
|
||||
[quotasrequestforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestForCompute.js
|
||||
[quotasrequestpatchforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPatchForCompute.js
|
||||
[quotasrequestputforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForCompute.js
|
||||
[quotasrequestputformachinelearningservicesdedicatedresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesDedicatedResource.js
|
||||
[quotasrequestputformachinelearningserviceslowpriorityresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesLowPriorityResource.js
|
||||
[reservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationList.js
|
||||
[reservationorderlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderList.js
|
||||
[reservationrevisions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationRevisions.js
|
||||
[split]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/split.js
|
||||
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview
|
||||
[freesub]: https://azure.microsoft.com/free/
|
||||
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations/README.md
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription.
|
||||
*
|
||||
* @summary Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function appliedReservationList() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.getAppliedReservationList(subscriptionId);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
appliedReservationList().catch(console.error);
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get Available Scopes for `Reservation`.
|
||||
|
||||
*
|
||||
* @summary Get Available Scopes for `Reservation`.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function availableScopes() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const reservationId = "356e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body = {
|
||||
properties: {
|
||||
scopes: ["/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9"],
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginAvailableScopesAndWait(
|
||||
reservationOrderId,
|
||||
reservationId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
availableScopes().catch(console.error);
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors.
|
||||
|
||||
*
|
||||
* @summary Calculates price for exchanging `Reservations` if there are no policy errors.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function calculateExchange() {
|
||||
const body = {
|
||||
properties: {
|
||||
reservationsToExchange: [
|
||||
{
|
||||
quantity: 1,
|
||||
reservationId:
|
||||
"/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6",
|
||||
},
|
||||
],
|
||||
reservationsToPurchase: [
|
||||
{
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Upfront",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "testDisplayName",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
renew: false,
|
||||
reservedResourceProperties: { instanceFlexibility: "On" },
|
||||
reservedResourceType: "VirtualMachines",
|
||||
sku: { name: "Standard_B1ls" },
|
||||
term: "P1Y",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.calculateExchange.beginPostAndWait(body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
calculateExchange().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the regions and skus that are available for RI purchase for the specified Azure subscription.
|
||||
*
|
||||
* @summary Get the regions and skus that are available for RI purchase for the specified Azure subscription.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function catalog() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const reservedResourceType = "VirtualMachines";
|
||||
const location = "eastus";
|
||||
const options = {
|
||||
reservedResourceType: reservedResourceType,
|
||||
location: location,
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.getCatalog(subscriptionId, options);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
catalog().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id
|
||||
*
|
||||
* @summary Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function changeDirectory() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const body = {
|
||||
destinationTenantId: "906655ea-30be-4587-9d12-b50e077b0f32",
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.changeDirectory(reservationOrderId, body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
changeDirectory().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases.
|
||||
|
||||
*
|
||||
* @summary Returns one or more `Reservations` in exchange for one or more `Reservation` purchases.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function exchange() {
|
||||
const body = {
|
||||
properties: { sessionId: "66e2ac8f-439e-4345-8235-6fef07608081" },
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.exchange.beginPostAndWait(body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
exchange().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List all the operations.
|
||||
*
|
||||
* @summary List all the operations.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function getOperations() {
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.operation.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
getOperations().catch(console.error);
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the details of the `ReservationOrder`.
|
||||
*
|
||||
* @summary Get the details of the `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function getReservation() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.get(reservationOrderId);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservation().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the details of the `ReservationOrder`.
|
||||
*
|
||||
* @summary Get the details of the `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function getReservationWithExpandPayments() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const expand = "schedule";
|
||||
const options = { expand: expand };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.get(reservationOrderId, options);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservationWithExpandPayments().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties.
|
||||
*
|
||||
* @summary Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function merge() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body = {
|
||||
sources: [
|
||||
"/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73",
|
||||
"/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799",
|
||||
],
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginMergeAndWait(reservationOrderId, body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
merge().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "azure-arm-reservations-samples-js",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": " client library samples for JavaScript",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
|
||||
"directory": "sdk/reservations/arm-reservations"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"azure",
|
||||
"typescript",
|
||||
"browser",
|
||||
"isomorphic"
|
||||
],
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations",
|
||||
"dependencies": {
|
||||
"@azure/arm-reservations": "latest",
|
||||
"dotenv": "latest",
|
||||
"@azure/identity": "^2.0.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Updates the applied scopes of the `Reservation`.
|
||||
*
|
||||
* @summary Updates the applied scopes of the `Reservation`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function patchReservation() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const parameters = {
|
||||
appliedScopeType: "Shared",
|
||||
instanceFlexibility: "Off",
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginUpdateAndWait(
|
||||
reservationOrderId,
|
||||
reservationId,
|
||||
parameters
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
patchReservation().catch(console.error);
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Purchase `ReservationOrder` and create resource under the specified URI.
|
||||
*
|
||||
* @summary Purchase `ReservationOrder` and create resource under the specified URI.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function purchase() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const body = {
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Monthly",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "TestReservationOrder",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
renew: false,
|
||||
reservedResourceProperties: { instanceFlexibility: "On" },
|
||||
reservedResourceType: "VirtualMachines",
|
||||
sku: { name: "standard_D1" },
|
||||
term: "P1Y",
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.beginPurchaseAndWait(reservationOrderId, body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
purchase().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotaRequestFailed() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(subscriptionId, providerId, location, id);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestFailed().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotaRequestHistory() {
|
||||
const subscriptionId = "3f75fdf7-977e-44ad-990d-99f14f0f299f";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quotaRequestStatus.list(subscriptionId, providerId, location)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotaRequestHistory().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotaRequestInProgress() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(subscriptionId, providerId, location, id);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestInProgress().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotaRequestStatus() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(subscriptionId, providerId, location, id);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestStatus().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
*
|
||||
* @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotasListUsagesForCompute() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quota.list(subscriptionId, providerId, location)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotasListUsagesForCompute().catch(console.error);
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
*
|
||||
* @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotasListUsagesMachineLearningServices() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quota.list(subscriptionId, providerId, location)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotasListUsagesMachineLearningServices().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request.
|
||||
*
|
||||
* @summary Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotasRequestForCompute() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardNDSFamily";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.get(subscriptionId, providerId, location, resourceName);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestForCompute().catch(console.error);
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Update the quota (service limits) of this resource to the requested value.
|
||||
|
||||
• To get the quota information for specific resource, send a GET request.
|
||||
|
||||
• To increase the quota, update the limit field from the GET response to a new value.
|
||||
|
||||
• To update the quota value, submit the JSON response to the quota request API to update the quota.
|
||||
• To update the quota. use the PATCH operation.
|
||||
*
|
||||
* @summary Update the quota (service limits) of this resource to the requested value.
|
||||
|
||||
• To get the quota information for specific resource, send a GET request.
|
||||
|
||||
• To increase the quota, update the limit field from the GET response to a new value.
|
||||
|
||||
• To update the quota value, submit the JSON response to the quota request API to update the quota.
|
||||
• To update the quota. use the PATCH operation.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotasRequestPatchForCompute() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardFSv2Family";
|
||||
const createQuotaRequest = {
|
||||
properties: {
|
||||
name: { value: "standardFSv2Family" },
|
||||
limit: 200,
|
||||
unit: "Count",
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPatchForCompute().catch(console.error);
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotasRequestPutForCompute() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardFSv2Family";
|
||||
const createQuotaRequest = {
|
||||
properties: {
|
||||
name: { value: "standardFSv2Family" },
|
||||
limit: 200,
|
||||
unit: "Count",
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForCompute().catch(console.error);
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotasRequestPutForMachineLearningServicesDedicatedResource() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const resourceName = "StandardDv2Family";
|
||||
const createQuotaRequest = {
|
||||
properties: {
|
||||
name: { value: "StandardDv2Family" },
|
||||
limit: 200,
|
||||
resourceType: "dedicated",
|
||||
unit: "Count",
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForMachineLearningServicesDedicatedResource().catch(console.error);
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function quotasRequestPutForMachineLearningServicesLowPriorityResource() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const resourceName = "TotalLowPriorityCores";
|
||||
const createQuotaRequest = {
|
||||
properties: {
|
||||
name: { value: "TotalLowPriorityCores" },
|
||||
limit: 200,
|
||||
resourceType: "lowPriority",
|
||||
unit: "Count",
|
||||
},
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForMachineLearningServicesLowPriorityResource().catch(console.error);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List `Reservation`s within a single `ReservationOrder`.
|
||||
*
|
||||
* @summary List `Reservation`s within a single `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function reservationList() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.list(reservationOrderId)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationList().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List of all the `ReservationOrder`s that the user has access to in the current tenant.
|
||||
*
|
||||
* @summary List of all the `ReservationOrder`s that the user has access to in the current tenant.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function reservationOrderList() {
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservationOrder.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationOrderList().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List of all the revisions for the `Reservation`.
|
||||
*
|
||||
* @summary List of all the revisions for the `Reservation`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function reservationRevisions() {
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.listRevisions(reservationId, reservationOrderId)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationRevisions().catch(console.error);
|
|
@ -0,0 +1,4 @@
|
|||
# App registration secret for AAD authentication
|
||||
AZURE_CLIENT_SECRET=
|
||||
AZURE_CLIENT_ID=
|
||||
AZURE_TENANT_ID=
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Split a `Reservation` into two `Reservation`s with specified quantity distribution.
|
||||
*
|
||||
* @summary Split a `Reservation` into two `Reservation`s with specified quantity distribution.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json
|
||||
*/
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
async function split() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body = {
|
||||
quantities: [1, 2],
|
||||
reservationId:
|
||||
"/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a",
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginSplitAndWait(reservationOrderId, body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
split().catch(console.error);
|
|
@ -0,0 +1,115 @@
|
|||
# client library samples for TypeScript
|
||||
|
||||
These sample programs show how to use the TypeScript client libraries for in some common scenarios.
|
||||
|
||||
| **File Name** | **Description** |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [appliedReservationList.ts][appliedreservationlist] | Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json |
|
||||
| [availableScopes.ts][availablescopes] | Get Available Scopes for `Reservation`. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json |
|
||||
| [calculateExchange.ts][calculateexchange] | Calculates price for exchanging `Reservations` if there are no policy errors. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json |
|
||||
| [catalog.ts][catalog] | Get the regions and skus that are available for RI purchase for the specified Azure subscription. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json |
|
||||
| [changeDirectory.ts][changedirectory] | Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json |
|
||||
| [exchange.ts][exchange] | Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json |
|
||||
| [getOperations.ts][getoperations] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json |
|
||||
| [getReservation.ts][getreservation] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json |
|
||||
| [getReservationWithExpandPayments.ts][getreservationwithexpandpayments] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json |
|
||||
| [merge.ts][merge] | Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json |
|
||||
| [patchReservation.ts][patchreservation] | Updates the applied scopes of the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json |
|
||||
| [purchase.ts][purchase] | Purchase `ReservationOrder` and create resource under the specified URI. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json |
|
||||
| [quotaRequestFailed.ts][quotarequestfailed] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json |
|
||||
| [quotaRequestHistory.ts][quotarequesthistory] | For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json |
|
||||
| [quotaRequestInProgress.ts][quotarequestinprogress] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json |
|
||||
| [quotaRequestStatus.ts][quotarequeststatus] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json |
|
||||
| [quotasListUsagesForCompute.ts][quotaslistusagesforcompute] | Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json |
|
||||
| [quotasListUsagesMachineLearningServices.ts][quotaslistusagesmachinelearningservices] | Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json |
|
||||
| [quotasRequestForCompute.ts][quotasrequestforcompute] | Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json |
|
||||
| [quotasRequestPatchForCompute.ts][quotasrequestpatchforcompute] | Update the quota (service limits) of this resource to the requested value. //@@TS-MAGIC-NEWLINE@@ • To get the quota information for specific resource, send a GET request. //@@TS-MAGIC-NEWLINE@@ • To increase the quota, update the limit field from the GET response to a new value. //@@TS-MAGIC-NEWLINE@@ • To update the quota value, submit the JSON response to the quota request API to update the quota. • To update the quota. use the PATCH operation. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json |
|
||||
| [quotasRequestPutForCompute.ts][quotasrequestputforcompute] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json |
|
||||
| [quotasRequestPutForMachineLearningServicesDedicatedResource.ts][quotasrequestputformachinelearningservicesdedicatedresource] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json |
|
||||
| [quotasRequestPutForMachineLearningServicesLowPriorityResource.ts][quotasrequestputformachinelearningserviceslowpriorityresource] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json |
|
||||
| [reservationList.ts][reservationlist] | List `Reservation`s within a single `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json |
|
||||
| [reservationOrderList.ts][reservationorderlist] | List of all the `ReservationOrder`s that the user has access to in the current tenant. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json |
|
||||
| [reservationRevisions.ts][reservationrevisions] | List of all the revisions for the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json |
|
||||
| [split.ts][split] | Split a `Reservation` into two `Reservation`s with specified quantity distribution. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
|
||||
|
||||
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
|
||||
|
||||
```bash
|
||||
npm install -g typescript
|
||||
```
|
||||
|
||||
You need [an Azure subscription][freesub] to run these sample programs.
|
||||
|
||||
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
|
||||
|
||||
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
|
||||
|
||||
## Setup
|
||||
|
||||
To run the samples using the published version of the package:
|
||||
|
||||
1. Install the dependencies using `npm`:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Compile the samples:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
|
||||
|
||||
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
|
||||
|
||||
```bash
|
||||
node dist/appliedReservationList.js
|
||||
```
|
||||
|
||||
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
|
||||
|
||||
```bash
|
||||
npx cross-env node dist/appliedReservationList.js
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
|
||||
|
||||
[appliedreservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/appliedReservationList.ts
|
||||
[availablescopes]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/availableScopes.ts
|
||||
[calculateexchange]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchange.ts
|
||||
[catalog]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/catalog.ts
|
||||
[changedirectory]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/changeDirectory.ts
|
||||
[exchange]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/exchange.ts
|
||||
[getoperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/getOperations.ts
|
||||
[getreservation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservation.ts
|
||||
[getreservationwithexpandpayments]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservationWithExpandPayments.ts
|
||||
[merge]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/merge.ts
|
||||
[patchreservation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/patchReservation.ts
|
||||
[purchase]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/purchase.ts
|
||||
[quotarequestfailed]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestFailed.ts
|
||||
[quotarequesthistory]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestHistory.ts
|
||||
[quotarequestinprogress]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestInProgress.ts
|
||||
[quotarequeststatus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatus.ts
|
||||
[quotaslistusagesforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesForCompute.ts
|
||||
[quotaslistusagesmachinelearningservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesMachineLearningServices.ts
|
||||
[quotasrequestforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestForCompute.ts
|
||||
[quotasrequestpatchforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPatchForCompute.ts
|
||||
[quotasrequestputforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForCompute.ts
|
||||
[quotasrequestputformachinelearningservicesdedicatedresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesDedicatedResource.ts
|
||||
[quotasrequestputformachinelearningserviceslowpriorityresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts
|
||||
[reservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationList.ts
|
||||
[reservationorderlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderList.ts
|
||||
[reservationrevisions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationRevisions.ts
|
||||
[split]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/split.ts
|
||||
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview
|
||||
[freesub]: https://azure.microsoft.com/free/
|
||||
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations/README.md
|
||||
[typescript]: https://www.typescriptlang.org/docs/home.html
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "azure-arm-reservations-samples-ts",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": " client library samples for TypeScript",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prebuild": "rimraf dist/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
|
||||
"directory": "sdk/reservations/arm-reservations"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"azure",
|
||||
"typescript",
|
||||
"browser",
|
||||
"isomorphic"
|
||||
],
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations",
|
||||
"dependencies": {
|
||||
"@azure/arm-reservations": "latest",
|
||||
"dotenv": "latest",
|
||||
"@azure/identity": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.0",
|
||||
"typescript": "~4.4.0",
|
||||
"rimraf": "latest"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
# App registration secret for AAD authentication
|
||||
AZURE_CLIENT_SECRET=
|
||||
AZURE_CLIENT_ID=
|
||||
AZURE_TENANT_ID=
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription.
|
||||
*
|
||||
* @summary Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function appliedReservationList() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.getAppliedReservationList(subscriptionId);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
appliedReservationList().catch(console.error);
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get Available Scopes for `Reservation`.
|
||||
|
||||
*
|
||||
* @summary Get Available Scopes for `Reservation`.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json
|
||||
*/
|
||||
import {
|
||||
AvailableScopeRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function availableScopes() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const reservationId = "356e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body: AvailableScopeRequest = {
|
||||
properties: {
|
||||
scopes: ["/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9"]
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginAvailableScopesAndWait(
|
||||
reservationOrderId,
|
||||
reservationId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
availableScopes().catch(console.error);
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors.
|
||||
|
||||
*
|
||||
* @summary Calculates price for exchanging `Reservations` if there are no policy errors.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json
|
||||
*/
|
||||
import {
|
||||
CalculateExchangeRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function calculateExchange() {
|
||||
const body: CalculateExchangeRequest = {
|
||||
properties: {
|
||||
reservationsToExchange: [
|
||||
{
|
||||
quantity: 1,
|
||||
reservationId:
|
||||
"/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6"
|
||||
}
|
||||
],
|
||||
reservationsToPurchase: [
|
||||
{
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Upfront",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "testDisplayName",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
renew: false,
|
||||
reservedResourceProperties: { instanceFlexibility: "On" },
|
||||
reservedResourceType: "VirtualMachines",
|
||||
sku: { name: "Standard_B1ls" },
|
||||
term: "P1Y"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.calculateExchange.beginPostAndWait(body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
calculateExchange().catch(console.error);
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the regions and skus that are available for RI purchase for the specified Azure subscription.
|
||||
*
|
||||
* @summary Get the regions and skus that are available for RI purchase for the specified Azure subscription.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function catalog() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const reservedResourceType = "VirtualMachines";
|
||||
const location = "eastus";
|
||||
const options = {
|
||||
reservedResourceType: reservedResourceType,
|
||||
location: location
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.getCatalog(subscriptionId, options);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
catalog().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id
|
||||
*
|
||||
* @summary Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json
|
||||
*/
|
||||
import {
|
||||
ChangeDirectoryRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function changeDirectory() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const body: ChangeDirectoryRequest = {
|
||||
destinationTenantId: "906655ea-30be-4587-9d12-b50e077b0f32"
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.changeDirectory(
|
||||
reservationOrderId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
changeDirectory().catch(console.error);
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases.
|
||||
|
||||
*
|
||||
* @summary Returns one or more `Reservations` in exchange for one or more `Reservation` purchases.
|
||||
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json
|
||||
*/
|
||||
import { ExchangeRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function exchange() {
|
||||
const body: ExchangeRequest = {
|
||||
properties: { sessionId: "66e2ac8f-439e-4345-8235-6fef07608081" }
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.exchange.beginPostAndWait(body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
exchange().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List all the operations.
|
||||
*
|
||||
* @summary List all the operations.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function getOperations() {
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.operation.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
getOperations().catch(console.error);
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the details of the `ReservationOrder`.
|
||||
*
|
||||
* @summary Get the details of the `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function getReservation() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.get(reservationOrderId);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservation().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the details of the `ReservationOrder`.
|
||||
*
|
||||
* @summary Get the details of the `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function getReservationWithExpandPayments() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const expand = "schedule";
|
||||
const options = { expand: expand };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.get(reservationOrderId, options);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservationWithExpandPayments().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties.
|
||||
*
|
||||
* @summary Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json
|
||||
*/
|
||||
import { MergeRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function merge() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body: MergeRequest = {
|
||||
sources: [
|
||||
"/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73",
|
||||
"/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799"
|
||||
]
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginMergeAndWait(
|
||||
reservationOrderId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
merge().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Updates the applied scopes of the `Reservation`.
|
||||
*
|
||||
* @summary Updates the applied scopes of the `Reservation`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json
|
||||
*/
|
||||
import { Patch, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function patchReservation() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const parameters: Patch = {
|
||||
appliedScopeType: "Shared",
|
||||
instanceFlexibility: "Off"
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginUpdateAndWait(
|
||||
reservationOrderId,
|
||||
reservationId,
|
||||
parameters
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
patchReservation().catch(console.error);
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Purchase `ReservationOrder` and create resource under the specified URI.
|
||||
*
|
||||
* @summary Purchase `ReservationOrder` and create resource under the specified URI.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json
|
||||
*/
|
||||
import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function purchase() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const body: PurchaseRequest = {
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Monthly",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "TestReservationOrder",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
renew: false,
|
||||
reservedResourceProperties: { instanceFlexibility: "On" },
|
||||
reservedResourceType: "VirtualMachines",
|
||||
sku: { name: "standard_D1" },
|
||||
term: "P1Y"
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservationOrder.beginPurchaseAndWait(
|
||||
reservationOrderId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
purchase().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotaRequestFailed() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
id
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestFailed().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotaRequestHistory() {
|
||||
const subscriptionId = "3f75fdf7-977e-44ad-990d-99f14f0f299f";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quotaRequestStatus.list(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotaRequestHistory().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotaRequestInProgress() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
id
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestInProgress().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
*
|
||||
* @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotaRequestStatus() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quotaRequestStatus.get(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
id
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotaRequestStatus().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
*
|
||||
* @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasListUsagesForCompute() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quota.list(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotasListUsagesForCompute().catch(console.error);
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
*
|
||||
* @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasListUsagesMachineLearningServices() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.quota.list(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
quotasListUsagesMachineLearningServices().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request.
|
||||
*
|
||||
* @summary Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestForCompute() {
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardNDSFamily";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.get(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestForCompute().catch(console.error);
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Update the quota (service limits) of this resource to the requested value.
|
||||
|
||||
• To get the quota information for specific resource, send a GET request.
|
||||
|
||||
• To increase the quota, update the limit field from the GET response to a new value.
|
||||
|
||||
• To update the quota value, submit the JSON response to the quota request API to update the quota.
|
||||
• To update the quota. use the PATCH operation.
|
||||
*
|
||||
* @summary Update the quota (service limits) of this resource to the requested value.
|
||||
|
||||
• To get the quota information for specific resource, send a GET request.
|
||||
|
||||
• To increase the quota, update the limit field from the GET response to a new value.
|
||||
|
||||
• To update the quota value, submit the JSON response to the quota request API to update the quota.
|
||||
• To update the quota. use the PATCH operation.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json
|
||||
*/
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestPatchForCompute() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardFSv2Family";
|
||||
const createQuotaRequest: CurrentQuotaLimitBase = {
|
||||
properties: {
|
||||
name: { value: "standardFSv2Family" },
|
||||
limit: 200,
|
||||
unit: "Count"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPatchForCompute().catch(console.error);
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json
|
||||
*/
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestPutForCompute() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.Compute";
|
||||
const location = "eastus";
|
||||
const resourceName = "standardFSv2Family";
|
||||
const createQuotaRequest: CurrentQuotaLimitBase = {
|
||||
properties: {
|
||||
name: { value: "standardFSv2Family" },
|
||||
limit: 200,
|
||||
unit: "Count"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForCompute().catch(console.error);
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json
|
||||
*/
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestPutForMachineLearningServicesDedicatedResource() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const resourceName = "StandardDv2Family";
|
||||
const createQuotaRequest: CurrentQuotaLimitBase = {
|
||||
properties: {
|
||||
name: { value: "StandardDv2Family" },
|
||||
limit: 200,
|
||||
resourceType: "dedicated",
|
||||
unit: "Count"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForMachineLearningServicesDedicatedResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
*
|
||||
* @summary Create or update the quota (service limits) of a resource to the requested value.
|
||||
Steps:
|
||||
|
||||
1. Make the Get request to get the quota information for specific resource.
|
||||
|
||||
2. To increase the quota, update the limit field in the response from Get request to new value.
|
||||
|
||||
3. Submit the JSON to the quota request API to update the quota.
|
||||
The Create quota request may be constructed as follows. The PUT operation can be used to update the quota.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json
|
||||
*/
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function quotasRequestPutForMachineLearningServicesLowPriorityResource() {
|
||||
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
|
||||
const providerId = "Microsoft.MachineLearningServices";
|
||||
const location = "eastus";
|
||||
const resourceName = "TotalLowPriorityCores";
|
||||
const createQuotaRequest: CurrentQuotaLimitBase = {
|
||||
properties: {
|
||||
name: { value: "TotalLowPriorityCores" },
|
||||
limit: 200,
|
||||
resourceType: "lowPriority",
|
||||
unit: "Count"
|
||||
}
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.quota.beginCreateOrUpdateAndWait(
|
||||
subscriptionId,
|
||||
providerId,
|
||||
location,
|
||||
resourceName,
|
||||
createQuotaRequest
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
quotasRequestPutForMachineLearningServicesLowPriorityResource().catch(
|
||||
console.error
|
||||
);
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List `Reservation`s within a single `ReservationOrder`.
|
||||
*
|
||||
* @summary List `Reservation`s within a single `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function reservationList() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.list(reservationOrderId)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationList().catch(console.error);
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List of all the `ReservationOrder`s that the user has access to in the current tenant.
|
||||
*
|
||||
* @summary List of all the `ReservationOrder`s that the user has access to in the current tenant.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function reservationOrderList() {
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservationOrder.list()) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationOrderList().catch(console.error);
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to List of all the revisions for the `Reservation`.
|
||||
*
|
||||
* @summary List of all the revisions for the `Reservation`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json
|
||||
*/
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function reservationRevisions() {
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.listRevisions(
|
||||
reservationId,
|
||||
reservationOrderId
|
||||
)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
reservationRevisions().catch(console.error);
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* This sample demonstrates how to Split a `Reservation` into two `Reservation`s with specified quantity distribution.
|
||||
*
|
||||
* @summary Split a `Reservation` into two `Reservation`s with specified quantity distribution.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json
|
||||
*/
|
||||
import { SplitRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
async function split() {
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const body: SplitRequest = {
|
||||
quantities: [1, 2],
|
||||
reservationId:
|
||||
"/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a"
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.beginSplitAndWait(
|
||||
reservationOrderId,
|
||||
body
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
split().catch(console.error);
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче