reservations-release (#21505)
This commit is contained in:
Родитель
d567b9d3c7
Коммит
e9ccb2022c
|
@ -12732,27 +12732,28 @@ packages:
|
|||
dev: false
|
||||
|
||||
file:projects/arm-reservations.tgz:
|
||||
resolution: {integrity: sha512-iq+XOnDwTstqVmY7CAXK3z4FXpE6LotND9ruglntiypzwMIeYSJMIgHhr/OWM3Yw0I+lnSxzaws+Wm3u3lAktw==, tarball: file:projects/arm-reservations.tgz}
|
||||
resolution: {integrity: sha512-gO8IGPuDOcvlIn4pnKYfl0nbINAcCQCRNqP6OTF9JQzaAEX34mF6IJvYkRr5N4t0olQvoFyvG7ffCk4bHtLQ4A==, tarball: file:projects/arm-reservations.tgz}
|
||||
name: '@rush-temp/arm-reservations'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@azure-tools/test-recorder': 1.0.2
|
||||
'@azure/identity': 2.0.4
|
||||
'@microsoft/api-extractor': 7.18.11
|
||||
'@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
|
||||
'@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1
|
||||
'@rollup/plugin-json': 4.1.0_rollup@2.70.1
|
||||
'@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1
|
||||
'@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.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
|
||||
rollup: 2.70.1
|
||||
rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1
|
||||
tslib: 2.3.1
|
||||
typescript: 4.2.4
|
||||
uglify-js: 3.15.4
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- debug
|
||||
- encoding
|
||||
- supports-color
|
||||
|
|
|
@ -1,5 +1,29 @@
|
|||
# Release History
|
||||
|
||||
## 7.1.0 (2022-04-20)
|
||||
|
||||
**Features**
|
||||
|
||||
- Interface CurrentQuotaLimit has a new optional parameter id
|
||||
- Interface CurrentQuotaLimit has a new optional parameter name
|
||||
- Interface CurrentQuotaLimit has a new optional parameter type
|
||||
- Interface CurrentQuotaLimitBase has a new optional parameter id
|
||||
- Interface CurrentQuotaLimitBase has a new optional parameter name
|
||||
- Interface CurrentQuotaLimitBase has a new optional parameter type
|
||||
- Interface GetCatalogOptionalParams has a new optional parameter offerId
|
||||
- Interface GetCatalogOptionalParams has a new optional parameter planId
|
||||
- Interface GetCatalogOptionalParams has a new optional parameter publisherId
|
||||
- Interface QuotaRequestOneResourceSubmitResponse has a new optional parameter idPropertiesId
|
||||
- Interface QuotaRequestOneResourceSubmitResponse has a new optional parameter namePropertiesName
|
||||
- Interface QuotaRequestOneResourceSubmitResponse has a new optional parameter typePropertiesType
|
||||
- Interface ReservationOrderResponse has a new optional parameter benefitStartTime
|
||||
- Interface ReservationsProperties has a new optional parameter benefitStartTime
|
||||
- Interface ReservationSummary has a new optional parameter processingCount
|
||||
- Enum KnownDisplayProvisioningState has a new value Processing
|
||||
- Enum KnownReservationStatusCode has a new value Processing
|
||||
- Enum KnownReservedResourceType has a new value VirtualMachineSoftware
|
||||
|
||||
|
||||
## 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.
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021 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.
|
|
@ -16,6 +16,8 @@ This API describe Azure Reservation
|
|||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge and Firefox.
|
||||
|
||||
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- An [Azure subscription][azure_sub].
|
||||
|
@ -49,7 +51,17 @@ For more information about how to create an Azure AD Application check out [this
|
|||
```javascript
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const client = new AzureReservationAPI(new DefaultAzureCredential());
|
||||
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
|
||||
|
||||
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
const client = new AzureReservationAPI(new DefaultAzureCredential(), subscriptionId);
|
||||
|
||||
// For client-side applications running in the browser, use this code instead:
|
||||
// const credential = new InteractiveBrowserCredential({
|
||||
// tenantId: "<YOUR_TENANT_ID>",
|
||||
// clientId: "<YOUR_CLIENT_ID>"
|
||||
// });
|
||||
// const client = new AzureReservationAPI(credential, subscriptionId);
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb",
|
||||
"commit": "8a9bd9c5b65e5c3e5a8536f3c5b2b15bf9920b5d",
|
||||
"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",
|
||||
"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:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\reservations\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.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"
|
||||
"release_tool": "@azure-tools/js-sdk-release-tools@2.2.6",
|
||||
"use": "@autorest/typescript@6.0.0-alpha.19.20220408.1"
|
||||
}
|
|
@ -1,18 +1,31 @@
|
|||
{
|
||||
"$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" },
|
||||
"docModel": {
|
||||
"enabled": true
|
||||
},
|
||||
"apiReport": {
|
||||
"enabled": true,
|
||||
"reportFolder": "./review"
|
||||
},
|
||||
"dtsRollup": {
|
||||
"enabled": true,
|
||||
"untrimmedFilePath": "",
|
||||
"publicTrimmedFilePath": "./types/arm-reservations.d.ts"
|
||||
},
|
||||
"messages": {
|
||||
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
|
||||
"tsdocMessageReporting": {
|
||||
"default": {
|
||||
"logLevel": "none"
|
||||
}
|
||||
},
|
||||
"extractorMessageReporting": {
|
||||
"ae-missing-release-tag": { "logLevel": "none" },
|
||||
"ae-unresolved-link": { "logLevel": "none" }
|
||||
"ae-missing-release-tag": {
|
||||
"logLevel": "none"
|
||||
},
|
||||
"ae-unresolved-link": {
|
||||
"logLevel": "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
"sdk-type": "mgmt",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "A generated SDK for AzureReservationAPI.",
|
||||
"version": "7.0.0",
|
||||
"version": "7.1.0",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
|
@ -11,9 +11,9 @@
|
|||
"@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-client": "^1.5.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-rest-pipeline": "^1.1.0",
|
||||
"@azure/core-rest-pipeline": "^1.8.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -29,13 +29,13 @@
|
|||
"types": "./types/arm-reservations.d.ts",
|
||||
"devDependencies": {
|
||||
"@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",
|
||||
"@rollup/plugin-commonjs": "^21.0.1",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-multi-entry": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.1.3",
|
||||
"mkdirp": "^1.0.4",
|
||||
"rollup": "^1.16.3",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
"rollup": "^2.66.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"typescript": "~4.2.0",
|
||||
"uglify-js": "^3.4.9",
|
||||
"rimraf": "^3.0.0",
|
||||
|
|
|
@ -231,14 +231,20 @@ export interface CreateGenericQuotaRequestParameters {
|
|||
|
||||
// @public
|
||||
export interface CurrentQuotaLimit {
|
||||
readonly id?: string;
|
||||
readonly message?: string;
|
||||
readonly name?: string;
|
||||
properties?: QuotaProperties;
|
||||
readonly provisioningState?: QuotaRequestState;
|
||||
readonly type?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CurrentQuotaLimitBase {
|
||||
readonly id?: string;
|
||||
readonly name?: string;
|
||||
properties?: QuotaProperties;
|
||||
readonly type?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
|
@ -366,6 +372,9 @@ export type GetAppliedReservationListResponse = AppliedReservations;
|
|||
// @public
|
||||
export interface GetCatalogOptionalParams extends coreClient.OperationOptions {
|
||||
location?: string;
|
||||
offerId?: string;
|
||||
planId?: string;
|
||||
publisherId?: string;
|
||||
reservedResourceType?: string;
|
||||
}
|
||||
|
||||
|
@ -420,6 +429,8 @@ export enum KnownDisplayProvisioningState {
|
|||
// (undocumented)
|
||||
Pending = "Pending",
|
||||
// (undocumented)
|
||||
Processing = "Processing",
|
||||
// (undocumented)
|
||||
Succeeded = "Succeeded"
|
||||
}
|
||||
|
||||
|
@ -704,6 +715,8 @@ export enum KnownReservationStatusCode {
|
|||
// (undocumented)
|
||||
Pending = "Pending",
|
||||
// (undocumented)
|
||||
Processing = "Processing",
|
||||
// (undocumented)
|
||||
PurchaseError = "PurchaseError",
|
||||
// (undocumented)
|
||||
Split = "Split",
|
||||
|
@ -772,6 +785,8 @@ export enum KnownReservedResourceType {
|
|||
// (undocumented)
|
||||
VirtualMachines = "VirtualMachines",
|
||||
// (undocumented)
|
||||
VirtualMachineSoftware = "VirtualMachineSoftware",
|
||||
// (undocumented)
|
||||
VMwareCloudSimple = "VMwareCloudSimple"
|
||||
}
|
||||
|
||||
|
@ -963,7 +978,7 @@ export interface QuotaCreateOrUpdateOptionalParams extends coreClient.OperationO
|
|||
}
|
||||
|
||||
// @public
|
||||
export type QuotaCreateOrUpdateResponse = QuotaRequestOneResourceSubmitResponse;
|
||||
export type QuotaCreateOrUpdateResponse = CurrentQuotaLimitBase;
|
||||
|
||||
// @public
|
||||
export interface QuotaGetHeaders {
|
||||
|
@ -1044,12 +1059,15 @@ export interface QuotaRequestDetailsList {
|
|||
// @public
|
||||
export interface QuotaRequestOneResourceSubmitResponse {
|
||||
readonly id?: string;
|
||||
readonly idPropertiesId?: string;
|
||||
readonly message?: string;
|
||||
readonly name?: string;
|
||||
readonly namePropertiesName?: string;
|
||||
properties?: QuotaProperties;
|
||||
readonly provisioningState?: QuotaRequestState;
|
||||
readonly requestSubmitTime?: Date;
|
||||
readonly type?: string;
|
||||
readonly typePropertiesType?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
|
@ -1120,7 +1138,7 @@ export interface QuotaUpdateOptionalParams extends coreClient.OperationOptions {
|
|||
}
|
||||
|
||||
// @public
|
||||
export type QuotaUpdateResponse = QuotaRequestOneResourceSubmitResponse;
|
||||
export type QuotaUpdateResponse = CurrentQuotaLimitBase;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface RenewPropertiesResponse {
|
||||
|
@ -1329,6 +1347,7 @@ export type ReservationOrderPurchaseResponse = ReservationOrderResponse;
|
|||
|
||||
// @public (undocumented)
|
||||
export interface ReservationOrderResponse {
|
||||
benefitStartTime?: Date;
|
||||
billingPlan?: ReservationBillingPlan;
|
||||
createdDateTime?: Date;
|
||||
displayName?: string;
|
||||
|
@ -1389,6 +1408,7 @@ export interface ReservationsProperties {
|
|||
appliedScopes?: string[];
|
||||
appliedScopeType?: AppliedScopeType;
|
||||
archived?: boolean;
|
||||
benefitStartTime?: Date;
|
||||
billingPlan?: ReservationBillingPlan;
|
||||
billingScopeId?: string;
|
||||
capabilities?: string;
|
||||
|
@ -1436,6 +1456,7 @@ export interface ReservationSummary {
|
|||
readonly expiringCount?: number;
|
||||
readonly failedCount?: number;
|
||||
readonly pendingCount?: number;
|
||||
readonly processingCount?: number;
|
||||
readonly succeededCount?: number;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,62 +14,14 @@ 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
|
||||
* A function that can determine whether a rollup warning should be ignored. If
|
||||
* the function returns `true`, then the warning will not be displayed.
|
||||
*/
|
||||
|
||||
function ignoreNiseSinonEvalWarnings(warning) {
|
||||
function ignoreNiseSinonEval(warning) {
|
||||
return (
|
||||
warning.code === "EVAL" &&
|
||||
warning.id &&
|
||||
|
@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) {
|
|||
);
|
||||
}
|
||||
|
||||
function ignoreChaiCircularDependencyWarnings(warning) {
|
||||
function ignoreChaiCircularDependency(warning) {
|
||||
return (
|
||||
warning.code === "CIRCULAR_DEPENDENCY" &&
|
||||
warning.importer && warning.importer.includes("node_modules/chai") === true
|
||||
);
|
||||
}
|
||||
|
||||
const warningInhibitors = [
|
||||
ignoreChaiCircularDependencyWarnings,
|
||||
ignoreNiseSinonEvalWarnings
|
||||
];
|
||||
const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
|
||||
|
||||
/**
|
||||
* Construct a warning handler for the shared rollup configuration
|
||||
|
@ -122,22 +71,7 @@ function makeBrowserTestConfig() {
|
|||
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()
|
||||
}
|
||||
}),
|
||||
cjs(),
|
||||
json(),
|
||||
sourcemaps()
|
||||
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
|
||||
|
@ -173,7 +107,7 @@ export function makeConfig(pkg, options) {
|
|||
],
|
||||
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
|
||||
preserveSymlinks: false,
|
||||
plugins: [sourcemaps(), nodeResolve(), cjs()]
|
||||
plugins: [sourcemaps(), nodeResolve()]
|
||||
};
|
||||
|
||||
const config = [baseConfig];
|
||||
|
|
|
@ -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.
|
||||
import {
|
||||
CalculateExchangeRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/CalculateExchange.json
|
||||
*/
|
||||
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,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.
|
||||
import { ExchangeRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/Exchange.json
|
||||
*/
|
||||
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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetAppliedReservations.json
|
||||
*/
|
||||
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,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.
|
||||
import {
|
||||
GetCatalogOptionalParams,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetCatalog.json
|
||||
*/
|
||||
async function catalog() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const reservedResourceType = "VirtualMachines";
|
||||
const location = "eastus";
|
||||
const options: GetCatalogOptionalParams = { reservedResourceType, 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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetOperations.json
|
||||
*/
|
||||
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,165 @@
|
|||
/*
|
||||
* 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.
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,62 @@
|
|||
/*
|
||||
* 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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,84 @@
|
|||
/*
|
||||
* 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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,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.
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,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.
|
||||
import {
|
||||
AvailableScopeRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetAvailableScope.json
|
||||
*/
|
||||
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,38 @@
|
|||
/*
|
||||
* 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.
|
||||
import {
|
||||
ReservationGetOptionalParams,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get specific `Reservation` details.
|
||||
*
|
||||
* @summary Get specific `Reservation` details.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationDetails.json
|
||||
*/
|
||||
async function getReservation() {
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const expand = "renewProperties";
|
||||
const options: ReservationGetOptionalParams = { expand };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.get(
|
||||
reservationId,
|
||||
reservationOrderId,
|
||||
options
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservation().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.
|
||||
import {
|
||||
ReservationListAllOptionalParams,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant.
|
||||
*
|
||||
* @summary List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservations.json
|
||||
*/
|
||||
async function catalog() {
|
||||
const filter = "(properties/archived eq false)";
|
||||
const orderby = "properties/displayName asc";
|
||||
const skiptoken = 50;
|
||||
const take = 1;
|
||||
const options: ReservationListAllOptionalParams = {
|
||||
filter,
|
||||
orderby,
|
||||
skiptoken,
|
||||
take
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.listAll(options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
catalog().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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationRevisions.json
|
||||
*/
|
||||
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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationsFromOrder.json
|
||||
*/
|
||||
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,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.
|
||||
import { MergeRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/MergeReservations.json
|
||||
*/
|
||||
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,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.
|
||||
import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Calculate price for placing a `ReservationOrder`.
|
||||
*
|
||||
* @summary Calculate price for placing a `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateReservationOrder.json
|
||||
*/
|
||||
async function purchase() {
|
||||
const body: PurchaseRequest = {
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Monthly",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "TestReservationOrder",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
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.calculate(body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
purchase().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.
|
||||
import {
|
||||
ChangeDirectoryRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/ChangeDirectoryReservationOrder.json
|
||||
*/
|
||||
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,49 @@
|
|||
/*
|
||||
* 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.
|
||||
import {
|
||||
ReservationOrderGetOptionalParams,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrderDetails.json
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json
|
||||
*/
|
||||
async function getReservationWithExpandPayments() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const expand = "schedule";
|
||||
const options: ReservationOrderGetOptionalParams = { 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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrders.json
|
||||
*/
|
||||
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,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.
|
||||
import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/PurchaseReservationOrder.json
|
||||
*/
|
||||
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.
|
||||
import { SplitRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/SplitReservation.json
|
||||
*/
|
||||
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,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.
|
||||
import { Patch, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/UpdateReservation.json
|
||||
*/
|
||||
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);
|
|
@ -7,19 +7,30 @@ These sample programs show how to use the JavaScript client libraries for in som
|
|||
| [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 |
|
||||
| [calculateExchangePostSample.js][calculateexchangepostsample] | 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/2022-03-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 |
|
||||
| [exchangePostSample.js][exchangepostsample] | 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/2022-03-01/examples/Exchange.json |
|
||||
| [getAppliedReservationListSample.js][getappliedreservationlistsample] | 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/2022-03-01/examples/GetAppliedReservations.json |
|
||||
| [getCatalogSample.js][getcatalogsample] | 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/2022-03-01/examples/GetCatalog.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 |
|
||||
| [operationListSample.js][operationlistsample] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetOperations.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 |
|
||||
| [quotaCreateOrUpdateSample.js][quotacreateorupdatesample] | 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 |
|
||||
| [quotaGetSample.js][quotagetsample] | 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 |
|
||||
| [quotaListSample.js][quotalistsample] | 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 |
|
||||
| [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 |
|
||||
| [quotaRequestStatusGetSample.js][quotarequeststatusgetsample] | 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 |
|
||||
| [quotaRequestStatusListSample.js][quotarequeststatuslistsample] | 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 |
|
||||
| [quotaUpdateSample.js][quotaupdatesample] | 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 |
|
||||
| [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 |
|
||||
|
@ -27,9 +38,22 @@ These sample programs show how to use the JavaScript client libraries for in som
|
|||
| [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 |
|
||||
| [reservationAvailableScopesSample.js][reservationavailablescopessample] | Get Available Scopes for `Reservation`. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetAvailableScope.json |
|
||||
| [reservationGetSample.js][reservationgetsample] | Get specific `Reservation` details. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationDetails.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 |
|
||||
| [reservationListAllSample.js][reservationlistallsample] | List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservations.json |
|
||||
| [reservationListRevisionsSample.js][reservationlistrevisionssample] | List of all the revisions for the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationRevisions.json |
|
||||
| [reservationListSample.js][reservationlistsample] | List `Reservation`s within a single `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationsFromOrder.json |
|
||||
| [reservationMergeSample.js][reservationmergesample] | 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/2022-03-01/examples/MergeReservations.json |
|
||||
| [reservationOrderCalculateSample.js][reservationordercalculatesample] | Calculate price for placing a `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateReservationOrder.json |
|
||||
| [reservationOrderChangeDirectorySample.js][reservationorderchangedirectorysample] | 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/2022-03-01/examples/ChangeDirectoryReservationOrder.json |
|
||||
| [reservationOrderGetSample.js][reservationordergetsample] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrderDetails.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 |
|
||||
| [reservationOrderListSample.js][reservationorderlistsample] | 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/2022-03-01/examples/GetReservationOrders.json |
|
||||
| [reservationOrderPurchaseSample.js][reservationorderpurchasesample] | Purchase `ReservationOrder` and create resource under the specified URI. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/PurchaseReservationOrder.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 |
|
||||
| [reservationSplitSample.js][reservationsplitsample] | Split a `Reservation` into two `Reservation`s with specified quantity distribution. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/SplitReservation.json |
|
||||
| [reservationUpdateSample.js][reservationupdatesample] | Updates the applied scopes of the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/UpdateReservation.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
|
||||
|
@ -73,19 +97,30 @@ Take a look at our [API Documentation][apiref] for more information about the AP
|
|||
[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
|
||||
[calculateexchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchangePostSample.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
|
||||
[exchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/exchangePostSample.js
|
||||
[getappliedreservationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/getAppliedReservationListSample.js
|
||||
[getcatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/getCatalogSample.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
|
||||
[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/operationListSample.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
|
||||
[quotacreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaCreateOrUpdateSample.js
|
||||
[quotagetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaGetSample.js
|
||||
[quotalistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaListSample.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
|
||||
[quotarequeststatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatusGetSample.js
|
||||
[quotarequeststatuslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatusListSample.js
|
||||
[quotaupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaUpdateSample.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
|
||||
|
@ -93,9 +128,22 @@ Take a look at our [API Documentation][apiref] for more information about the AP
|
|||
[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
|
||||
[reservationavailablescopessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationAvailableScopesSample.js
|
||||
[reservationgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationGetSample.js
|
||||
[reservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationList.js
|
||||
[reservationlistallsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListAllSample.js
|
||||
[reservationlistrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListRevisionsSample.js
|
||||
[reservationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListSample.js
|
||||
[reservationmergesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationMergeSample.js
|
||||
[reservationordercalculatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderCalculateSample.js
|
||||
[reservationorderchangedirectorysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderChangeDirectorySample.js
|
||||
[reservationordergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderGetSample.js
|
||||
[reservationorderlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderList.js
|
||||
[reservationorderlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderListSample.js
|
||||
[reservationorderpurchasesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderPurchaseSample.js
|
||||
[reservationrevisions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationRevisions.js
|
||||
[reservationsplitsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationSplitSample.js
|
||||
[reservationupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationUpdateSample.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/
|
||||
|
|
|
@ -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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/CalculateExchange.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/Exchange.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetAppliedReservations.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetCatalog.json
|
||||
*/
|
||||
async function catalog() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const reservedResourceType = "VirtualMachines";
|
||||
const location = "eastus";
|
||||
const options = { reservedResourceType, 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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetOperations.json
|
||||
*/
|
||||
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,158 @@
|
|||
/*
|
||||
* 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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,54 @@
|
|||
/*
|
||||
* 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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,69 @@
|
|||
/*
|
||||
* 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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetAvailableScope.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get specific `Reservation` details.
|
||||
*
|
||||
* @summary Get specific `Reservation` details.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationDetails.json
|
||||
*/
|
||||
async function getReservation() {
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const expand = "renewProperties";
|
||||
const options = { expand };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.get(reservationId, reservationOrderId, options);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservation().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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant.
|
||||
*
|
||||
* @summary List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservations.json
|
||||
*/
|
||||
async function catalog() {
|
||||
const filter = "(properties/archived eq false)";
|
||||
const orderby = "properties/displayName asc";
|
||||
const skiptoken = 50;
|
||||
const take = 1;
|
||||
const options = {
|
||||
filter,
|
||||
orderby,
|
||||
skiptoken,
|
||||
take,
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.listAll(options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
catalog().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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationRevisions.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationsFromOrder.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/MergeReservations.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Calculate price for placing a `ReservationOrder`.
|
||||
*
|
||||
* @summary Calculate price for placing a `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateReservationOrder.json
|
||||
*/
|
||||
async function purchase() {
|
||||
const body = {
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Monthly",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "TestReservationOrder",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
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.calculate(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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/ChangeDirectoryReservationOrder.json
|
||||
*/
|
||||
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,46 @@
|
|||
/*
|
||||
* 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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrderDetails.json
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json
|
||||
*/
|
||||
async function getReservationWithExpandPayments() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const expand = "schedule";
|
||||
const options = { 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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrders.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/PurchaseReservationOrder.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/SplitReservation.json
|
||||
*/
|
||||
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,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.
|
||||
const { AzureReservationAPI } = require("@azure/arm-reservations");
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/UpdateReservation.json
|
||||
*/
|
||||
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);
|
|
@ -7,19 +7,30 @@ These sample programs show how to use the TypeScript client libraries for in som
|
|||
| [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 |
|
||||
| [calculateExchangePostSample.ts][calculateexchangepostsample] | 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/2022-03-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 |
|
||||
| [exchangePostSample.ts][exchangepostsample] | 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/2022-03-01/examples/Exchange.json |
|
||||
| [getAppliedReservationListSample.ts][getappliedreservationlistsample] | 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/2022-03-01/examples/GetAppliedReservations.json |
|
||||
| [getCatalogSample.ts][getcatalogsample] | 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/2022-03-01/examples/GetCatalog.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 |
|
||||
| [operationListSample.ts][operationlistsample] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetOperations.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 |
|
||||
| [quotaCreateOrUpdateSample.ts][quotacreateorupdatesample] | 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 |
|
||||
| [quotaGetSample.ts][quotagetsample] | 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 |
|
||||
| [quotaListSample.ts][quotalistsample] | 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 |
|
||||
| [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 |
|
||||
| [quotaRequestStatusGetSample.ts][quotarequeststatusgetsample] | 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 |
|
||||
| [quotaRequestStatusListSample.ts][quotarequeststatuslistsample] | 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 |
|
||||
| [quotaUpdateSample.ts][quotaupdatesample] | 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 |
|
||||
| [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 |
|
||||
|
@ -27,9 +38,22 @@ These sample programs show how to use the TypeScript client libraries for in som
|
|||
| [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 |
|
||||
| [reservationAvailableScopesSample.ts][reservationavailablescopessample] | Get Available Scopes for `Reservation`. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetAvailableScope.json |
|
||||
| [reservationGetSample.ts][reservationgetsample] | Get specific `Reservation` details. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationDetails.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 |
|
||||
| [reservationListAllSample.ts][reservationlistallsample] | List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservations.json |
|
||||
| [reservationListRevisionsSample.ts][reservationlistrevisionssample] | List of all the revisions for the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationRevisions.json |
|
||||
| [reservationListSample.ts][reservationlistsample] | List `Reservation`s within a single `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationsFromOrder.json |
|
||||
| [reservationMergeSample.ts][reservationmergesample] | 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/2022-03-01/examples/MergeReservations.json |
|
||||
| [reservationOrderCalculateSample.ts][reservationordercalculatesample] | Calculate price for placing a `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateReservationOrder.json |
|
||||
| [reservationOrderChangeDirectorySample.ts][reservationorderchangedirectorysample] | 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/2022-03-01/examples/ChangeDirectoryReservationOrder.json |
|
||||
| [reservationOrderGetSample.ts][reservationordergetsample] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrderDetails.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 |
|
||||
| [reservationOrderListSample.ts][reservationorderlistsample] | 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/2022-03-01/examples/GetReservationOrders.json |
|
||||
| [reservationOrderPurchaseSample.ts][reservationorderpurchasesample] | Purchase `ReservationOrder` and create resource under the specified URI. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/PurchaseReservationOrder.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 |
|
||||
| [reservationSplitSample.ts][reservationsplitsample] | Split a `Reservation` into two `Reservation`s with specified quantity distribution. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/SplitReservation.json |
|
||||
| [reservationUpdateSample.ts][reservationupdatesample] | Updates the applied scopes of the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/UpdateReservation.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
|
||||
|
@ -85,19 +109,30 @@ Take a look at our [API Documentation][apiref] for more information about the AP
|
|||
[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
|
||||
[calculateexchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchangePostSample.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
|
||||
[exchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/exchangePostSample.ts
|
||||
[getappliedreservationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/getAppliedReservationListSample.ts
|
||||
[getcatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/getCatalogSample.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
|
||||
[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/operationListSample.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
|
||||
[quotacreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaCreateOrUpdateSample.ts
|
||||
[quotagetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaGetSample.ts
|
||||
[quotalistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaListSample.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
|
||||
[quotarequeststatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatusGetSample.ts
|
||||
[quotarequeststatuslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatusListSample.ts
|
||||
[quotaupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaUpdateSample.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
|
||||
|
@ -105,9 +140,22 @@ Take a look at our [API Documentation][apiref] for more information about the AP
|
|||
[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
|
||||
[reservationavailablescopessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationAvailableScopesSample.ts
|
||||
[reservationgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationGetSample.ts
|
||||
[reservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationList.ts
|
||||
[reservationlistallsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListAllSample.ts
|
||||
[reservationlistrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListRevisionsSample.ts
|
||||
[reservationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListSample.ts
|
||||
[reservationmergesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationMergeSample.ts
|
||||
[reservationordercalculatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderCalculateSample.ts
|
||||
[reservationorderchangedirectorysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderChangeDirectorySample.ts
|
||||
[reservationordergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderGetSample.ts
|
||||
[reservationorderlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderList.ts
|
||||
[reservationorderlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderListSample.ts
|
||||
[reservationorderpurchasesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderPurchaseSample.ts
|
||||
[reservationrevisions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationRevisions.ts
|
||||
[reservationsplitsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationSplitSample.ts
|
||||
[reservationupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUpdateSample.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/
|
||||
|
|
|
@ -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.
|
||||
import {
|
||||
CalculateExchangeRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/CalculateExchange.json
|
||||
*/
|
||||
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,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.
|
||||
import { ExchangeRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/Exchange.json
|
||||
*/
|
||||
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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetAppliedReservations.json
|
||||
*/
|
||||
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,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.
|
||||
import {
|
||||
GetCatalogOptionalParams,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetCatalog.json
|
||||
*/
|
||||
async function catalog() {
|
||||
const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6";
|
||||
const reservedResourceType = "VirtualMachines";
|
||||
const location = "eastus";
|
||||
const options: GetCatalogOptionalParams = { reservedResourceType, 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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetOperations.json
|
||||
*/
|
||||
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,165 @@
|
|||
/*
|
||||
* 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.
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,62 @@
|
|||
/*
|
||||
* 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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,84 @@
|
|||
/*
|
||||
* 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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,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.
|
||||
import {
|
||||
CurrentQuotaLimitBase,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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,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.
|
||||
import {
|
||||
AvailableScopeRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetAvailableScope.json
|
||||
*/
|
||||
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,38 @@
|
|||
/*
|
||||
* 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.
|
||||
import {
|
||||
ReservationGetOptionalParams,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Get specific `Reservation` details.
|
||||
*
|
||||
* @summary Get specific `Reservation` details.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationDetails.json
|
||||
*/
|
||||
async function getReservation() {
|
||||
const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc";
|
||||
const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da";
|
||||
const expand = "renewProperties";
|
||||
const options: ReservationGetOptionalParams = { expand };
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const result = await client.reservation.get(
|
||||
reservationId,
|
||||
reservationOrderId,
|
||||
options
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
getReservation().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.
|
||||
import {
|
||||
ReservationListAllOptionalParams,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant.
|
||||
*
|
||||
* @summary List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservations.json
|
||||
*/
|
||||
async function catalog() {
|
||||
const filter = "(properties/archived eq false)";
|
||||
const orderby = "properties/displayName asc";
|
||||
const skiptoken = 50;
|
||||
const take = 1;
|
||||
const options: ReservationListAllOptionalParams = {
|
||||
filter,
|
||||
orderby,
|
||||
skiptoken,
|
||||
take
|
||||
};
|
||||
const credential = new DefaultAzureCredential();
|
||||
const client = new AzureReservationAPI(credential);
|
||||
const resArray = new Array();
|
||||
for await (let item of client.reservation.listAll(options)) {
|
||||
resArray.push(item);
|
||||
}
|
||||
console.log(resArray);
|
||||
}
|
||||
|
||||
catalog().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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationRevisions.json
|
||||
*/
|
||||
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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationsFromOrder.json
|
||||
*/
|
||||
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,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.
|
||||
import { MergeRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/MergeReservations.json
|
||||
*/
|
||||
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,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.
|
||||
import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* This sample demonstrates how to Calculate price for placing a `ReservationOrder`.
|
||||
*
|
||||
* @summary Calculate price for placing a `ReservationOrder`.
|
||||
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateReservationOrder.json
|
||||
*/
|
||||
async function purchase() {
|
||||
const body: PurchaseRequest = {
|
||||
appliedScopeType: "Shared",
|
||||
appliedScopes: [],
|
||||
billingPlan: "Monthly",
|
||||
billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83",
|
||||
displayName: "TestReservationOrder",
|
||||
location: "westus",
|
||||
quantity: 1,
|
||||
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.calculate(body);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
purchase().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.
|
||||
import {
|
||||
ChangeDirectoryRequest,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/ChangeDirectoryReservationOrder.json
|
||||
*/
|
||||
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,49 @@
|
|||
/*
|
||||
* 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.
|
||||
import {
|
||||
ReservationOrderGetOptionalParams,
|
||||
AzureReservationAPI
|
||||
} from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrderDetails.json
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json
|
||||
*/
|
||||
async function getReservationWithExpandPayments() {
|
||||
const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9";
|
||||
const expand = "schedule";
|
||||
const options: ReservationOrderGetOptionalParams = { 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,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.
|
||||
import { AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/GetReservationOrders.json
|
||||
*/
|
||||
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,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.
|
||||
import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/PurchaseReservationOrder.json
|
||||
*/
|
||||
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.
|
||||
import { SplitRequest, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/SplitReservation.json
|
||||
*/
|
||||
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,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.
|
||||
import { Patch, AzureReservationAPI } from "@azure/arm-reservations";
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
|
||||
/**
|
||||
* 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/2022-03-01/examples/UpdateReservation.json
|
||||
*/
|
||||
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);
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
import * as coreClient from "@azure/core-client";
|
||||
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
||||
import * as coreAuth from "@azure/core-auth";
|
||||
import {
|
||||
ReservationImpl,
|
||||
|
@ -61,7 +62,7 @@ export class AzureReservationAPI extends coreClient.ServiceClient {
|
|||
credential: credentials
|
||||
};
|
||||
|
||||
const packageDetails = `azsdk-js-arm-reservations/7.0.0`;
|
||||
const packageDetails = `azsdk-js-arm-reservations/7.1.0`;
|
||||
const userAgentPrefix =
|
||||
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
||||
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
||||
|
@ -76,10 +77,34 @@ export class AzureReservationAPI extends coreClient.ServiceClient {
|
|||
userAgentOptions: {
|
||||
userAgentPrefix
|
||||
},
|
||||
baseUri: options.endpoint || "https://management.azure.com"
|
||||
baseUri:
|
||||
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
||||
};
|
||||
super(optionsWithDefaults);
|
||||
|
||||
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
||||
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
||||
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
||||
(pipelinePolicy) =>
|
||||
pipelinePolicy.name ===
|
||||
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
||||
);
|
||||
if (!bearerTokenAuthenticationPolicyFound) {
|
||||
this.pipeline.removePolicy({
|
||||
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
||||
});
|
||||
this.pipeline.addPolicy(
|
||||
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
||||
scopes: `${optionsWithDefaults.baseUri}/.default`,
|
||||
challengeCallbacks: {
|
||||
authorizeRequestOnChallenge:
|
||||
coreClient.authorizeRequestOnClaimChallenge
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Assigning values to Constant parameters
|
||||
this.$host = options.$host || "https://management.azure.com";
|
||||
this.reservation = new ReservationImpl(this);
|
||||
|
@ -152,7 +177,10 @@ const getCatalogOperationSpec: coreClient.OperationSpec = {
|
|||
queryParameters: [
|
||||
Parameters.apiVersion,
|
||||
Parameters.reservedResourceType,
|
||||
Parameters.location
|
||||
Parameters.location,
|
||||
Parameters.publisherId,
|
||||
Parameters.offerId,
|
||||
Parameters.planId
|
||||
],
|
||||
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
||||
headerParameters: [Parameters.accept],
|
||||
|
|
|
@ -282,6 +282,8 @@ export interface ReservationOrderResponse {
|
|||
createdDateTime?: Date;
|
||||
/** This is the date when the Reservation will expire. */
|
||||
expiryDate?: Date;
|
||||
/** This is the DateTime when the reservation benefit started. */
|
||||
benefitStartTime?: Date;
|
||||
/** Total Quantity of the SKUs purchased in the Reservation. */
|
||||
originalQuantity?: number;
|
||||
/** Represent the term of Reservation. */
|
||||
|
@ -361,6 +363,8 @@ export interface ReservationsProperties {
|
|||
provisioningState?: ProvisioningState;
|
||||
/** DateTime of the Reservation starting when this version is effective from. */
|
||||
effectiveDateTime?: Date;
|
||||
/** This is the DateTime when the reservation benefit started. */
|
||||
benefitStartTime?: Date;
|
||||
/**
|
||||
* DateTime of the last time the Reservation was updated.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
|
@ -774,6 +778,11 @@ export interface ReservationSummary {
|
|||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly cancelledCount?: number;
|
||||
/**
|
||||
* The number of reservation in Processing state
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly processingCount?: number;
|
||||
}
|
||||
|
||||
/** Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. */
|
||||
|
@ -827,6 +836,21 @@ export interface ChangeDirectoryResult {
|
|||
|
||||
/** Quota properties. */
|
||||
export interface CurrentQuotaLimitBase {
|
||||
/**
|
||||
* The quota request ID.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly id?: string;
|
||||
/**
|
||||
* The name of the quota request.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly name?: string;
|
||||
/**
|
||||
* Type of resource. "Microsoft.Capacity/ServiceLimits"
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly type?: string;
|
||||
/** Quota properties for the resource. */
|
||||
properties?: QuotaProperties;
|
||||
}
|
||||
|
@ -899,42 +923,6 @@ export interface ServiceErrorDetail {
|
|||
readonly message?: string;
|
||||
}
|
||||
|
||||
/** Response for the quota submission request. */
|
||||
export interface QuotaRequestOneResourceSubmitResponse {
|
||||
/**
|
||||
* The quota request ID.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly id?: string;
|
||||
/**
|
||||
* The name of the quota request.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly name?: string;
|
||||
/**
|
||||
* Type of resource. "Microsoft.Capacity/ServiceLimits"
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly type?: string;
|
||||
/**
|
||||
* The quota request status.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly provisioningState?: QuotaRequestState;
|
||||
/**
|
||||
* User friendly status message.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly message?: string;
|
||||
/**
|
||||
* The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly requestSubmitTime?: Date;
|
||||
/** Quota properties for the resource. */
|
||||
properties?: QuotaProperties;
|
||||
}
|
||||
|
||||
/** Response with request ID that the quota request was accepted. */
|
||||
export interface QuotaRequestSubmitResponse201 {
|
||||
/**
|
||||
|
@ -1073,6 +1061,21 @@ export interface CurrentQuotaLimit {
|
|||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly message?: string;
|
||||
/**
|
||||
* The quota request ID.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly id?: string;
|
||||
/**
|
||||
* The name of the quota request.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly name?: string;
|
||||
/**
|
||||
* Type of resource. "Microsoft.Capacity/ServiceLimits"
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly type?: string;
|
||||
/** Quota properties for the resource. */
|
||||
properties?: QuotaProperties;
|
||||
}
|
||||
|
@ -1091,6 +1094,57 @@ export interface CreateGenericQuotaRequestParameters {
|
|||
value?: CurrentQuotaLimitBase[];
|
||||
}
|
||||
|
||||
/** Response for the quota submission request. */
|
||||
export interface QuotaRequestOneResourceSubmitResponse {
|
||||
/**
|
||||
* The quota request ID.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly id?: string;
|
||||
/**
|
||||
* The name of the quota request.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly name?: string;
|
||||
/**
|
||||
* Type of resource. "Microsoft.Capacity/ServiceLimits"
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly type?: string;
|
||||
/**
|
||||
* The quota request status.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly provisioningState?: QuotaRequestState;
|
||||
/**
|
||||
* User friendly status message.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly message?: string;
|
||||
/**
|
||||
* The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly requestSubmitTime?: Date;
|
||||
/**
|
||||
* The quota request ID.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly idPropertiesId?: string;
|
||||
/**
|
||||
* The name of the quota request.
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly namePropertiesName?: string;
|
||||
/**
|
||||
* Type of resource. "Microsoft.Capacity/ServiceLimits"
|
||||
* NOTE: This property will not be serialized. It can only be populated by the server.
|
||||
*/
|
||||
readonly typePropertiesType?: string;
|
||||
/** Quota properties for the resource. */
|
||||
properties?: QuotaProperties;
|
||||
}
|
||||
|
||||
/** Response for the quota submission request. */
|
||||
export interface QuotaRequestSubmitResponse {
|
||||
/**
|
||||
|
@ -1334,7 +1388,8 @@ export enum KnownReservedResourceType {
|
|||
DataFactory = "DataFactory",
|
||||
NetAppStorage = "NetAppStorage",
|
||||
AzureFiles = "AzureFiles",
|
||||
SqlEdge = "SqlEdge"
|
||||
SqlEdge = "SqlEdge",
|
||||
VirtualMachineSoftware = "VirtualMachineSoftware"
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1366,7 +1421,8 @@ export enum KnownReservedResourceType {
|
|||
* **DataFactory** \
|
||||
* **NetAppStorage** \
|
||||
* **AzureFiles** \
|
||||
* **SqlEdge**
|
||||
* **SqlEdge** \
|
||||
* **VirtualMachineSoftware**
|
||||
*/
|
||||
export type ReservedResourceType = string;
|
||||
|
||||
|
@ -1426,6 +1482,7 @@ export type PaymentStatus = string;
|
|||
export enum KnownReservationStatusCode {
|
||||
None = "None",
|
||||
Pending = "Pending",
|
||||
Processing = "Processing",
|
||||
Active = "Active",
|
||||
PurchaseError = "PurchaseError",
|
||||
PaymentInstrumentError = "PaymentInstrumentError",
|
||||
|
@ -1442,6 +1499,7 @@ export enum KnownReservationStatusCode {
|
|||
* ### Known values supported by the service
|
||||
* **None** \
|
||||
* **Pending** \
|
||||
* **Processing** \
|
||||
* **Active** \
|
||||
* **PurchaseError** \
|
||||
* **PaymentInstrumentError** \
|
||||
|
@ -1682,6 +1740,7 @@ export enum KnownDisplayProvisioningState {
|
|||
Expiring = "Expiring",
|
||||
Expired = "Expired",
|
||||
Pending = "Pending",
|
||||
Processing = "Processing",
|
||||
Cancelled = "Cancelled",
|
||||
Failed = "Failed"
|
||||
}
|
||||
|
@ -1695,6 +1754,7 @@ export enum KnownDisplayProvisioningState {
|
|||
* **Expiring** \
|
||||
* **Expired** \
|
||||
* **Pending** \
|
||||
* **Processing** \
|
||||
* **Cancelled** \
|
||||
* **Failed**
|
||||
*/
|
||||
|
@ -1876,6 +1936,12 @@ export interface GetCatalogOptionalParams extends coreClient.OperationOptions {
|
|||
reservedResourceType?: string;
|
||||
/** Filters the skus based on the location specified in this parameter. This can be an azure region or global */
|
||||
location?: string;
|
||||
/** Publisher id used to get the third party products */
|
||||
publisherId?: string;
|
||||
/** Offer id used to get the third party products */
|
||||
offerId?: string;
|
||||
/** Plan id used to get the third party products */
|
||||
planId?: string;
|
||||
}
|
||||
|
||||
/** Contains response data for the getCatalog operation. */
|
||||
|
@ -1992,7 +2058,7 @@ export interface QuotaCreateOrUpdateOptionalParams
|
|||
}
|
||||
|
||||
/** Contains response data for the createOrUpdate operation. */
|
||||
export type QuotaCreateOrUpdateResponse = QuotaRequestOneResourceSubmitResponse;
|
||||
export type QuotaCreateOrUpdateResponse = CurrentQuotaLimitBase;
|
||||
|
||||
/** Optional parameters. */
|
||||
export interface QuotaUpdateOptionalParams extends coreClient.OperationOptions {
|
||||
|
@ -2003,7 +2069,7 @@ export interface QuotaUpdateOptionalParams extends coreClient.OperationOptions {
|
|||
}
|
||||
|
||||
/** Contains response data for the update operation. */
|
||||
export type QuotaUpdateResponse = QuotaRequestOneResourceSubmitResponse;
|
||||
export type QuotaUpdateResponse = CurrentQuotaLimitBase;
|
||||
|
||||
/** Optional parameters. */
|
||||
export interface QuotaListOptionalParams extends coreClient.OperationOptions {}
|
||||
|
|
|
@ -854,6 +854,12 @@ export const ReservationOrderResponse: coreClient.CompositeMapper = {
|
|||
name: "Date"
|
||||
}
|
||||
},
|
||||
benefitStartTime: {
|
||||
serializedName: "properties.benefitStartTime",
|
||||
type: {
|
||||
name: "DateTime"
|
||||
}
|
||||
},
|
||||
originalQuantity: {
|
||||
serializedName: "properties.originalQuantity",
|
||||
type: {
|
||||
|
@ -1082,6 +1088,12 @@ export const ReservationsProperties: coreClient.CompositeMapper = {
|
|||
name: "DateTime"
|
||||
}
|
||||
},
|
||||
benefitStartTime: {
|
||||
serializedName: "benefitStartTime",
|
||||
type: {
|
||||
name: "DateTime"
|
||||
}
|
||||
},
|
||||
lastUpdatedDateTime: {
|
||||
serializedName: "lastUpdatedDateTime",
|
||||
readOnly: true,
|
||||
|
@ -2319,6 +2331,13 @@ export const ReservationSummary: coreClient.CompositeMapper = {
|
|||
type: {
|
||||
name: "Number"
|
||||
}
|
||||
},
|
||||
processingCount: {
|
||||
serializedName: "processingCount",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2451,6 +2470,27 @@ export const CurrentQuotaLimitBase: coreClient.CompositeMapper = {
|
|||
name: "Composite",
|
||||
className: "CurrentQuotaLimitBase",
|
||||
modelProperties: {
|
||||
id: {
|
||||
serializedName: "id",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
name: {
|
||||
serializedName: "name",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
type: {
|
||||
serializedName: "type",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
properties: {
|
||||
serializedName: "properties",
|
||||
type: {
|
||||
|
@ -2612,64 +2652,6 @@ export const ServiceErrorDetail: coreClient.CompositeMapper = {
|
|||
}
|
||||
};
|
||||
|
||||
export const QuotaRequestOneResourceSubmitResponse: coreClient.CompositeMapper = {
|
||||
type: {
|
||||
name: "Composite",
|
||||
className: "QuotaRequestOneResourceSubmitResponse",
|
||||
modelProperties: {
|
||||
id: {
|
||||
serializedName: "id",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
name: {
|
||||
serializedName: "name",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
type: {
|
||||
serializedName: "type",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
provisioningState: {
|
||||
serializedName: "properties.provisioningState",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
message: {
|
||||
serializedName: "properties.message",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
requestSubmitTime: {
|
||||
serializedName: "properties.requestSubmitTime",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "DateTime"
|
||||
}
|
||||
},
|
||||
properties: {
|
||||
serializedName: "properties.properties.properties",
|
||||
type: {
|
||||
name: "Composite",
|
||||
className: "QuotaProperties"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const QuotaRequestSubmitResponse201: coreClient.CompositeMapper = {
|
||||
type: {
|
||||
name: "Composite",
|
||||
|
@ -2946,6 +2928,27 @@ export const CurrentQuotaLimit: coreClient.CompositeMapper = {
|
|||
name: "String"
|
||||
}
|
||||
},
|
||||
id: {
|
||||
serializedName: "quotaInformation.id",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
name: {
|
||||
serializedName: "quotaInformation.name",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
type: {
|
||||
serializedName: "quotaInformation.type",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
properties: {
|
||||
serializedName: "quotaInformation.properties",
|
||||
type: {
|
||||
|
@ -3005,6 +3008,85 @@ export const CreateGenericQuotaRequestParameters: coreClient.CompositeMapper = {
|
|||
}
|
||||
};
|
||||
|
||||
export const QuotaRequestOneResourceSubmitResponse: coreClient.CompositeMapper = {
|
||||
type: {
|
||||
name: "Composite",
|
||||
className: "QuotaRequestOneResourceSubmitResponse",
|
||||
modelProperties: {
|
||||
id: {
|
||||
serializedName: "id",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
name: {
|
||||
serializedName: "name",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
type: {
|
||||
serializedName: "type",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
provisioningState: {
|
||||
serializedName: "properties.provisioningState",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
message: {
|
||||
serializedName: "properties.message",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
requestSubmitTime: {
|
||||
serializedName: "properties.requestSubmitTime",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "DateTime"
|
||||
}
|
||||
},
|
||||
idPropertiesId: {
|
||||
serializedName: "properties.properties.id",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
namePropertiesName: {
|
||||
serializedName: "properties.properties.name",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
typePropertiesType: {
|
||||
serializedName: "properties.properties.type",
|
||||
readOnly: true,
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
},
|
||||
properties: {
|
||||
serializedName: "properties.properties.properties",
|
||||
type: {
|
||||
name: "Composite",
|
||||
className: "QuotaProperties"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const QuotaRequestSubmitResponse: coreClient.CompositeMapper = {
|
||||
type: {
|
||||
name: "Composite",
|
||||
|
|
|
@ -89,7 +89,7 @@ export const reservationId: OperationURLParameter = {
|
|||
export const apiVersion: OperationQueryParameter = {
|
||||
parameterPath: "apiVersion",
|
||||
mapper: {
|
||||
defaultValue: "2021-07-01",
|
||||
defaultValue: "2022-03-01",
|
||||
isConstant: true,
|
||||
serializedName: "api-version",
|
||||
type: {
|
||||
|
@ -226,6 +226,36 @@ export const location: OperationQueryParameter = {
|
|||
}
|
||||
};
|
||||
|
||||
export const publisherId: OperationQueryParameter = {
|
||||
parameterPath: ["options", "publisherId"],
|
||||
mapper: {
|
||||
serializedName: "publisherId",
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const offerId: OperationQueryParameter = {
|
||||
parameterPath: ["options", "offerId"],
|
||||
mapper: {
|
||||
serializedName: "offerId",
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const planId: OperationQueryParameter = {
|
||||
parameterPath: ["options", "planId"],
|
||||
mapper: {
|
||||
serializedName: "planId",
|
||||
type: {
|
||||
name: "String"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const body3: OperationParameter = {
|
||||
parameterPath: "body",
|
||||
mapper: PurchaseRequestMapper
|
||||
|
|
|
@ -90,11 +90,13 @@ export class CalculateExchangeImpl implements CalculateExchange {
|
|||
{ body, options },
|
||||
postOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs,
|
||||
lroResourceLocationConfig: "azure-async-operation"
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,11 +87,13 @@ export class ExchangeImpl implements Exchange {
|
|||
{ body, options },
|
||||
postOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs,
|
||||
lroResourceLocationConfig: "azure-async-operation"
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -228,11 +228,13 @@ export class QuotaImpl implements Quota {
|
|||
},
|
||||
createOrUpdateOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs,
|
||||
lroResourceLocationConfig: "location"
|
||||
lroResourceLocationConfig: "original-uri"
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -352,11 +354,13 @@ export class QuotaImpl implements Quota {
|
|||
},
|
||||
updateOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs,
|
||||
lroResourceLocationConfig: "location"
|
||||
lroResourceLocationConfig: "original-uri"
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -470,16 +474,16 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = {
|
|||
httpMethod: "PUT",
|
||||
responses: {
|
||||
200: {
|
||||
bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse
|
||||
bodyMapper: Mappers.CurrentQuotaLimitBase
|
||||
},
|
||||
201: {
|
||||
bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse
|
||||
bodyMapper: Mappers.CurrentQuotaLimitBase
|
||||
},
|
||||
202: {
|
||||
bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse
|
||||
bodyMapper: Mappers.CurrentQuotaLimitBase
|
||||
},
|
||||
204: {
|
||||
bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse
|
||||
bodyMapper: Mappers.CurrentQuotaLimitBase
|
||||
},
|
||||
default: {
|
||||
bodyMapper: Mappers.ExceptionResponse
|
||||
|
@ -504,16 +508,16 @@ const updateOperationSpec: coreClient.OperationSpec = {
|
|||
httpMethod: "PATCH",
|
||||
responses: {
|
||||
200: {
|
||||
bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse
|
||||
bodyMapper: Mappers.CurrentQuotaLimitBase
|
||||
},
|
||||
201: {
|
||||
bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse
|
||||
bodyMapper: Mappers.CurrentQuotaLimitBase
|
||||
},
|
||||
202: {
|
||||
bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse
|
||||
bodyMapper: Mappers.CurrentQuotaLimitBase
|
||||
},
|
||||
204: {
|
||||
bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse
|
||||
bodyMapper: Mappers.CurrentQuotaLimitBase
|
||||
},
|
||||
default: {
|
||||
bodyMapper: Mappers.ExceptionResponse
|
||||
|
|
|
@ -284,10 +284,12 @@ export class ReservationImpl implements Reservation {
|
|||
{ reservationOrderId, reservationId, body, options },
|
||||
availableScopesOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -373,11 +375,13 @@ export class ReservationImpl implements Reservation {
|
|||
{ reservationOrderId, body, options },
|
||||
splitOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs,
|
||||
lroResourceLocationConfig: "location"
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -456,11 +460,13 @@ export class ReservationImpl implements Reservation {
|
|||
{ reservationOrderId, body, options },
|
||||
mergeOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs,
|
||||
lroResourceLocationConfig: "location"
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -573,10 +579,12 @@ export class ReservationImpl implements Reservation {
|
|||
{ reservationOrderId, reservationId, parameters, options },
|
||||
updateOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -172,11 +172,13 @@ export class ReservationOrderImpl implements ReservationOrder {
|
|||
{ reservationOrderId, body, options },
|
||||
purchaseOperationSpec
|
||||
);
|
||||
return new LroEngine(lro, {
|
||||
const poller = new LroEngine(lro, {
|
||||
resumeFrom: options?.resumeFrom,
|
||||
intervalInMs: options?.updateIntervalInMs,
|
||||
lroResourceLocationConfig: "location"
|
||||
});
|
||||
await poller.poll();
|
||||
return poller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,12 +9,25 @@
|
|||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"lib": ["es6", "dom"],
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"declaration": true,
|
||||
"outDir": "./dist-esm",
|
||||
"importHelpers": true,
|
||||
"paths": { "@azure/arm-reservations": ["./src/index"] }
|
||||
"paths": {
|
||||
"@azure/arm-reservations": [
|
||||
"./src/index"
|
||||
]
|
||||
}
|
||||
},
|
||||
"include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
"include": [
|
||||
"./src/**/*.ts",
|
||||
"./test/**/*.ts",
|
||||
"samples-dev/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
|
||||
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
|
@ -9,7 +9,7 @@ trigger:
|
|||
paths:
|
||||
include:
|
||||
- sdk/reservations/ci.mgmt.yml
|
||||
- sdk/reservations/arm-reservations/
|
||||
- sdk/reservations/arm-reservations
|
||||
pr:
|
||||
branches:
|
||||
include:
|
||||
|
@ -22,12 +22,11 @@ pr:
|
|||
paths:
|
||||
include:
|
||||
- sdk/reservations/ci.mgmt.yml
|
||||
- sdk/reservations/arm-reservations/
|
||||
|
||||
- sdk/reservations/arm-reservations
|
||||
extends:
|
||||
template: /eng/pipelines/templates/stages/archetype-sdk-client.yml
|
||||
parameters:
|
||||
ServiceDirectory: reservations
|
||||
Artifacts:
|
||||
- name: azure-arm-reservations
|
||||
safeName: azurearmreservations
|
||||
safeName: azurearmreservations
|
||||
|
|
Загрузка…
Ссылка в новой задаче