diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index cf01d30a0b5f..d1f14334c852 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -2229,7 +2229,7 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/chai-as-promised/7.1.5: @@ -2251,7 +2251,7 @@ packages: /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/cookie/0.4.1: @@ -2261,7 +2261,7 @@ packages: /@types/cors/2.8.13: resolution: {integrity: sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/debug/4.1.7: @@ -2273,7 +2273,7 @@ packages: /@types/decompress/4.2.4: resolution: {integrity: sha512-/C8kTMRTNiNuWGl5nEyKbPiMv6HA+0RbEXzFhFBEzASM6+oa4tJro9b8nj7eRlOFfuLdzUU+DS/GPDlvvzMOhA==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/eslint/8.4.10: @@ -2294,7 +2294,7 @@ packages: /@types/express-serve-static-core/4.17.33: resolution: {integrity: sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 dev: false @@ -2311,20 +2311,20 @@ packages: /@types/fs-extra/8.1.2: resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/glob/8.0.1: resolution: {integrity: sha512-8bVUjXZvJacUFkJXHdyZ9iH1Eaj5V7I8c4NdH5sQJsdXkqT4CA5Dhb4yb4VE/3asyx4L9ayZr1NIhTsWHczmMw==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/inquirer/8.2.5: @@ -2336,7 +2336,7 @@ packages: /@types/is-buffer/2.0.0: resolution: {integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/json-schema/7.0.11: @@ -2350,13 +2350,13 @@ packages: /@types/jsonwebtoken/9.0.1: resolution: {integrity: sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/jws/3.2.5: resolution: {integrity: sha512-xGTxZH34xOryaTN8CMsvhh9lfNqFuHiMoRvsLYWQdBJHqiECyfInXVl2eK8Jz2emxZWMIn5RBlmr3oDVPeWujw==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/mdast/3.0.10: @@ -2392,7 +2392,7 @@ packages: /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 form-data: 3.0.1 dev: false @@ -2439,7 +2439,7 @@ packages: /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/semaphore/1.1.1: @@ -2454,7 +2454,7 @@ packages: resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==} dependencies: '@types/mime': 3.0.1 - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/sinon/10.0.13: @@ -2476,13 +2476,13 @@ packages: /@types/stoppable/1.1.1: resolution: {integrity: sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/tough-cookie/4.0.2: @@ -2496,13 +2496,13 @@ packages: /@types/tunnel/0.0.1: resolution: {integrity: sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/tunnel/0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/underscore/1.11.4: @@ -2520,19 +2520,19 @@ packages: /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/ws/8.5.4: resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/xml2js/0.4.11: resolution: {integrity: sha512-JdigeAKmCyoJUiQljjr7tQG3if9NkqGUgwEUqBvV0N7LM4HyQk7UXCnusRa1lnvXAEYJ8mw8GtZWioagNztOwA==} dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false /@types/yargs-parser/21.0.0: @@ -2549,7 +2549,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 14.18.36 + '@types/node': 18.11.19 dev: false optional: true @@ -3668,7 +3668,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug/3.2.7: @@ -3928,7 +3928,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 4.6.4 + typescript: 4.9.5 dev: false /ecdsa-sig-formatter/1.0.11: @@ -3979,7 +3979,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.13 - '@types/node': 14.18.36 + '@types/node': 18.11.19 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -5026,7 +5026,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -14135,29 +14135,30 @@ packages: dev: false file:projects/arm-reservations.tgz: - resolution: {integrity: sha512-sWCPpvqJjw3kVxnOZVHqpXVVdO8x74IENh0BZ7k5FTiT4PxMRcEL+DRsXKh8yT4M/VKWfO9QoovfFw4L/Ik1IQ==, tarball: file:projects/arm-reservations.tgz} + resolution: {integrity: sha512-N4PO4IVbpdm5QGtcyu1Z+4Ov1kNaX9Mvf1u1BUEcNFUgWcoIf+VRv+ZDH8BeYabHtS3GoFkUOv20KOgTowjqCg==, tarball: file:projects/arm-reservations.tgz} name: '@rush-temp/arm-reservations' version: 0.0.0 dependencies: '@azure/identity': 2.1.0 - '@microsoft/api-extractor': 7.34.3 + '@microsoft/api-extractor': 7.34.3_@types+node@14.18.36 '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 '@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 '@types/chai': 4.3.4 + '@types/node': 14.18.36 chai: 4.3.7 cross-env: 7.0.3 + dotenv: 8.6.0 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_p2gydaekoyjvl5wd3ixslt7iq4 tslib: 2.5.0 - typescript: 4.6.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - supports-color dev: false diff --git a/sdk/reservations/arm-reservations/CHANGELOG.md b/sdk/reservations/arm-reservations/CHANGELOG.md index a3cdb513fb49..2e2cb055039a 100644 --- a/sdk/reservations/arm-reservations/CHANGELOG.md +++ b/sdk/reservations/arm-reservations/CHANGELOG.md @@ -1,15 +1,78 @@ # Release History + +## 8.0.0 (2023-02-01) + +**Features** -## 7.2.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation Return.beginPost + - Added operation Return.beginPostAndWait + - Added Interface AppliedScopeProperties + - Added Interface CatalogsResult + - Added Interface Commitment + - Added Interface GetCatalogNextOptionalParams + - Added Interface ProxyResource + - Added Interface ReservationMergeHeaders + - Added Interface ReservationOrderPurchaseHeaders + - Added Interface ReservationSplitHeaders + - Added Interface ReservationSwapProperties + - Added Interface ReservationUpdateHeaders + - Added Interface Resource + - Added Interface SavingsPlanPurchaseRequest + - Added Interface SavingsPlanToPurchaseCalculateExchange + - Added Interface SavingsPlanToPurchaseExchange + - Added Type Alias BillingPlan + - Added Type Alias CommitmentGrain + - Added Type Alias GetCatalogNextResponse + - Added Type Alias SavingsPlanTerm + - Interface CalculateExchangeRequestProperties has a new optional parameter savingsPlansToPurchase + - Interface CalculateExchangeResponseProperties has a new optional parameter savingsPlansToPurchase + - Interface ExchangeResponseProperties has a new optional parameter savingsPlansToPurchase + - Interface GetCatalogOptionalParams has a new optional parameter filter + - Interface GetCatalogOptionalParams has a new optional parameter skip + - Interface GetCatalogOptionalParams has a new optional parameter take + - Interface Patch has a new optional parameter appliedScopeProperties + - Interface Patch has a new optional parameter reviewDateTime + - Interface PurchaseRequest has a new optional parameter appliedScopeProperties + - Interface PurchaseRequest has a new optional parameter reviewDateTime + - Interface ReservationOrderResponse has a new optional parameter expiryDateTime + - Interface ReservationOrderResponse has a new optional parameter reviewDateTime + - Interface ReservationsProperties has a new optional parameter appliedScopeProperties + - Interface ReservationsProperties has a new optional parameter expiryDateTime + - Interface ReservationsProperties has a new optional parameter purchaseDateTime + - Interface ReservationsProperties has a new optional parameter reviewDateTime + - Interface ReservationsProperties has a new optional parameter swapProperties + - Interface ReservationSummary has a new optional parameter noBenefitCount + - Interface ReservationSummary has a new optional parameter warningCount + - Interface ReturnPostOptionalParams has a new optional parameter resumeFrom + - Interface ReturnPostOptionalParams has a new optional parameter updateIntervalInMs + - Added Enum KnownBillingPlan + - Added Enum KnownCommitmentGrain + - Added Enum KnownSavingsPlanTerm + - Enum KnownAppliedScopeType has a new value ManagementGroup + - Enum KnownDisplayProvisioningState has a new value NoBenefit + - Enum KnownDisplayProvisioningState has a new value Warning + - Added function getContinuationToken + - Interface QuotaRequestStatusListNextOptionalParams no longer has parameter filter + - Interface QuotaRequestStatusListNextOptionalParams no longer has parameter skiptoken + - Interface QuotaRequestStatusListNextOptionalParams no longer has parameter top + - Interface ReservationListAllNextOptionalParams no longer has parameter filter + - Interface ReservationListAllNextOptionalParams no longer has parameter orderby + - Interface ReservationListAllNextOptionalParams no longer has parameter refreshSummary + - Interface ReservationListAllNextOptionalParams no longer has parameter selectedState + - Interface ReservationListAllNextOptionalParams no longer has parameter skiptoken + - Interface ReservationListAllNextOptionalParams no longer has parameter take + - Interface ReservationResponse no longer has parameter id + - Interface ReservationResponse no longer has parameter name + - Interface ReservationResponse no longer has parameter systemData + - Interface ReservationResponse no longer has parameter type -### Other Changes +**Breaking Changes** + - Removed operation Return.post + - Operation Reservation.listRevisions has a new signature + - Operation Reservation.get has a new signature + + ## 7.2.0 (2022-09-19) **Features** diff --git a/sdk/reservations/arm-reservations/LICENSE b/sdk/reservations/arm-reservations/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/reservations/arm-reservations/LICENSE +++ b/sdk/reservations/arm-reservations/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 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 diff --git a/sdk/reservations/arm-reservations/_meta.json b/sdk/reservations/arm-reservations/_meta.json index 6529f8f775dd..fe909099c746 100644 --- a/sdk/reservations/arm-reservations/_meta.json +++ b/sdk/reservations/arm-reservations/_meta.json @@ -1,8 +1,8 @@ { - "commit": "e24bbf6a66cb0a19c072c6f15cee163acbd7acf7", + "commit": "64fe6ca10ff6a40a8c0c5bc82eb34486c202fee7", "readme": "specification/reservations/resource-manager/readme.md", - "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\reservations\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.1.20220727.1 --generate-sample=true", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\reservations\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.7 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", - "use": "@autorest/typescript@6.0.0-rc.1.20220727.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.0", + "use": "@autorest/typescript@6.0.0-rc.7" } \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/package.json b/sdk/reservations/arm-reservations/package.json index 06b24ac2132a..8b22c7eaba6b 100644 --- a/sdk/reservations/arm-reservations/package.json +++ b/sdk/reservations/arm-reservations/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for AzureReservationAPI.", - "version": "7.2.1", + "version": "8.0.0", "engines": { "node": ">=14.0.0" }, @@ -11,7 +11,7 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.5.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -36,9 +36,10 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.6.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^8.2.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^2.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -46,9 +47,9 @@ "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", + "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -110,6 +111,7 @@ ] }, "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations", "//sampleConfiguration": { "productName": "", "productSlugs": [ @@ -118,4 +120,4 @@ "disableDocsMs": true, "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview" } -} +} \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/recordings/node/datafactory_test/recording_quota_get_test.json b/sdk/reservations/arm-reservations/recordings/node/datafactory_test/recording_quota_get_test.json index 6e7eb397f015..30ea8fef4256 100644 --- a/sdk/reservations/arm-reservations/recordings/node/datafactory_test/recording_quota_get_test.json +++ b/sdk/reservations/arm-reservations/recordings/node/datafactory_test/recording_quota_get_test.json @@ -8,25 +8,29 @@ "Accept-Encoding": "gzip,deflate", "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-js-arm-reservations/7.2.0 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)", - "x-ms-client-request-id": "2eae951c-ab59-4439-9d48-9e32c2905fd9" + "User-Agent": "azsdk-js-arm-reservations/8.0.0 core-rest-pipeline/1.10.2 Node/v18.10.0 OS/(x64-Windows_NT-10.0.19042)", + "x-ms-client-request-id": "fdc03e6e-e70d-40be-804d-fca5c6af0fe0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Content-Length": "389", + "Content-Encoding": "gzip", "Content-Type": "application/json", - "Date": "Mon, 19 Sep 2022 07:48:42 GMT", - "MS-RequestId": "2O_ILKwI-UOENElIFgygtw.0", + "Date": "Wed, 01 Feb 2023 08:25:49 GMT", + "MS-RequestId": "7Z8SmZiFdUGKN3Gixp0-Pg.0", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Vary": "Accept-Encoding", + "Transfer-Encoding": "chunked", + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "a2204a65-769b-45ce-9eba-58ec1453bf59", - "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-request-id": "a2204a65-769b-45ce-9eba-58ec1453bf59", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220919T074842Z:a2204a65-769b-45ce-9eba-58ec1453bf59" + "x-ms-correlation-request-id": "3929032a-273b-4c2b-9e82-4caaef43dc39", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-request-id": "3929032a-273b-4c2b-9e82-4caaef43dc39", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230201T082550Z:3929032a-273b-4c2b-9e82-4caaef43dc39" }, "ResponseBody": { "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits/standardFSv2Family", diff --git a/sdk/reservations/arm-reservations/recordings/node/datafactory_test/recording_quota_list_test.json b/sdk/reservations/arm-reservations/recordings/node/datafactory_test/recording_quota_list_test.json index cd7a38363d32..93693214ee3b 100644 --- a/sdk/reservations/arm-reservations/recordings/node/datafactory_test/recording_quota_list_test.json +++ b/sdk/reservations/arm-reservations/recordings/node/datafactory_test/recording_quota_list_test.json @@ -8,8 +8,8 @@ "Accept-Encoding": "gzip,deflate", "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-js-arm-reservations/7.2.0 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)", - "x-ms-client-request-id": "f66b3603-995f-41ff-9139-ed1029ff5ec9" + "User-Agent": "azsdk-js-arm-reservations/8.0.0 core-rest-pipeline/1.10.2 Node/v18.10.0 OS/(x64-Windows_NT-10.0.19042)", + "x-ms-client-request-id": "a0b1dea3-2c5e-408e-a8b3-4479f46e2182" }, "RequestBody": null, "StatusCode": 200, @@ -17,8 +17,8 @@ "Cache-Control": "no-store, must-revalidate, no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json", - "Date": "Mon, 19 Sep 2022 07:52:02 GMT", - "MS-RequestId": "1Mr35cyODkyyWeeaJpHuAg.0", + "Date": "Wed, 01 Feb 2023 08:25:51 GMT", + "MS-RequestId": "qg-1DIq2gk63wE3iAAo38Q.0", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Transfer-Encoding": "chunked", @@ -27,10 +27,10 @@ "Accept-Encoding" ], "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "67a53c18-2a37-4703-a039-5f48499339f9", - "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-request-id": "67a53c18-2a37-4703-a039-5f48499339f9", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220919T075202Z:67a53c18-2a37-4703-a039-5f48499339f9" + "x-ms-correlation-request-id": "47d78055-503f-4131-a21e-5cf31cdfdcd7", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-request-id": "47d78055-503f-4131-a21e-5cf31cdfdcd7", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230201T082552Z:47d78055-503f-4131-a21e-5cf31cdfdcd7" }, "ResponseBody": { "value": [ @@ -38,7 +38,7 @@ "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits", "name": "cores", "properties": { - "currentValue": 8, + "currentValue": 1, "limit": 300, "name": { "value": "cores", @@ -66,13 +66,13 @@ }, { "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits", - "name": "standardDSv2Family", + "name": "standardBSFamily", "properties": { - "currentValue": 8, + "currentValue": 1, "limit": 100, "name": { - "value": "standardDSv2Family", - "localizedValue": "Standard DSv2 Family vCPUs" + "value": "standardBSFamily", + "localizedValue": "Standard BS Family vCPUs" }, "properties": {}, "unit": "Count" @@ -169,6 +169,21 @@ }, "type": "Microsoft.Capacity/ServiceLimits" }, + { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits", + "name": "standardDSv2Family", + "properties": { + "currentValue": 0, + "limit": 100, + "name": { + "value": "standardDSv2Family", + "localizedValue": "Standard DSv2 Family vCPUs" + }, + "properties": {}, + "unit": "Count" + }, + "type": "Microsoft.Capacity/ServiceLimits" + }, { "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits", "name": "standardGFamily", @@ -499,21 +514,6 @@ }, "type": "Microsoft.Capacity/ServiceLimits" }, - { - "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits", - "name": "standardBSFamily", - "properties": { - "currentValue": 0, - "limit": 100, - "name": { - "value": "standardBSFamily", - "localizedValue": "Standard BS Family vCPUs" - }, - "properties": {}, - "unit": "Count" - }, - "type": "Microsoft.Capacity/ServiceLimits" - }, { "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits", "name": "standardFSv2Family", diff --git a/sdk/reservations/arm-reservations/review/arm-reservations.api.md b/sdk/reservations/arm-reservations/review/arm-reservations.api.md index d150ae1cf7cf..6de384948dda 100644 --- a/sdk/reservations/arm-reservations/review/arm-reservations.api.md +++ b/sdk/reservations/arm-reservations/review/arm-reservations.api.md @@ -10,28 +10,35 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging'; import { PollerLike } from '@azure/core-lro'; import { PollOperationState } from '@azure/core-lro'; -// @public (undocumented) +// @public export interface AppliedReservationList { nextLink?: string; // (undocumented) value?: string[]; } -// @public (undocumented) +// @public export interface AppliedReservations { readonly id?: string; readonly name?: string; - // (undocumented) reservationOrderIds?: AppliedReservationList; readonly type?: string; } +// @public +export interface AppliedScopeProperties { + displayName?: string; + managementGroupId?: string; + resourceGroupId?: string; + subscriptionId?: string; + tenantId?: string; +} + // @public export type AppliedScopeType = string; -// @public (undocumented) +// @public export interface AvailableScopeProperties { - // (undocumented) properties?: SubscriptionScopeProperties; } @@ -58,7 +65,7 @@ export class AzureReservationAPI extends coreClient.ServiceClient { // (undocumented) exchange: Exchange; getAppliedReservationList(subscriptionId: string, options?: GetAppliedReservationListOptionalParams): Promise; - getCatalog(subscriptionId: string, options?: GetCatalogOptionalParams): Promise; + listCatalog(subscriptionId: string, options?: GetCatalogOptionalParams): PagedAsyncIterableIterator; // (undocumented) operation: Operation; // (undocumented) @@ -81,14 +88,14 @@ export interface AzureReservationAPIOptionalParams extends coreClient.ServiceCli // @public export interface BillingInformation { - // (undocumented) billingCurrencyProratedAmount?: Price; - // (undocumented) billingCurrencyRemainingCommitmentAmount?: Price; - // (undocumented) billingCurrencyTotalPaidAmount?: Price; } +// @public +export type BillingPlan = string; + // @public export interface CalculateExchange { beginPost(body: CalculateExchangeRequest, options?: CalculateExchangePostOptionalParams): Promise, CalculateExchangePostResponse>>; @@ -132,29 +139,27 @@ export interface CalculateExchangeRequest { export interface CalculateExchangeRequestProperties { reservationsToExchange?: ReservationToReturn[]; reservationsToPurchase?: PurchaseRequest[]; + savingsPlansToPurchase?: SavingsPlanPurchaseRequest[]; } // @public export interface CalculateExchangeResponseProperties { - // (undocumented) netPayable?: Price; policyResult?: ExchangePolicyErrors; - // (undocumented) purchasesTotal?: Price; - // (undocumented) refundsTotal?: Price; reservationsToExchange?: ReservationToExchange[]; reservationsToPurchase?: ReservationToPurchaseCalculateExchange[]; + savingsPlansToPurchase?: SavingsPlanToPurchaseCalculateExchange[]; sessionId?: string; } -// @public (undocumented) +// @public export interface CalculatePriceResponse { - // (undocumented) properties?: CalculatePriceResponseProperties; } -// @public (undocumented) +// @public export interface CalculatePriceResponseProperties { billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; grandTotal?: number; @@ -195,27 +200,25 @@ export interface CalculateRefundPostOptionalParams extends coreClient.OperationO // @public export type CalculateRefundPostResponse = CalculateRefundResponse; -// @public (undocumented) +// @public export interface CalculateRefundRequest { id?: string; - // (undocumented) properties?: CalculateRefundRequestProperties; } -// @public (undocumented) +// @public export interface CalculateRefundRequestProperties { reservationToReturn?: ReservationToReturn; scope?: string; } -// @public (undocumented) +// @public export interface CalculateRefundResponse { id?: string; - // (undocumented) properties?: RefundResponseProperties; } -// @public (undocumented) +// @public export interface Catalog { billingPlans?: { [propertyName: string]: ReservationBillingPlan[]; @@ -237,7 +240,14 @@ export interface CatalogMsrp { p1Y?: Price; } -// @public (undocumented) +// @public +export interface CatalogsResult { + readonly nextLink?: string; + totalItems?: number; + readonly value?: Catalog[]; +} + +// @public export interface ChangeDirectoryRequest { destinationTenantId?: string; } @@ -257,6 +267,14 @@ export interface ChangeDirectoryResult { name?: string; } +// @public +export interface Commitment extends Price { + grain?: CommitmentGrain; +} + +// @public +export type CommitmentGrain = string; + // @public export type CreatedByType = string; @@ -293,9 +311,8 @@ export interface ErrorDetails { readonly target?: string; } -// @public (undocumented) +// @public export interface ErrorModel { - // (undocumented) error?: ExtendedErrorInfo; } @@ -371,21 +388,18 @@ export interface ExchangeRequestProperties { // @public export interface ExchangeResponseProperties { - // (undocumented) netPayable?: Price; policyResult?: ExchangePolicyErrors; - // (undocumented) purchasesTotal?: Price; - // (undocumented) refundsTotal?: Price; reservationsToExchange?: ReservationToReturnForExchange[]; reservationsToPurchase?: ReservationToPurchaseExchange[]; + savingsPlansToPurchase?: SavingsPlanToPurchaseExchange[]; sessionId?: string; } -// @public (undocumented) +// @public export interface ExtendedErrorInfo { - // (undocumented) code?: ErrorResponseCode; // (undocumented) message?: string; @@ -405,27 +419,46 @@ export interface GetAppliedReservationListOptionalParams extends coreClient.Oper // @public export type GetAppliedReservationListResponse = AppliedReservations; +// @public +export interface GetCatalogNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GetCatalogNextResponse = CatalogsResult; + // @public export interface GetCatalogOptionalParams extends coreClient.OperationOptions { + filter?: string; location?: string; offerId?: string; planId?: string; publisherId?: string; reservedResourceType?: string; + skip?: number; + take?: number; } // @public -export type GetCatalogResponse = Catalog[]; +export type GetCatalogResponse = CatalogsResult; + +// @public +export function getContinuationToken(page: unknown): string | undefined; // @public export type InstanceFlexibility = string; // @public export enum KnownAppliedScopeType { + ManagementGroup = "ManagementGroup", Shared = "Shared", Single = "Single" } +// @public +export enum KnownBillingPlan { + P1M = "P1M" +} + // @public export enum KnownCalculateExchangeOperationResultStatus { Cancelled = "Cancelled", @@ -434,6 +467,11 @@ export enum KnownCalculateExchangeOperationResultStatus { Succeeded = "Succeeded" } +// @public +export enum KnownCommitmentGrain { + Hourly = "Hourly" +} + // @public export enum KnownCreatedByType { Application = "Application", @@ -448,9 +486,11 @@ export enum KnownDisplayProvisioningState { Expired = "Expired", Expiring = "Expiring", Failed = "Failed", + NoBenefit = "NoBenefit", Pending = "Pending", Processing = "Processing", - Succeeded = "Succeeded" + Succeeded = "Succeeded", + Warning = "Warning" } // @public @@ -666,6 +706,12 @@ export enum KnownResourceType { Standard = "standard" } +// @public +export enum KnownSavingsPlanTerm { + P1Y = "P1Y", + P3Y = "P3Y" +} + // @public export enum KnownUserFriendlyAppliedScopeType { ManagementGroup = "ManagementGroup", @@ -688,7 +734,7 @@ export enum KnownUserFriendlyRenewState { type Location_2 = string; export { Location_2 as Location } -// @public (undocumented) +// @public export interface MergeRequest { sources?: string[]; } @@ -698,7 +744,7 @@ export interface Operation { list(options?: OperationListOptionalParams): PagedAsyncIterableIterator; } -// @public (undocumented) +// @public export interface OperationDisplay { // (undocumented) description?: string; @@ -710,7 +756,7 @@ export interface OperationDisplay { resource?: string; } -// @public (undocumented) +// @public export interface OperationList { nextLink?: string; // (undocumented) @@ -731,7 +777,7 @@ export interface OperationListOptionalParams extends coreClient.OperationOptions // @public export type OperationListResponse = OperationList; -// @public (undocumented) +// @public export interface OperationResponse { display?: OperationDisplay; isDataAction?: boolean; @@ -749,8 +795,9 @@ export interface OperationResultError { // @public export type OperationStatus = string; -// @public (undocumented) +// @public export interface Patch { + appliedScopeProperties?: AppliedScopeProperties; appliedScopes?: string[]; appliedScopeType?: AppliedScopeType; instanceFlexibility?: InstanceFlexibility; @@ -758,11 +805,11 @@ export interface Patch { renew?: boolean; // (undocumented) renewProperties?: PatchPropertiesRenewProperties; + reviewDateTime?: Date; } // @public (undocumented) export interface PatchPropertiesRenewProperties { - // (undocumented) purchaseProperties?: PurchaseRequest; } @@ -781,7 +828,7 @@ export interface PaymentDetail { // @public export type PaymentStatus = string; -// @public (undocumented) +// @public export interface Price { // (undocumented) amount?: number; @@ -791,8 +838,13 @@ export interface Price { // @public export type ProvisioningState = string; -// @public (undocumented) +// @public +export interface ProxyResource extends Resource { +} + +// @public export interface PurchaseRequest { + appliedScopeProperties?: AppliedScopeProperties; appliedScopes?: string[]; appliedScopeType?: AppliedScopeType; billingPlan?: ReservationBillingPlan; @@ -803,7 +855,7 @@ export interface PurchaseRequest { renew?: boolean; reservedResourceProperties?: PurchaseRequestPropertiesReservedResourceProperties; reservedResourceType?: ReservedResourceType; - // (undocumented) + reviewDateTime?: Date; sku?: SkuName; term?: ReservationTerm; } @@ -948,9 +1000,6 @@ export type QuotaRequestStatusGetResponse = QuotaRequestDetails; // @public export interface QuotaRequestStatusListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - skiptoken?: string; - top?: number; } // @public @@ -994,11 +1043,8 @@ export type QuotaUpdateResponse = CurrentQuotaLimitBase; // @public export interface RefundBillingInformation { - // (undocumented) billingCurrencyProratedAmount?: Price; - // (undocumented) billingCurrencyRemainingCommitmentAmount?: Price; - // (undocumented) billingCurrencyTotalPaidAmount?: Price; billingPlan?: ReservationBillingPlan; completedTransactions?: number; @@ -1007,7 +1053,6 @@ export interface RefundBillingInformation { // @public export interface RefundPolicyError { - // (undocumented) code?: ErrorResponseCode; // (undocumented) message?: string; @@ -1020,20 +1065,17 @@ export interface RefundPolicyResult { // @public export interface RefundPolicyResultProperty { - // (undocumented) consumedRefundsTotal?: Price; - // (undocumented) maxRefundLimit?: Price; policyErrors?: RefundPolicyError[]; } -// @public (undocumented) +// @public export interface RefundRequest { - // (undocumented) properties?: RefundRequestProperties; } -// @public (undocumented) +// @public export interface RefundRequestProperties { reservationToReturn?: ReservationToReturn; returnReason?: string; @@ -1041,30 +1083,26 @@ export interface RefundRequestProperties { sessionId?: string; } -// @public (undocumented) +// @public export interface RefundResponse { id?: string; - // (undocumented) properties?: RefundResponseProperties; } -// @public (undocumented) +// @public export interface RefundResponseProperties { billingInformation?: RefundBillingInformation; - // (undocumented) billingRefundAmount?: Price; policyResult?: RefundPolicyResult; - // (undocumented) pricingRefundAmount?: Price; quantity?: number; sessionId?: string; } -// @public (undocumented) +// @public export interface RenewPropertiesResponse { billingCurrencyTotal?: RenewPropertiesResponseBillingCurrencyTotal; pricingCurrencyTotal?: RenewPropertiesResponsePricingCurrencyTotal; - // (undocumented) purchaseProperties?: PurchaseRequest; } @@ -1093,10 +1131,10 @@ export interface Reservation { beginSplitAndWait(reservationOrderId: string, body: SplitRequest, options?: ReservationSplitOptionalParams): Promise; beginUpdate(reservationOrderId: string, reservationId: string, parameters: Patch, options?: ReservationUpdateOptionalParams): Promise, ReservationUpdateResponse>>; beginUpdateAndWait(reservationOrderId: string, reservationId: string, parameters: Patch, options?: ReservationUpdateOptionalParams): Promise; - get(reservationId: string, reservationOrderId: string, options?: ReservationGetOptionalParams): Promise; + get(reservationOrderId: string, reservationId: string, options?: ReservationGetOptionalParams): Promise; list(reservationOrderId: string, options?: ReservationListOptionalParams): PagedAsyncIterableIterator; listAll(options?: ReservationListAllOptionalParams): PagedAsyncIterableIterator; - listRevisions(reservationId: string, reservationOrderId: string, options?: ReservationListRevisionsOptionalParams): PagedAsyncIterableIterator; + listRevisions(reservationOrderId: string, reservationId: string, options?: ReservationListRevisionsOptionalParams): PagedAsyncIterableIterator; unarchive(reservationOrderId: string, reservationId: string, options?: ReservationUnarchiveOptionalParams): Promise; } @@ -1124,7 +1162,7 @@ export interface ReservationGetOptionalParams extends coreClient.OperationOption // @public export type ReservationGetResponse = ReservationResponse; -// @public (undocumented) +// @public export interface ReservationList { nextLink?: string; // (undocumented) @@ -1133,12 +1171,6 @@ export interface ReservationList { // @public export interface ReservationListAllNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - orderby?: string; - refreshSummary?: string; - selectedState?: string; - skiptoken?: number; - take?: number; } // @public @@ -1185,13 +1217,19 @@ export interface ReservationListRevisionsOptionalParams extends coreClient.Opera // @public export type ReservationListRevisionsResponse = ReservationList; +// @public +export interface ReservationMergeHeaders { + location?: string; + retryAfter?: number; +} + // @public export interface ReservationMergeOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; updateIntervalInMs?: number; } -// @public (undocumented) +// @public export interface ReservationMergeProperties { mergeDestination?: string; mergeSources?: string[]; @@ -1241,7 +1279,7 @@ export interface ReservationOrderGetOptionalParams extends coreClient.OperationO // @public export type ReservationOrderGetResponse = ReservationOrderResponse; -// @public (undocumented) +// @public export interface ReservationOrderList { nextLink?: string; // (undocumented) @@ -1262,6 +1300,12 @@ export interface ReservationOrderListOptionalParams extends coreClient.Operation // @public export type ReservationOrderListResponse = ReservationOrderList; +// @public +export interface ReservationOrderPurchaseHeaders { + location?: string; + retryAfter?: number; +} + // @public export interface ReservationOrderPurchaseOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; @@ -1271,7 +1315,7 @@ export interface ReservationOrderPurchaseOptionalParams extends coreClient.Opera // @public export type ReservationOrderPurchaseResponse = ReservationOrderResponse; -// @public (undocumented) +// @public export interface ReservationOrderResponse { benefitStartTime?: Date; billingPlan?: ReservationBillingPlan; @@ -1280,6 +1324,7 @@ export interface ReservationOrderResponse { // (undocumented) etag?: number; expiryDate?: Date; + expiryDateTime?: Date; readonly id?: string; readonly name?: string; originalQuantity?: number; @@ -1288,23 +1333,20 @@ export interface ReservationOrderResponse { requestDateTime?: Date; // (undocumented) reservations?: ReservationResponse[]; + reviewDateTime?: Date; readonly systemData?: SystemData; term?: ReservationTerm; readonly type?: string; } // @public -export interface ReservationResponse { +export interface ReservationResponse extends ProxyResource { // (undocumented) etag?: number; - readonly id?: string; kind?: "Microsoft.Compute"; location?: string; - readonly name?: string; properties?: ReservationsProperties; sku?: SkuName; - readonly systemData?: SystemData; - readonly type?: string; } // @public @@ -1314,13 +1356,19 @@ export interface ReservationsListResult { readonly value?: ReservationResponse[]; } +// @public +export interface ReservationSplitHeaders { + location?: string; + retryAfter?: number; +} + // @public export interface ReservationSplitOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; updateIntervalInMs?: number; } -// @public (undocumented) +// @public export interface ReservationSplitProperties { splitDestinations?: string[]; splitSource?: string; @@ -1331,6 +1379,7 @@ export type ReservationSplitResponse = ReservationResponse[]; // @public export interface ReservationsProperties { + appliedScopeProperties?: AppliedScopeProperties; appliedScopes?: string[]; appliedScopeType?: AppliedScopeType; archived?: boolean; @@ -1342,24 +1391,25 @@ export interface ReservationsProperties { readonly displayProvisioningState?: string; effectiveDateTime?: Date; expiryDate?: Date; + expiryDateTime?: Date; extendedStatusInfo?: ExtendedStatusInfo; instanceFlexibility?: InstanceFlexibility; readonly lastUpdatedDateTime?: Date; - // (undocumented) mergeProperties?: ReservationMergeProperties; provisioningState?: ProvisioningState; readonly provisioningSubState?: string; purchaseDate?: Date; + purchaseDateTime?: Date; quantity?: number; renew?: boolean; renewDestination?: string; - // (undocumented) renewProperties?: RenewPropertiesResponse; renewSource?: string; reservedResourceType?: ReservedResourceType; + reviewDateTime?: Date; skuDescription?: string; - // (undocumented) splitProperties?: ReservationSplitProperties; + swapProperties?: ReservationSwapProperties; term?: ReservationTerm; readonly userFriendlyAppliedScopeType?: string; readonly userFriendlyRenewState?: string; @@ -1381,9 +1431,17 @@ export interface ReservationSummary { readonly expiredCount?: number; readonly expiringCount?: number; readonly failedCount?: number; + readonly noBenefitCount?: number; readonly pendingCount?: number; readonly processingCount?: number; readonly succeededCount?: number; + readonly warningCount?: number; +} + +// @public +export interface ReservationSwapProperties { + swapDestination?: string; + swapSource?: string; } // @public @@ -1392,7 +1450,6 @@ export type ReservationTerm = string; // @public export interface ReservationToExchange { billingInformation?: BillingInformation; - // (undocumented) billingRefundAmount?: Price; quantity?: number; reservationId?: string; @@ -1400,17 +1457,13 @@ export interface ReservationToExchange { // @public export interface ReservationToPurchaseCalculateExchange { - // (undocumented) billingCurrencyTotal?: Price; - // (undocumented) properties?: PurchaseRequest; } // @public export interface ReservationToPurchaseExchange { - // (undocumented) billingCurrencyTotal?: Price; - // (undocumented) properties?: PurchaseRequest; reservationId?: string; reservationOrderId?: string; @@ -1426,7 +1479,6 @@ export interface ReservationToReturn { // @public export interface ReservationToReturnForExchange { billingInformation?: BillingInformation; - // (undocumented) billingRefundAmount?: Price; quantity?: number; reservationId?: string; @@ -1437,6 +1489,13 @@ export interface ReservationToReturnForExchange { export interface ReservationUnarchiveOptionalParams extends coreClient.OperationOptions { } +// @public +export interface ReservationUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + // @public export interface ReservationUpdateOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; @@ -1457,6 +1516,14 @@ export interface ReservationUtilizationAggregates { // @public export type ReservedResourceType = string; +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + // @public export interface ResourceName { readonly localizedValue?: string; @@ -1468,7 +1535,8 @@ export type ResourceType = string; // @public export interface Return { - post(reservationOrderId: string, body: RefundRequest, options?: ReturnPostOptionalParams): Promise; + beginPost(reservationOrderId: string, body: RefundRequest, options?: ReturnPostOptionalParams): Promise, ReturnPostResponse>>; + beginPostAndWait(reservationOrderId: string, body: RefundRequest, options?: ReturnPostOptionalParams): Promise; } // @public @@ -1479,12 +1547,44 @@ export interface ReturnPostHeaders { // @public export interface ReturnPostOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public export type ReturnPostResponse = ReturnPostHeaders & RefundResponse; -// @public (undocumented) +// @public +export interface SavingsPlanPurchaseRequest { + appliedScopeProperties?: AppliedScopeProperties; + appliedScopeType?: AppliedScopeType; + billingPlan?: BillingPlan; + billingScopeId?: string; + commitment?: Commitment; + displayName?: string; + sku?: SkuName; + term?: SavingsPlanTerm; +} + +// @public +export type SavingsPlanTerm = string; + +// @public +export interface SavingsPlanToPurchaseCalculateExchange { + billingCurrencyTotal?: Price; + properties?: SavingsPlanPurchaseRequest; +} + +// @public +export interface SavingsPlanToPurchaseExchange { + billingCurrencyTotal?: Price; + properties?: SavingsPlanPurchaseRequest; + savingsPlanId?: string; + savingsPlanOrderId?: string; + status?: OperationStatus; +} + +// @public export interface ScopeProperties { // (undocumented) scope?: string; @@ -1505,32 +1605,32 @@ export interface ServiceErrorDetail { readonly message?: string; } -// @public (undocumented) +// @public export interface SkuCapability { name?: string; value?: string; } -// @public (undocumented) +// @public export interface SkuName { // (undocumented) name?: string; } -// @public (undocumented) +// @public export interface SkuProperty { name?: string; value?: string; } -// @public (undocumented) +// @public export interface SkuRestriction { reasonCode?: string; type?: string; values?: string[]; } -// @public (undocumented) +// @public export interface SplitRequest { quantities?: number[]; reservationId?: string; @@ -1547,7 +1647,7 @@ export interface SubRequest { unit?: string; } -// @public (undocumented) +// @public export interface SubscriptionScopeProperties { // (undocumented) scopes?: ScopeProperties[]; diff --git a/sdk/reservations/arm-reservations/samples-dev/calculateExchangePostSample.ts b/sdk/reservations/arm-reservations/samples-dev/calculateExchangePostSample.ts index a8f580f91d04..302f78a43f79 100644 --- a/sdk/reservations/arm-reservations/samples-dev/calculateExchangePostSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/calculateExchangePostSample.ts @@ -13,6 +13,9 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors. @@ -20,7 +23,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * * @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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateExchange.json */ async function calculateExchange() { const body: CalculateExchangeRequest = { @@ -47,6 +50,20 @@ async function calculateExchange() { sku: { name: "Standard_B1ls" }, term: "P1Y" } + ], + savingsPlansToPurchase: [ + { + appliedScopeProperties: { + resourceGroupId: + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg" + }, + appliedScopeType: "Single", + billingScopeId: "/subscriptions/10000000-0000-0000-0000-000000000000", + commitment: { amount: 15.23, currencyCode: "USD", grain: "Hourly" }, + displayName: "ComputeSavingsPlan", + sku: { name: "Compute_Savings_Plan" }, + term: "P1Y" + } ] } }; @@ -56,4 +73,8 @@ async function calculateExchange() { console.log(result); } -calculateExchange().catch(console.error); +async function main() { + calculateExchange(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/calculateRefundPostSample.ts b/sdk/reservations/arm-reservations/samples-dev/calculateRefundPostSample.ts index c31787c0f500..1a7081e9a5e9 100644 --- a/sdk/reservations/arm-reservations/samples-dev/calculateRefundPostSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/calculateRefundPostSample.ts @@ -13,6 +13,9 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Calculate price for returning `Reservations` if there are no policy errors. @@ -20,9 +23,9 @@ import { DefaultAzureCredential } from "@azure/identity"; * * @summary Calculate price for returning `Reservations` if there are no policy errors. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateRefund.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateRefund.json */ -async function purchase() { +async function calculateRefund() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; const body: CalculateRefundRequest = { id: @@ -42,4 +45,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + calculateRefund(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/exchangePostSample.ts b/sdk/reservations/arm-reservations/samples-dev/exchangePostSample.ts index 030ed4bb2d04..ff302b4061a5 100644 --- a/sdk/reservations/arm-reservations/samples-dev/exchangePostSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/exchangePostSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { ExchangeRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. @@ -17,7 +20,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * * @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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Exchange.json */ async function exchange() { const body: ExchangeRequest = { @@ -29,4 +32,8 @@ async function exchange() { console.log(result); } -exchange().catch(console.error); +async function main() { + exchange(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/getAppliedReservationListSample.ts b/sdk/reservations/arm-reservations/samples-dev/getAppliedReservationListSample.ts index 6c3a5e581b79..b88a4342035e 100644 --- a/sdk/reservations/arm-reservations/samples-dev/getAppliedReservationListSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/getAppliedReservationListSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAppliedReservations.json */ async function appliedReservationList() { const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; @@ -25,4 +28,8 @@ async function appliedReservationList() { console.log(result); } -appliedReservationList().catch(console.error); +async function main() { + appliedReservationList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/getCatalogSample.ts b/sdk/reservations/arm-reservations/samples-dev/getCatalogSample.ts index 6feb5547567c..0cd7a8a6e4ee 100644 --- a/sdk/reservations/arm-reservations/samples-dev/getCatalogSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/getCatalogSample.ts @@ -13,12 +13,15 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetCatalog.json */ async function catalog() { const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; @@ -27,8 +30,15 @@ async function catalog() { const options: GetCatalogOptionalParams = { reservedResourceType, location }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); - const result = await client.getCatalog(subscriptionId, options); - console.log(result); + const resArray = new Array(); + for await (let item of client.listCatalog(subscriptionId, options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + catalog(); } -catalog().catch(console.error); +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/operationListSample.ts b/sdk/reservations/arm-reservations/samples-dev/operationListSample.ts index 5dbfb051c5a7..a1fd0e412901 100644 --- a/sdk/reservations/arm-reservations/samples-dev/operationListSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/operationListSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetOperations.json */ async function getOperations() { const credential = new DefaultAzureCredential(); @@ -27,4 +30,8 @@ async function getOperations() { console.log(resArray); } -getOperations().catch(console.error); +async function main() { + getOperations(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaCreateOrUpdateSample.ts b/sdk/reservations/arm-reservations/samples-dev/quotaCreateOrUpdateSample.ts index 03bc8bd9a9a9..c683f9fb778f 100644 --- a/sdk/reservations/arm-reservations/samples-dev/quotaCreateOrUpdateSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/quotaCreateOrUpdateSample.ts @@ -13,6 +13,9 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. @@ -54,8 +57,6 @@ async function quotasRequestPutForCompute() { 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: @@ -97,10 +98,6 @@ async function quotasRequestPutForMachineLearningServicesDedicatedResource() { 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: @@ -142,6 +139,10 @@ async function quotasRequestPutForMachineLearningServicesLowPriorityResource() { console.log(result); } -quotasRequestPutForMachineLearningServicesLowPriorityResource().catch( - console.error -); +async function main() { + quotasRequestPutForCompute(); + quotasRequestPutForMachineLearningServicesDedicatedResource(); + quotasRequestPutForMachineLearningServicesLowPriorityResource(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaGetSample.ts b/sdk/reservations/arm-reservations/samples-dev/quotaGetSample.ts index a04e7cc12f2b..35d5937f2d83 100644 --- a/sdk/reservations/arm-reservations/samples-dev/quotaGetSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/quotaGetSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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. @@ -33,4 +36,8 @@ async function quotasRequestForCompute() { console.log(result); } -quotasRequestForCompute().catch(console.error); +async function main() { + quotasRequestForCompute(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaListSample.ts b/sdk/reservations/arm-reservations/samples-dev/quotaListSample.ts index a657ceedf0cf..87dba118087f 100644 --- a/sdk/reservations/arm-reservations/samples-dev/quotaListSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/quotaListSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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. @@ -34,8 +37,6 @@ async function quotasListUsagesForCompute() { 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. * @@ -59,4 +60,9 @@ async function quotasListUsagesMachineLearningServices() { console.log(resArray); } -quotasListUsagesMachineLearningServices().catch(console.error); +async function main() { + quotasListUsagesForCompute(); + quotasListUsagesMachineLearningServices(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatusGetSample.ts b/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatusGetSample.ts index 2e63c13e7444..b27467a8b488 100644 --- a/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatusGetSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatusGetSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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. @@ -33,8 +36,6 @@ async function quotaRequestFailed() { 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. * @@ -57,8 +58,6 @@ async function quotaRequestInProgress() { 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. * @@ -81,4 +80,10 @@ async function quotaRequestStatus() { console.log(result); } -quotaRequestStatus().catch(console.error); +async function main() { + quotaRequestFailed(); + quotaRequestInProgress(); + quotaRequestStatus(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatusListSample.ts b/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatusListSample.ts index b840bf35780b..238376b0d965 100644 --- a/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatusListSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatusListSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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. @@ -34,4 +37,8 @@ async function quotaRequestHistory() { console.log(resArray); } -quotaRequestHistory().catch(console.error); +async function main() { + quotaRequestHistory(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaUpdateSample.ts b/sdk/reservations/arm-reservations/samples-dev/quotaUpdateSample.ts index d57da25389b5..4924ed1a1d2a 100644 --- a/sdk/reservations/arm-reservations/samples-dev/quotaUpdateSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/quotaUpdateSample.ts @@ -13,6 +13,9 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Update the quota (service limits) of this resource to the requested value. @@ -52,4 +55,8 @@ async function quotasRequestPatchForCompute() { console.log(result); } -quotasRequestPatchForCompute().catch(console.error); +async function main() { + quotasRequestPatchForCompute(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationArchiveSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationArchiveSample.ts index c65ce1b4f38e..41f6a5462d42 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationArchiveSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationArchiveSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Archiving a `Reservation` moves it to `Archived` state. * * @summary Archiving a `Reservation` moves it to `Archived` state. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Archive.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Archive.json */ async function archive() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -29,4 +32,8 @@ async function archive() { console.log(result); } -archive().catch(console.error); +async function main() { + archive(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationAvailableScopesSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationAvailableScopesSample.ts index ea2cffcc5365..10ce0a6a0864 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationAvailableScopesSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationAvailableScopesSample.ts @@ -13,14 +13,17 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** - * This sample demonstrates how to Get Available Scopes for `Reservation`. + * This sample demonstrates how to Check whether the scopes from request is valid for `Reservation`. * - * @summary Get Available Scopes for `Reservation`. + * @summary Check whether the scopes from request is valid for `Reservation`. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetAvailableScope.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAvailableScope.json */ async function availableScopes() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -40,4 +43,8 @@ async function availableScopes() { console.log(result); } -availableScopes().catch(console.error); +async function main() { + availableScopes(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationGetSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationGetSample.ts index 7cf70872ec6c..cd3aac3f0864 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationGetSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationGetSample.ts @@ -13,26 +13,33 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.json */ async function getReservation() { - const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const expand = "renewProperties"; const options: ReservationGetOptionalParams = { expand }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); const result = await client.reservation.get( - reservationId, reservationOrderId, + reservationId, options ); console.log(result); } -getReservation().catch(console.error); +async function main() { + getReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationListAllSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationListAllSample.ts index 181af032301e..9f5130a8c51b 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationListAllSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationListAllSample.ts @@ -13,14 +13,17 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservations.json */ -async function catalog() { +async function reservationListAll() { const filter = "(properties%2farchived+eq+false)"; const orderby = "properties/displayName asc"; const skiptoken = 50; @@ -40,4 +43,8 @@ async function catalog() { console.log(resArray); } -catalog().catch(console.error); +async function main() { + reservationListAll(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationListRevisionsSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationListRevisionsSample.ts index 1c3343dc5759..5b0001972913 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationListRevisionsSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationListRevisionsSample.ts @@ -10,26 +10,33 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationRevisions.json */ async function reservationRevisions() { - const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); const resArray = new Array(); for await (let item of client.reservation.listRevisions( - reservationId, - reservationOrderId + reservationOrderId, + reservationId )) { resArray.push(item); } console.log(resArray); } -reservationRevisions().catch(console.error); +async function main() { + reservationRevisions(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationListSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationListSample.ts index 5274d25a1d3a..a3ebd27e1593 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationListSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationListSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationsFromOrder.json */ async function reservationList() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -28,4 +31,8 @@ async function reservationList() { console.log(resArray); } -reservationList().catch(console.error); +async function main() { + reservationList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationMergeSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationMergeSample.ts index dd0004916273..46814d0c9d4d 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationMergeSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationMergeSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { MergeRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/MergeReservations.json */ async function merge() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -34,4 +37,8 @@ async function merge() { console.log(result); } -merge().catch(console.error); +async function main() { + merge(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationOrderCalculateSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationOrderCalculateSample.ts index 749f5d1123e4..99ec9258c3d1 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationOrderCalculateSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationOrderCalculateSample.ts @@ -10,14 +10,17 @@ // Licensed under the MIT License. import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateReservationOrder.json */ -async function purchase() { +async function calculatePrice() { const body: PurchaseRequest = { appliedScopeType: "Shared", appliedScopes: [], @@ -37,4 +40,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + calculatePrice(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationOrderChangeDirectorySample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationOrderChangeDirectorySample.ts index abbffe9d6b0d..a92069dd5842 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationOrderChangeDirectorySample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationOrderChangeDirectorySample.ts @@ -13,12 +13,15 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/ChangeDirectoryReservationOrder.json */ async function changeDirectory() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -34,4 +37,8 @@ async function changeDirectory() { console.log(result); } -changeDirectory().catch(console.error); +async function main() { + changeDirectory(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationOrderGetSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationOrderGetSample.ts index 8c5d8ffef274..14d455b05deb 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationOrderGetSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationOrderGetSample.ts @@ -13,14 +13,17 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetails.json */ -async function getReservation() { +async function getReservationOrder() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); @@ -28,13 +31,11 @@ async function getReservation() { 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json */ async function getReservationWithExpandPayments() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -46,4 +47,9 @@ async function getReservationWithExpandPayments() { console.log(result); } -getReservationWithExpandPayments().catch(console.error); +async function main() { + getReservationOrder(); + getReservationWithExpandPayments(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationOrderListSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationOrderListSample.ts index f4fb4725ee98..8baeaa387f8b 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationOrderListSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationOrderListSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrders.json */ async function reservationOrderList() { const credential = new DefaultAzureCredential(); @@ -27,4 +30,8 @@ async function reservationOrderList() { console.log(resArray); } -reservationOrderList().catch(console.error); +async function main() { + reservationOrderList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationOrderPurchaseSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationOrderPurchaseSample.ts index 485680f8a986..99c787517b11 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationOrderPurchaseSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationOrderPurchaseSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/PurchaseReservationOrder.json */ async function purchase() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -42,4 +45,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + purchase(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationSplitSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationSplitSample.ts index 1d7bd5dfa192..442d430c3e51 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationSplitSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationSplitSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { SplitRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/SplitReservation.json */ async function split() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -33,4 +36,8 @@ async function split() { console.log(result); } -split().catch(console.error); +async function main() { + split(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationUnarchiveSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationUnarchiveSample.ts index db30d98b293a..5db346bea2ba 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationUnarchiveSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationUnarchiveSample.ts @@ -10,14 +10,17 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** - * This sample demonstrates how to Unarchiving a `Reservation` moves it to the state it was before archiving. + * This sample demonstrates how to Restores a `Reservation` to the state it was before archiving. * - * @summary Unarchiving a `Reservation` moves it to the state it was before archiving. + * @summary Restores a `Reservation` to the state it was before archiving. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Unarchive.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Unarchive.json */ async function unarchive() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -31,4 +34,8 @@ async function unarchive() { console.log(result); } -unarchive().catch(console.error); +async function main() { + unarchive(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationUpdateSample.ts b/sdk/reservations/arm-reservations/samples-dev/reservationUpdateSample.ts index f654cd66c9d5..dc81b1cd22b9 100644 --- a/sdk/reservations/arm-reservations/samples-dev/reservationUpdateSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/reservationUpdateSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { Patch, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/UpdateReservation.json */ async function patchReservation() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -34,4 +37,8 @@ async function patchReservation() { console.log(result); } -patchReservation().catch(console.error); +async function main() { + patchReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/returnPostSample.ts b/sdk/reservations/arm-reservations/samples-dev/returnPostSample.ts index ddcc2e0b98cc..d0ecb8baaa9f 100644 --- a/sdk/reservations/arm-reservations/samples-dev/returnPostSample.ts +++ b/sdk/reservations/arm-reservations/samples-dev/returnPostSample.ts @@ -10,15 +10,18 @@ // Licensed under the MIT License. import { RefundRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** - * This sample demonstrates how to Return a reservation. + * This sample demonstrates how to Return a reservation and get refund information. * - * @summary Return a reservation. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json + * @summary Return a reservation and get refund information. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Return.json */ -async function purchase() { - const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; +async function returnAReservation() { + const reservationOrderId = "50000000-aaaa-bbbb-cccc-100000000004"; const body: RefundRequest = { properties: { reservationToReturn: { @@ -33,8 +36,12 @@ async function purchase() { }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); - const result = await client.return.post(reservationOrderId, body); + const result = await client.return.beginPostAndWait(reservationOrderId, body); console.log(result); } -purchase().catch(console.error); +async function main() { + returnAReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/README.md b/sdk/reservations/arm-reservations/samples/v8/javascript/README.md similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/javascript/README.md rename to sdk/reservations/arm-reservations/samples/v8/javascript/README.md index c17360dec7d9..a2a64ac10a33 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/README.md +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/README.md @@ -4,34 +4,34 @@ These sample programs show how to use the JavaScript client libraries for in som | **File Name** | **Description** | | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| [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 | -| [calculateRefundPostSample.js][calculaterefundpostsample] | Calculate price for returning `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/CalculateRefund.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 | -| [operationListSample.js][operationlistsample] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetOperations.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-11-01/examples/CalculateExchange.json | +| [calculateRefundPostSample.js][calculaterefundpostsample] | Calculate price for returning `Reservations` if there are no policy errors. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateRefund.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-11-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-11-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-11-01/examples/GetCatalog.json | +| [operationListSample.js][operationlistsample] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetOperations.json | | [quotaCreateOrUpdateSample.js][quotacreateorupdatesample] | 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 | | [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 | | [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. • 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 | -| [reservationArchiveSample.js][reservationarchivesample] | Archiving a `Reservation` moves it to `Archived` state. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Archive.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 | -| [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 | -| [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 | -| [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 | -| [reservationUnarchiveSample.js][reservationunarchivesample] | Unarchiving a `Reservation` moves it to the state it was before archiving. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Unarchive.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 | -| [returnPostSample.js][returnpostsample] | Return a reservation. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json | +| [reservationArchiveSample.js][reservationarchivesample] | Archiving a `Reservation` moves it to `Archived` state. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Archive.json | +| [reservationAvailableScopesSample.js][reservationavailablescopessample] | Check whether the scopes from request is valid for `Reservation`. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAvailableScope.json | +| [reservationGetSample.js][reservationgetsample] | Get specific `Reservation` details. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.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-11-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-11-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-11-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-11-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-11-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-11-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-11-01/examples/GetReservationOrderDetails.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-11-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-11-01/examples/PurchaseReservationOrder.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-11-01/examples/SplitReservation.json | +| [reservationUnarchiveSample.js][reservationunarchivesample] | Restores a `Reservation` to the state it was before archiving. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Unarchive.json | +| [reservationUpdateSample.js][reservationupdatesample] | Updates the applied scopes of the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/UpdateReservation.json | +| [returnPostSample.js][returnpostsample] | Return a reservation and get refund information. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Return.json | ## Prerequisites @@ -71,34 +71,34 @@ npx cross-env node calculateExchangePostSample.js Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[calculateexchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchangePostSample.js -[calculaterefundpostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/calculateRefundPostSample.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 -[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/operationListSample.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 -[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 -[reservationarchivesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationArchiveSample.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 -[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 -[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 -[reservationsplitsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationSplitSample.js -[reservationunarchivesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationUnarchiveSample.js -[reservationupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationUpdateSample.js -[returnpostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/returnPostSample.js +[calculateexchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/calculateExchangePostSample.js +[calculaterefundpostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/calculateRefundPostSample.js +[exchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/exchangePostSample.js +[getappliedreservationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/getAppliedReservationListSample.js +[getcatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/getCatalogSample.js +[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/operationListSample.js +[quotacreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/quotaCreateOrUpdateSample.js +[quotagetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/quotaGetSample.js +[quotalistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/quotaListSample.js +[quotarequeststatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/quotaRequestStatusGetSample.js +[quotarequeststatuslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/quotaRequestStatusListSample.js +[quotaupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/quotaUpdateSample.js +[reservationarchivesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationArchiveSample.js +[reservationavailablescopessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationAvailableScopesSample.js +[reservationgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationGetSample.js +[reservationlistallsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListAllSample.js +[reservationlistrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListRevisionsSample.js +[reservationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListSample.js +[reservationmergesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationMergeSample.js +[reservationordercalculatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderCalculateSample.js +[reservationorderchangedirectorysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderChangeDirectorySample.js +[reservationordergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderGetSample.js +[reservationorderlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderListSample.js +[reservationorderpurchasesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderPurchaseSample.js +[reservationsplitsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationSplitSample.js +[reservationunarchivesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationUnarchiveSample.js +[reservationupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/reservationUpdateSample.js +[returnpostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/javascript/returnPostSample.js [apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations/README.md diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchangePostSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/calculateExchangePostSample.js similarity index 71% rename from sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchangePostSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/calculateExchangePostSample.js index 9b5eda04d200..0bf93db25b9e 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchangePostSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/calculateExchangePostSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors. @@ -17,7 +18,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * * @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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateExchange.json */ async function calculateExchange() { const body = { @@ -45,6 +46,20 @@ async function calculateExchange() { term: "P1Y", }, ], + savingsPlansToPurchase: [ + { + appliedScopeProperties: { + resourceGroupId: + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg", + }, + appliedScopeType: "Single", + billingScopeId: "/subscriptions/10000000-0000-0000-0000-000000000000", + commitment: { amount: 15.23, currencyCode: "USD", grain: "Hourly" }, + displayName: "ComputeSavingsPlan", + sku: { name: "Compute_Savings_Plan" }, + term: "P1Y", + }, + ], }, }; const credential = new DefaultAzureCredential(); @@ -53,4 +68,8 @@ async function calculateExchange() { console.log(result); } -calculateExchange().catch(console.error); +async function main() { + calculateExchange(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/calculateRefundPostSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/calculateRefundPostSample.js similarity index 87% rename from sdk/reservations/arm-reservations/samples/v7/javascript/calculateRefundPostSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/calculateRefundPostSample.js index 4ec35a4aba23..013b19625da4 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/calculateRefundPostSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/calculateRefundPostSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Calculate price for returning `Reservations` if there are no policy errors. @@ -17,9 +18,9 @@ const { DefaultAzureCredential } = require("@azure/identity"); * * @summary Calculate price for returning `Reservations` if there are no policy errors. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateRefund.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateRefund.json */ -async function purchase() { +async function calculateRefund() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; const body = { id: "/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004", @@ -38,4 +39,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + calculateRefund(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/exchangePostSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/exchangePostSample.js similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/javascript/exchangePostSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/exchangePostSample.js index ff1aa644fbf1..1e4ee82bcb0e 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/exchangePostSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/exchangePostSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. @@ -17,7 +18,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * * @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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Exchange.json */ async function exchange() { const body = { @@ -29,4 +30,8 @@ async function exchange() { console.log(result); } -exchange().catch(console.error); +async function main() { + exchange(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/getAppliedReservationListSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/getAppliedReservationListSample.js similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/javascript/getAppliedReservationListSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/getAppliedReservationListSample.js index d97c099dd92b..dadb8047556c 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/getAppliedReservationListSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/getAppliedReservationListSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAppliedReservations.json */ async function appliedReservationList() { const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; @@ -25,4 +26,8 @@ async function appliedReservationList() { console.log(result); } -appliedReservationList().catch(console.error); +async function main() { + appliedReservationList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/getCatalogSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/getCatalogSample.js similarity index 77% rename from sdk/reservations/arm-reservations/samples/v7/javascript/getCatalogSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/getCatalogSample.js index 7e89e8f7bacd..f040bec0ddc9 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/getCatalogSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/getCatalogSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetCatalog.json */ async function catalog() { const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; @@ -24,8 +25,15 @@ async function catalog() { const options = { reservedResourceType, location }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); - const result = await client.getCatalog(subscriptionId, options); - console.log(result); + const resArray = new Array(); + for await (let item of client.listCatalog(subscriptionId, options)) { + resArray.push(item); + } + console.log(resArray); } -catalog().catch(console.error); +async function main() { + catalog(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/operationListSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/operationListSample.js similarity index 84% rename from sdk/reservations/arm-reservations/samples/v7/javascript/operationListSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/operationListSample.js index 6025715371e1..1c219e133387 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/operationListSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/operationListSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetOperations.json */ async function getOperations() { const credential = new DefaultAzureCredential(); @@ -27,4 +28,8 @@ async function getOperations() { console.log(resArray); } -getOperations().catch(console.error); +async function main() { + getOperations(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/package.json b/sdk/reservations/arm-reservations/samples/v8/javascript/package.json similarity index 100% rename from sdk/reservations/arm-reservations/samples/v7/javascript/package.json rename to sdk/reservations/arm-reservations/samples/v8/javascript/package.json diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaCreateOrUpdateSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaCreateOrUpdateSample.js similarity index 96% rename from sdk/reservations/arm-reservations/samples/v7/javascript/quotaCreateOrUpdateSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/quotaCreateOrUpdateSample.js index d67ea0c9b72d..07b8e5de6355 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaCreateOrUpdateSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaCreateOrUpdateSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. @@ -51,8 +52,6 @@ async function quotasRequestPutForCompute() { 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: @@ -94,8 +93,6 @@ async function quotasRequestPutForMachineLearningServicesDedicatedResource() { 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: @@ -137,4 +134,10 @@ async function quotasRequestPutForMachineLearningServicesLowPriorityResource() { console.log(result); } -quotasRequestPutForMachineLearningServicesLowPriorityResource().catch(console.error); +async function main() { + quotasRequestPutForCompute(); + quotasRequestPutForMachineLearningServicesDedicatedResource(); + quotasRequestPutForMachineLearningServicesLowPriorityResource(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaGetSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaGetSample.js similarity index 92% rename from sdk/reservations/arm-reservations/samples/v7/javascript/quotaGetSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/quotaGetSample.js index 430650c5ac27..37d9e05aec39 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaGetSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaGetSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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. @@ -28,4 +29,8 @@ async function quotasRequestForCompute() { console.log(result); } -quotasRequestForCompute().catch(console.error); +async function main() { + quotasRequestForCompute(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaListSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaListSample.js similarity index 93% rename from sdk/reservations/arm-reservations/samples/v7/javascript/quotaListSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/quotaListSample.js index e54c439c5b9b..5551c7c8c779 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaListSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaListSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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. @@ -30,8 +31,6 @@ async function quotasListUsagesForCompute() { 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. * @@ -51,4 +50,9 @@ async function quotasListUsagesMachineLearningServices() { console.log(resArray); } -quotasListUsagesMachineLearningServices().catch(console.error); +async function main() { + quotasListUsagesForCompute(); + quotasListUsagesMachineLearningServices(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatusGetSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaRequestStatusGetSample.js similarity index 96% rename from sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatusGetSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/quotaRequestStatusGetSample.js index f1a143b8b94f..3fae89779661 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatusGetSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaRequestStatusGetSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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. @@ -28,8 +29,6 @@ async function quotaRequestFailed() { 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. * @@ -47,8 +46,6 @@ async function quotaRequestInProgress() { 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. * @@ -66,4 +63,10 @@ async function quotaRequestStatus() { console.log(result); } -quotaRequestStatus().catch(console.error); +async function main() { + quotaRequestFailed(); + quotaRequestInProgress(); + quotaRequestStatus(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatusListSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaRequestStatusListSample.js similarity index 93% rename from sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatusListSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/quotaRequestStatusListSample.js index 4b631b040413..da9c903e638b 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatusListSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaRequestStatusListSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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. @@ -30,4 +31,8 @@ async function quotaRequestHistory() { console.log(resArray); } -quotaRequestHistory().catch(console.error); +async function main() { + quotaRequestHistory(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaUpdateSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaUpdateSample.js similarity index 94% rename from sdk/reservations/arm-reservations/samples/v7/javascript/quotaUpdateSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/quotaUpdateSample.js index 7c7ee9e4b912..1f049f45d64f 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaUpdateSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/quotaUpdateSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Update the quota (service limits) of this resource to the requested value. @@ -49,4 +50,8 @@ async function quotasRequestPatchForCompute() { console.log(result); } -quotasRequestPatchForCompute().catch(console.error); +async function main() { + quotasRequestPatchForCompute(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationArchiveSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationArchiveSample.js similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationArchiveSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationArchiveSample.js index 2871c8e4461a..8e1a52b5c86c 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationArchiveSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationArchiveSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Archiving a `Reservation` moves it to `Archived` state. * * @summary Archiving a `Reservation` moves it to `Archived` state. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Archive.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Archive.json */ async function archive() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -26,4 +27,8 @@ async function archive() { console.log(result); } -archive().catch(console.error); +async function main() { + archive(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationAvailableScopesSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationAvailableScopesSample.js similarity index 75% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationAvailableScopesSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationAvailableScopesSample.js index 38732bca155a..e1f312133a14 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationAvailableScopesSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationAvailableScopesSample.js @@ -10,14 +10,15 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** - * This sample demonstrates how to Get Available Scopes for `Reservation`. + * This sample demonstrates how to Check whether the scopes from request is valid for `Reservation`. * - * @summary Get Available Scopes for `Reservation`. + * @summary Check whether the scopes from request is valid for `Reservation`. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetAvailableScope.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAvailableScope.json */ async function availableScopes() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -37,4 +38,8 @@ async function availableScopes() { console.log(result); } -availableScopes().catch(console.error); +async function main() { + availableScopes(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationGetSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationGetSample.js similarity index 79% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationGetSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationGetSample.js index 75779bb645f5..d66517df0691 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationGetSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationGetSample.js @@ -10,22 +10,27 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.json */ async function getReservation() { - const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const expand = "renewProperties"; const options = { expand }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); - const result = await client.reservation.get(reservationId, reservationOrderId, options); + const result = await client.reservation.get(reservationOrderId, reservationId, options); console.log(result); } -getReservation().catch(console.error); +async function main() { + getReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListAllSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListAllSample.js similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationListAllSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationListAllSample.js index 0e6fd77312ea..b48334337237 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListAllSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListAllSample.js @@ -10,14 +10,15 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservations.json */ -async function catalog() { +async function reservationListAll() { const filter = "(properties%2farchived+eq+false)"; const orderby = "properties/displayName asc"; const skiptoken = 50; @@ -37,4 +38,8 @@ async function catalog() { console.log(resArray); } -catalog().catch(console.error); +async function main() { + reservationListAll(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListRevisionsSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListRevisionsSample.js similarity index 84% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationListRevisionsSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationListRevisionsSample.js index d4ac60c99d9f..7e214ee57b1e 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListRevisionsSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListRevisionsSample.js @@ -10,23 +10,28 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationRevisions.json */ async function reservationRevisions() { - const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); const resArray = new Array(); - for await (let item of client.reservation.listRevisions(reservationId, reservationOrderId)) { + for await (let item of client.reservation.listRevisions(reservationOrderId, reservationId)) { resArray.push(item); } console.log(resArray); } -reservationRevisions().catch(console.error); +async function main() { + reservationRevisions(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListSample.js similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationListSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationListSample.js index fdfea07646b7..2f2ecbb5a6e9 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationListSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationListSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationsFromOrder.json */ async function reservationList() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -28,4 +29,8 @@ async function reservationList() { console.log(resArray); } -reservationList().catch(console.error); +async function main() { + reservationList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationMergeSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationMergeSample.js similarity index 90% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationMergeSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationMergeSample.js index 86e7a5f8f745..0af29851390c 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationMergeSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationMergeSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/MergeReservations.json */ async function merge() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -31,4 +32,8 @@ async function merge() { console.log(result); } -merge().catch(console.error); +async function main() { + merge(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderCalculateSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderCalculateSample.js similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderCalculateSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderCalculateSample.js index 16c7729128d1..64f2f047e516 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderCalculateSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderCalculateSample.js @@ -10,14 +10,15 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateReservationOrder.json */ -async function purchase() { +async function calculatePrice() { const body = { appliedScopeType: "Shared", appliedScopes: [], @@ -37,4 +38,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + calculatePrice(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderChangeDirectorySample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderChangeDirectorySample.js similarity index 87% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderChangeDirectorySample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderChangeDirectorySample.js index 5e207c7ab760..3267e5943f8f 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderChangeDirectorySample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderChangeDirectorySample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/ChangeDirectoryReservationOrder.json */ async function changeDirectory() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -28,4 +29,8 @@ async function changeDirectory() { console.log(result); } -changeDirectory().catch(console.error); +async function main() { + changeDirectory(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderGetSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderGetSample.js similarity index 83% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderGetSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderGetSample.js index 15ba06c6309e..0a85aef7f578 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderGetSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderGetSample.js @@ -10,14 +10,15 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetails.json */ -async function getReservation() { +async function getReservationOrder() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); @@ -25,13 +26,11 @@ async function getReservation() { 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json */ async function getReservationWithExpandPayments() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -43,4 +42,9 @@ async function getReservationWithExpandPayments() { console.log(result); } -getReservationWithExpandPayments().catch(console.error); +async function main() { + getReservationOrder(); + getReservationWithExpandPayments(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderListSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderListSample.js similarity index 85% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderListSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderListSample.js index 8fcd6da3a78c..3825730e0857 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderListSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderListSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrders.json */ async function reservationOrderList() { const credential = new DefaultAzureCredential(); @@ -27,4 +28,8 @@ async function reservationOrderList() { console.log(resArray); } -reservationOrderList().catch(console.error); +async function main() { + reservationOrderList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderPurchaseSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderPurchaseSample.js similarity index 90% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderPurchaseSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderPurchaseSample.js index 4b2ed376e7f0..e3de9e08e8ac 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderPurchaseSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationOrderPurchaseSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/PurchaseReservationOrder.json */ async function purchase() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -39,4 +40,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + purchase(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationSplitSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationSplitSample.js similarity index 88% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationSplitSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationSplitSample.js index 7b86370f9ac0..c2fd98572ac8 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationSplitSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationSplitSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/SplitReservation.json */ async function split() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -30,4 +31,8 @@ async function split() { console.log(result); } -split().catch(console.error); +async function main() { + split(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationUnarchiveSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationUnarchiveSample.js similarity index 72% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationUnarchiveSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationUnarchiveSample.js index d21f76f6fad3..63bf077ae50f 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationUnarchiveSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationUnarchiveSample.js @@ -10,14 +10,15 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** - * This sample demonstrates how to Unarchiving a `Reservation` moves it to the state it was before archiving. + * This sample demonstrates how to Restores a `Reservation` to the state it was before archiving. * - * @summary Unarchiving a `Reservation` moves it to the state it was before archiving. + * @summary Restores a `Reservation` to the state it was before archiving. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Unarchive.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Unarchive.json */ async function unarchive() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -28,4 +29,8 @@ async function unarchive() { console.log(result); } -unarchive().catch(console.error); +async function main() { + unarchive(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationUpdateSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationUpdateSample.js similarity index 87% rename from sdk/reservations/arm-reservations/samples/v7/javascript/reservationUpdateSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/reservationUpdateSample.js index 78583edb2912..8ff53205903c 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationUpdateSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/reservationUpdateSample.js @@ -10,12 +10,13 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/UpdateReservation.json */ async function patchReservation() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -34,4 +35,8 @@ async function patchReservation() { console.log(result); } -patchReservation().catch(console.error); +async function main() { + patchReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/returnPostSample.js b/sdk/reservations/arm-reservations/samples/v8/javascript/returnPostSample.js similarity index 67% rename from sdk/reservations/arm-reservations/samples/v7/javascript/returnPostSample.js rename to sdk/reservations/arm-reservations/samples/v8/javascript/returnPostSample.js index e0d4a1045bc8..12bd73ab8498 100644 --- a/sdk/reservations/arm-reservations/samples/v7/javascript/returnPostSample.js +++ b/sdk/reservations/arm-reservations/samples/v8/javascript/returnPostSample.js @@ -10,15 +10,16 @@ // Licensed under the MIT License. const { AzureReservationAPI } = require("@azure/arm-reservations"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** - * This sample demonstrates how to Return a reservation. + * This sample demonstrates how to Return a reservation and get refund information. * - * @summary Return a reservation. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json + * @summary Return a reservation and get refund information. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Return.json */ -async function purchase() { - const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; +async function returnAReservation() { + const reservationOrderId = "50000000-aaaa-bbbb-cccc-100000000004"; const body = { properties: { reservationToReturn: { @@ -33,8 +34,12 @@ async function purchase() { }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); - const result = await client.return.post(reservationOrderId, body); + const result = await client.return.beginPostAndWait(reservationOrderId, body); console.log(result); } -purchase().catch(console.error); +async function main() { + returnAReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/sample.env b/sdk/reservations/arm-reservations/samples/v8/javascript/sample.env similarity index 100% rename from sdk/reservations/arm-reservations/samples/v7/javascript/sample.env rename to sdk/reservations/arm-reservations/samples/v8/javascript/sample.env diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/README.md b/sdk/reservations/arm-reservations/samples/v8/typescript/README.md similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/typescript/README.md rename to sdk/reservations/arm-reservations/samples/v8/typescript/README.md index d6653465648c..c671e42b42ba 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/README.md +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/README.md @@ -4,34 +4,34 @@ These sample programs show how to use the TypeScript client libraries for in som | **File Name** | **Description** | | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| [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 | -| [calculateRefundPostSample.ts][calculaterefundpostsample] | Calculate price for returning `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/CalculateRefund.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 | -| [operationListSample.ts][operationlistsample] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetOperations.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-11-01/examples/CalculateExchange.json | +| [calculateRefundPostSample.ts][calculaterefundpostsample] | Calculate price for returning `Reservations` if there are no policy errors. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateRefund.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-11-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-11-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-11-01/examples/GetCatalog.json | +| [operationListSample.ts][operationlistsample] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetOperations.json | | [quotaCreateOrUpdateSample.ts][quotacreateorupdatesample] | 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 | | [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 | | [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. • 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 | -| [reservationArchiveSample.ts][reservationarchivesample] | Archiving a `Reservation` moves it to `Archived` state. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Archive.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 | -| [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 | -| [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 | -| [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 | -| [reservationUnarchiveSample.ts][reservationunarchivesample] | Unarchiving a `Reservation` moves it to the state it was before archiving. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Unarchive.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 | -| [returnPostSample.ts][returnpostsample] | Return a reservation. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json | +| [reservationArchiveSample.ts][reservationarchivesample] | Archiving a `Reservation` moves it to `Archived` state. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Archive.json | +| [reservationAvailableScopesSample.ts][reservationavailablescopessample] | Check whether the scopes from request is valid for `Reservation`. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAvailableScope.json | +| [reservationGetSample.ts][reservationgetsample] | Get specific `Reservation` details. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.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-11-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-11-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-11-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-11-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-11-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-11-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-11-01/examples/GetReservationOrderDetails.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-11-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-11-01/examples/PurchaseReservationOrder.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-11-01/examples/SplitReservation.json | +| [reservationUnarchiveSample.ts][reservationunarchivesample] | Restores a `Reservation` to the state it was before archiving. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Unarchive.json | +| [reservationUpdateSample.ts][reservationupdatesample] | Updates the applied scopes of the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/UpdateReservation.json | +| [returnPostSample.ts][returnpostsample] | Return a reservation and get refund information. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Return.json | ## Prerequisites @@ -83,34 +83,34 @@ npx cross-env node dist/calculateExchangePostSample.js Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[calculateexchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchangePostSample.ts -[calculaterefundpostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateRefundPostSample.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 -[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/operationListSample.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 -[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 -[reservationarchivesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationArchiveSample.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 -[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 -[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 -[reservationsplitsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationSplitSample.ts -[reservationunarchivesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUnarchiveSample.ts -[reservationupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUpdateSample.ts -[returnpostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/returnPostSample.ts +[calculateexchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/calculateExchangePostSample.ts +[calculaterefundpostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/calculateRefundPostSample.ts +[exchangepostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/exchangePostSample.ts +[getappliedreservationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/getAppliedReservationListSample.ts +[getcatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/getCatalogSample.ts +[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/operationListSample.ts +[quotacreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaCreateOrUpdateSample.ts +[quotagetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaGetSample.ts +[quotalistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaListSample.ts +[quotarequeststatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaRequestStatusGetSample.ts +[quotarequeststatuslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaRequestStatusListSample.ts +[quotaupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaUpdateSample.ts +[reservationarchivesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationArchiveSample.ts +[reservationavailablescopessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationAvailableScopesSample.ts +[reservationgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationGetSample.ts +[reservationlistallsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListAllSample.ts +[reservationlistrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListRevisionsSample.ts +[reservationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListSample.ts +[reservationmergesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationMergeSample.ts +[reservationordercalculatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderCalculateSample.ts +[reservationorderchangedirectorysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderChangeDirectorySample.ts +[reservationordergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderGetSample.ts +[reservationorderlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderListSample.ts +[reservationorderpurchasesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderPurchaseSample.ts +[reservationsplitsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationSplitSample.ts +[reservationunarchivesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationUnarchiveSample.ts +[reservationupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationUpdateSample.ts +[returnpostsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v8/typescript/src/returnPostSample.ts [apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations/README.md diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/package.json b/sdk/reservations/arm-reservations/samples/v8/typescript/package.json similarity index 97% rename from sdk/reservations/arm-reservations/samples/v7/typescript/package.json rename to sdk/reservations/arm-reservations/samples/v8/typescript/package.json index c2389a3e7edc..e3e271fbcab6 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/package.json +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/package.json @@ -35,7 +35,7 @@ }, "devDependencies": { "@types/node": "^14.0.0", - "typescript": "~4.6.0", + "typescript": "~4.8.0", "rimraf": "latest" } } diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/sample.env b/sdk/reservations/arm-reservations/samples/v8/typescript/sample.env similarity index 100% rename from sdk/reservations/arm-reservations/samples/v7/typescript/sample.env rename to sdk/reservations/arm-reservations/samples/v8/typescript/sample.env diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchangePostSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/calculateExchangePostSample.ts similarity index 71% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchangePostSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/calculateExchangePostSample.ts index a8f580f91d04..302f78a43f79 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchangePostSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/calculateExchangePostSample.ts @@ -13,6 +13,9 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors. @@ -20,7 +23,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * * @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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateExchange.json */ async function calculateExchange() { const body: CalculateExchangeRequest = { @@ -47,6 +50,20 @@ async function calculateExchange() { sku: { name: "Standard_B1ls" }, term: "P1Y" } + ], + savingsPlansToPurchase: [ + { + appliedScopeProperties: { + resourceGroupId: + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg" + }, + appliedScopeType: "Single", + billingScopeId: "/subscriptions/10000000-0000-0000-0000-000000000000", + commitment: { amount: 15.23, currencyCode: "USD", grain: "Hourly" }, + displayName: "ComputeSavingsPlan", + sku: { name: "Compute_Savings_Plan" }, + term: "P1Y" + } ] } }; @@ -56,4 +73,8 @@ async function calculateExchange() { console.log(result); } -calculateExchange().catch(console.error); +async function main() { + calculateExchange(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateRefundPostSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/calculateRefundPostSample.ts similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateRefundPostSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/calculateRefundPostSample.ts index c31787c0f500..1a7081e9a5e9 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateRefundPostSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/calculateRefundPostSample.ts @@ -13,6 +13,9 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Calculate price for returning `Reservations` if there are no policy errors. @@ -20,9 +23,9 @@ import { DefaultAzureCredential } from "@azure/identity"; * * @summary Calculate price for returning `Reservations` if there are no policy errors. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateRefund.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateRefund.json */ -async function purchase() { +async function calculateRefund() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; const body: CalculateRefundRequest = { id: @@ -42,4 +45,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + calculateRefund(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/exchangePostSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/exchangePostSample.ts similarity index 85% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/exchangePostSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/exchangePostSample.ts index 030ed4bb2d04..ff302b4061a5 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/exchangePostSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/exchangePostSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { ExchangeRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. @@ -17,7 +20,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * * @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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Exchange.json */ async function exchange() { const body: ExchangeRequest = { @@ -29,4 +32,8 @@ async function exchange() { console.log(result); } -exchange().catch(console.error); +async function main() { + exchange(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/getAppliedReservationListSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/getAppliedReservationListSample.ts similarity index 84% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/getAppliedReservationListSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/getAppliedReservationListSample.ts index 6c3a5e581b79..b88a4342035e 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/getAppliedReservationListSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/getAppliedReservationListSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAppliedReservations.json */ async function appliedReservationList() { const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; @@ -25,4 +28,8 @@ async function appliedReservationList() { console.log(result); } -appliedReservationList().catch(console.error); +async function main() { + appliedReservationList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/getCatalogSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/getCatalogSample.ts similarity index 76% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/getCatalogSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/getCatalogSample.ts index 6feb5547567c..0cd7a8a6e4ee 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/getCatalogSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/getCatalogSample.ts @@ -13,12 +13,15 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetCatalog.json */ async function catalog() { const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; @@ -27,8 +30,15 @@ async function catalog() { const options: GetCatalogOptionalParams = { reservedResourceType, location }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); - const result = await client.getCatalog(subscriptionId, options); - console.log(result); + const resArray = new Array(); + for await (let item of client.listCatalog(subscriptionId, options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + catalog(); } -catalog().catch(console.error); +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/operationListSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/operationListSample.ts similarity index 82% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/operationListSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/operationListSample.ts index 5dbfb051c5a7..a1fd0e412901 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/operationListSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/operationListSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetOperations.json */ async function getOperations() { const credential = new DefaultAzureCredential(); @@ -27,4 +30,8 @@ async function getOperations() { console.log(resArray); } -getOperations().catch(console.error); +async function main() { + getOperations(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaCreateOrUpdateSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaCreateOrUpdateSample.ts similarity index 95% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaCreateOrUpdateSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaCreateOrUpdateSample.ts index 03bc8bd9a9a9..c683f9fb778f 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaCreateOrUpdateSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaCreateOrUpdateSample.ts @@ -13,6 +13,9 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. @@ -54,8 +57,6 @@ async function quotasRequestPutForCompute() { 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: @@ -97,10 +98,6 @@ async function quotasRequestPutForMachineLearningServicesDedicatedResource() { 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: @@ -142,6 +139,10 @@ async function quotasRequestPutForMachineLearningServicesLowPriorityResource() { console.log(result); } -quotasRequestPutForMachineLearningServicesLowPriorityResource().catch( - console.error -); +async function main() { + quotasRequestPutForCompute(); + quotasRequestPutForMachineLearningServicesDedicatedResource(); + quotasRequestPutForMachineLearningServicesLowPriorityResource(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaGetSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaGetSample.ts similarity index 90% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaGetSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaGetSample.ts index a04e7cc12f2b..35d5937f2d83 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaGetSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaGetSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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. @@ -33,4 +36,8 @@ async function quotasRequestForCompute() { console.log(result); } -quotasRequestForCompute().catch(console.error); +async function main() { + quotasRequestForCompute(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaListSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaListSample.ts similarity index 93% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaListSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaListSample.ts index a657ceedf0cf..87dba118087f 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaListSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaListSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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. @@ -34,8 +37,6 @@ async function quotasListUsagesForCompute() { 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. * @@ -59,4 +60,9 @@ async function quotasListUsagesMachineLearningServices() { console.log(resArray); } -quotasListUsagesMachineLearningServices().catch(console.error); +async function main() { + quotasListUsagesForCompute(); + quotasListUsagesMachineLearningServices(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatusGetSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaRequestStatusGetSample.ts similarity index 95% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatusGetSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaRequestStatusGetSample.ts index 2e63c13e7444..b27467a8b488 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatusGetSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaRequestStatusGetSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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. @@ -33,8 +36,6 @@ async function quotaRequestFailed() { 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. * @@ -57,8 +58,6 @@ async function quotaRequestInProgress() { 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. * @@ -81,4 +80,10 @@ async function quotaRequestStatus() { console.log(result); } -quotaRequestStatus().catch(console.error); +async function main() { + quotaRequestFailed(); + quotaRequestInProgress(); + quotaRequestStatus(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatusListSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaRequestStatusListSample.ts similarity index 91% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatusListSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaRequestStatusListSample.ts index b840bf35780b..238376b0d965 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatusListSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaRequestStatusListSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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. @@ -34,4 +37,8 @@ async function quotaRequestHistory() { console.log(resArray); } -quotaRequestHistory().catch(console.error); +async function main() { + quotaRequestHistory(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaUpdateSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaUpdateSample.ts similarity index 93% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaUpdateSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaUpdateSample.ts index d57da25389b5..4924ed1a1d2a 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaUpdateSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/quotaUpdateSample.ts @@ -13,6 +13,9 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Update the quota (service limits) of this resource to the requested value. @@ -52,4 +55,8 @@ async function quotasRequestPatchForCompute() { console.log(result); } -quotasRequestPatchForCompute().catch(console.error); +async function main() { + quotasRequestPatchForCompute(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationArchiveSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationArchiveSample.ts similarity index 85% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationArchiveSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationArchiveSample.ts index c65ce1b4f38e..41f6a5462d42 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationArchiveSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationArchiveSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Archiving a `Reservation` moves it to `Archived` state. * * @summary Archiving a `Reservation` moves it to `Archived` state. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Archive.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Archive.json */ async function archive() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -29,4 +32,8 @@ async function archive() { console.log(result); } -archive().catch(console.error); +async function main() { + archive(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationAvailableScopesSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationAvailableScopesSample.ts similarity index 74% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationAvailableScopesSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationAvailableScopesSample.ts index ea2cffcc5365..10ce0a6a0864 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationAvailableScopesSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationAvailableScopesSample.ts @@ -13,14 +13,17 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** - * This sample demonstrates how to Get Available Scopes for `Reservation`. + * This sample demonstrates how to Check whether the scopes from request is valid for `Reservation`. * - * @summary Get Available Scopes for `Reservation`. + * @summary Check whether the scopes from request is valid for `Reservation`. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetAvailableScope.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAvailableScope.json */ async function availableScopes() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -40,4 +43,8 @@ async function availableScopes() { console.log(result); } -availableScopes().catch(console.error); +async function main() { + availableScopes(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationGetSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationGetSample.ts similarity index 85% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationGetSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationGetSample.ts index 7cf70872ec6c..cd3aac3f0864 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationGetSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationGetSample.ts @@ -13,26 +13,33 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.json */ async function getReservation() { - const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const expand = "renewProperties"; const options: ReservationGetOptionalParams = { expand }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); const result = await client.reservation.get( - reservationId, reservationOrderId, + reservationId, options ); console.log(result); } -getReservation().catch(console.error); +async function main() { + getReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListAllSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListAllSample.ts similarity index 85% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListAllSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListAllSample.ts index 181af032301e..9f5130a8c51b 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListAllSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListAllSample.ts @@ -13,14 +13,17 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservations.json */ -async function catalog() { +async function reservationListAll() { const filter = "(properties%2farchived+eq+false)"; const orderby = "properties/displayName asc"; const skiptoken = 50; @@ -40,4 +43,8 @@ async function catalog() { console.log(resArray); } -catalog().catch(console.error); +async function main() { + reservationListAll(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListRevisionsSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListRevisionsSample.ts similarity index 82% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListRevisionsSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListRevisionsSample.ts index 1c3343dc5759..5b0001972913 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListRevisionsSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListRevisionsSample.ts @@ -10,26 +10,33 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationRevisions.json */ async function reservationRevisions() { - const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); const resArray = new Array(); for await (let item of client.reservation.listRevisions( - reservationId, - reservationOrderId + reservationOrderId, + reservationId )) { resArray.push(item); } console.log(resArray); } -reservationRevisions().catch(console.error); +async function main() { + reservationRevisions(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListSample.ts similarity index 84% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListSample.ts index 5274d25a1d3a..a3ebd27e1593 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationListSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationListSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationsFromOrder.json */ async function reservationList() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -28,4 +31,8 @@ async function reservationList() { console.log(resArray); } -reservationList().catch(console.error); +async function main() { + reservationList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationMergeSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationMergeSample.ts similarity index 89% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationMergeSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationMergeSample.ts index dd0004916273..46814d0c9d4d 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationMergeSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationMergeSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { MergeRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/MergeReservations.json */ async function merge() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -34,4 +37,8 @@ async function merge() { console.log(result); } -merge().catch(console.error); +async function main() { + merge(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderCalculateSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderCalculateSample.ts similarity index 85% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderCalculateSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderCalculateSample.ts index 749f5d1123e4..99ec9258c3d1 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderCalculateSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderCalculateSample.ts @@ -10,14 +10,17 @@ // Licensed under the MIT License. import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateReservationOrder.json */ -async function purchase() { +async function calculatePrice() { const body: PurchaseRequest = { appliedScopeType: "Shared", appliedScopes: [], @@ -37,4 +40,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + calculatePrice(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderChangeDirectorySample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderChangeDirectorySample.ts similarity index 86% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderChangeDirectorySample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderChangeDirectorySample.ts index abbffe9d6b0d..a92069dd5842 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderChangeDirectorySample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderChangeDirectorySample.ts @@ -13,12 +13,15 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/ChangeDirectoryReservationOrder.json */ async function changeDirectory() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -34,4 +37,8 @@ async function changeDirectory() { console.log(result); } -changeDirectory().catch(console.error); +async function main() { + changeDirectory(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderGetSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderGetSample.ts similarity index 82% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderGetSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderGetSample.ts index 8c5d8ffef274..14d455b05deb 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderGetSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderGetSample.ts @@ -13,14 +13,17 @@ import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetails.json */ -async function getReservation() { +async function getReservationOrder() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); @@ -28,13 +31,11 @@ async function getReservation() { 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json */ async function getReservationWithExpandPayments() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -46,4 +47,9 @@ async function getReservationWithExpandPayments() { console.log(result); } -getReservationWithExpandPayments().catch(console.error); +async function main() { + getReservationOrder(); + getReservationWithExpandPayments(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderListSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderListSample.ts similarity index 83% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderListSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderListSample.ts index f4fb4725ee98..8baeaa387f8b 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderListSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderListSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrders.json */ async function reservationOrderList() { const credential = new DefaultAzureCredential(); @@ -27,4 +30,8 @@ async function reservationOrderList() { console.log(resArray); } -reservationOrderList().catch(console.error); +async function main() { + reservationOrderList(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderPurchaseSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderPurchaseSample.ts similarity index 89% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderPurchaseSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderPurchaseSample.ts index 485680f8a986..99c787517b11 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderPurchaseSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationOrderPurchaseSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/PurchaseReservationOrder.json */ async function purchase() { const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; @@ -42,4 +45,8 @@ async function purchase() { console.log(result); } -purchase().catch(console.error); +async function main() { + purchase(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationSplitSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationSplitSample.ts similarity index 87% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationSplitSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationSplitSample.ts index 1d7bd5dfa192..442d430c3e51 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationSplitSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationSplitSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { SplitRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/SplitReservation.json */ async function split() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -33,4 +36,8 @@ async function split() { console.log(result); } -split().catch(console.error); +async function main() { + split(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUnarchiveSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationUnarchiveSample.ts similarity index 71% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUnarchiveSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationUnarchiveSample.ts index db30d98b293a..5db346bea2ba 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUnarchiveSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationUnarchiveSample.ts @@ -10,14 +10,17 @@ // Licensed under the MIT License. import { AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** - * This sample demonstrates how to Unarchiving a `Reservation` moves it to the state it was before archiving. + * This sample demonstrates how to Restores a `Reservation` to the state it was before archiving. * - * @summary Unarchiving a `Reservation` moves it to the state it was before archiving. + * @summary Restores a `Reservation` to the state it was before archiving. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Unarchive.json + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Unarchive.json */ async function unarchive() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -31,4 +34,8 @@ async function unarchive() { console.log(result); } -unarchive().catch(console.error); +async function main() { + unarchive(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUpdateSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationUpdateSample.ts similarity index 85% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUpdateSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationUpdateSample.ts index f654cd66c9d5..dc81b1cd22b9 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationUpdateSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/reservationUpdateSample.ts @@ -10,12 +10,15 @@ // Licensed under the MIT License. import { Patch, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * 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 + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/UpdateReservation.json */ async function patchReservation() { const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; @@ -34,4 +37,8 @@ async function patchReservation() { console.log(result); } -patchReservation().catch(console.error); +async function main() { + patchReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/returnPostSample.ts b/sdk/reservations/arm-reservations/samples/v8/typescript/src/returnPostSample.ts similarity index 67% rename from sdk/reservations/arm-reservations/samples/v7/typescript/src/returnPostSample.ts rename to sdk/reservations/arm-reservations/samples/v8/typescript/src/returnPostSample.ts index ddcc2e0b98cc..d0ecb8baaa9f 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/src/returnPostSample.ts +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/src/returnPostSample.ts @@ -10,15 +10,18 @@ // Licensed under the MIT License. import { RefundRequest, AzureReservationAPI } from "@azure/arm-reservations"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** - * This sample demonstrates how to Return a reservation. + * This sample demonstrates how to Return a reservation and get refund information. * - * @summary Return a reservation. - * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json + * @summary Return a reservation and get refund information. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Return.json */ -async function purchase() { - const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; +async function returnAReservation() { + const reservationOrderId = "50000000-aaaa-bbbb-cccc-100000000004"; const body: RefundRequest = { properties: { reservationToReturn: { @@ -33,8 +36,12 @@ async function purchase() { }; const credential = new DefaultAzureCredential(); const client = new AzureReservationAPI(credential); - const result = await client.return.post(reservationOrderId, body); + const result = await client.return.beginPostAndWait(reservationOrderId, body); console.log(result); } -purchase().catch(console.error); +async function main() { + returnAReservation(); +} + +main().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/tsconfig.json b/sdk/reservations/arm-reservations/samples/v8/typescript/tsconfig.json similarity index 92% rename from sdk/reservations/arm-reservations/samples/v7/typescript/tsconfig.json rename to sdk/reservations/arm-reservations/samples/v8/typescript/tsconfig.json index 416c2dd82e00..e26ce2a6d8f7 100644 --- a/sdk/reservations/arm-reservations/samples/v7/typescript/tsconfig.json +++ b/sdk/reservations/arm-reservations/samples/v8/typescript/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2018", + "target": "ES2020", "module": "commonjs", "moduleResolution": "node", "resolveJsonModule": true, diff --git a/sdk/reservations/arm-reservations/src/azureReservationAPI.ts b/sdk/reservations/arm-reservations/src/azureReservationAPI.ts index aa2b1474cd7a..d0f5e804ecb3 100644 --- a/sdk/reservations/arm-reservations/src/azureReservationAPI.ts +++ b/sdk/reservations/arm-reservations/src/azureReservationAPI.ts @@ -9,6 +9,8 @@ import * as coreClient from "@azure/core-client"; import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "./pagingHelper"; import { ReservationImpl, ReservationOrderImpl, @@ -35,12 +37,16 @@ import * as Parameters from "./models/parameters"; import * as Mappers from "./models/mappers"; import { AzureReservationAPIOptionalParams, + Catalog, + GetCatalogNextOptionalParams, GetCatalogOptionalParams, GetCatalogResponse, GetAppliedReservationListOptionalParams, - GetAppliedReservationListResponse + GetAppliedReservationListResponse, + GetCatalogNextResponse } from "./models"; +/// export class AzureReservationAPI extends coreClient.ServiceClient { $host: string; @@ -66,22 +72,19 @@ export class AzureReservationAPI extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-reservations/7.2.1`; + const packageDetails = `azsdk-js-arm-reservations/8.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix }, - baseUri: + endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); @@ -107,7 +110,9 @@ export class AzureReservationAPI extends coreClient.ServiceClient { this.pipeline.addPolicy( coreRestPipeline.bearerTokenAuthenticationPolicy({ credential: credentials, - scopes: `${optionsWithDefaults.credentialScopes}`, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, challengeCallbacks: { authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge @@ -134,7 +139,72 @@ export class AzureReservationAPI extends coreClient.ServiceClient { * @param subscriptionId Id of the subscription * @param options The options parameters. */ - getCatalog( + public listCatalog( + subscriptionId: string, + options?: GetCatalogOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getCatalogPagingAll(subscriptionId, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.getCatalogPagingPage(subscriptionId, options, settings); + } + }; + } + + private async *getCatalogPagingPage( + subscriptionId: string, + options?: GetCatalogOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: GetCatalogResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getCatalog(subscriptionId, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getCatalogNext( + subscriptionId, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getCatalogPagingAll( + subscriptionId: string, + options?: GetCatalogOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getCatalogPagingPage( + subscriptionId, + options + )) { + yield* page; + } + } + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * @param subscriptionId Id of the subscription + * @param options The options parameters. + */ + private _getCatalog( subscriptionId: string, options?: GetCatalogOptionalParams ): Promise { @@ -160,6 +230,23 @@ export class AzureReservationAPI extends coreClient.ServiceClient { ); } + /** + * GetCatalogNext + * @param subscriptionId Id of the subscription + * @param nextLink The nextLink from the previous successful call to the GetCatalog method. + * @param options The options parameters. + */ + private _getCatalogNext( + subscriptionId: string, + nextLink: string, + options?: GetCatalogNextOptionalParams + ): Promise { + return this.sendOperationRequest( + { subscriptionId, nextLink, options }, + getCatalogNextOperationSpec + ); + } + reservation: Reservation; reservationOrder: ReservationOrder; operation: Operation; @@ -178,12 +265,7 @@ const getCatalogOperationSpec: coreClient.OperationSpec = { httpMethod: "GET", responses: { 200: { - bodyMapper: { - type: { - name: "Sequence", - element: { type: { name: "Composite", className: "Catalog" } } - } - } + bodyMapper: Mappers.CatalogsResult }, default: { bodyMapper: Mappers.ErrorModel @@ -191,11 +273,14 @@ const getCatalogOperationSpec: coreClient.OperationSpec = { }, queryParameters: [ Parameters.apiVersion, + Parameters.filter, Parameters.reservedResourceType, Parameters.location, Parameters.publisherId, Parameters.offerId, - Parameters.planId + Parameters.planId, + Parameters.skip, + Parameters.take1 ], urlParameters: [Parameters.$host, Parameters.subscriptionId], headerParameters: [Parameters.accept], @@ -218,3 +303,22 @@ const getAppliedReservationListOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const getCatalogNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CatalogsResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/reservations/arm-reservations/src/index.ts b/sdk/reservations/arm-reservations/src/index.ts index 17b76c65cbec..69abac60093e 100644 --- a/sdk/reservations/arm-reservations/src/index.ts +++ b/sdk/reservations/arm-reservations/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { AzureReservationAPI } from "./azureReservationAPI"; export * from "./operationsInterfaces"; diff --git a/sdk/reservations/arm-reservations/src/models/index.ts b/sdk/reservations/arm-reservations/src/models/index.ts index a4378a3bef8b..7c578a51bf82 100644 --- a/sdk/reservations/arm-reservations/src/models/index.ts +++ b/sdk/reservations/arm-reservations/src/models/index.ts @@ -19,40 +19,65 @@ export interface AvailableScopeRequestProperties { scopes?: string[]; } +/** The response of available scope api containing scopes and their eligibilities. */ export interface AvailableScopeProperties { + /** The scopes checked by the available scope api. */ properties?: SubscriptionScopeProperties; } +/** The scopes checked by the available scope api. */ export interface SubscriptionScopeProperties { scopes?: ScopeProperties[]; } +/** The scope and whether it is valid. */ export interface ScopeProperties { scope?: string; valid?: boolean; } +/** Error information */ export interface ErrorModel { + /** Extended error information including error code and error message */ error?: ExtendedErrorInfo; } +/** Extended error information including error code and error message */ export interface ExtendedErrorInfo { + /** Error code describing the reason that service is not able to process the incoming request */ code?: ErrorResponseCode; message?: string; } +/** The list of catalogs and pagination information. */ +export interface CatalogsResult { + /** + * The list of catalogs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Catalog[]; + /** + * The link (url) to the next page of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; + /** The total amount of catalog items. */ + totalItems?: number; +} + +/** Product details of a type of resource. */ export interface Catalog { /** - * The type of resource the SKU applies to. + * The type of resource the sku applies to. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly resourceType?: string; /** - * The name of SKU + * The name of sku * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; - /** The billing plan options available for this SKU. */ + /** The billing plan options available for this sku. */ billingPlans?: { [propertyName: string]: ReservationBillingPlan[] }; /** * Available reservation terms for this resource @@ -64,19 +89,19 @@ export interface Catalog { /** NOTE: This property will not be serialized. It can only be populated by the server. */ readonly skuProperties?: SkuProperty[]; /** - * Pricing information about the SKU + * Pricing information about the sku * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly msrp?: CatalogMsrp; /** NOTE: This property will not be serialized. It can only be populated by the server. */ readonly restrictions?: SkuRestriction[]; /** - * The tier of this SKU + * The tier of this sku * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly tier?: string; /** - * The size of this SKU + * The size of this sku * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly size?: string; @@ -84,6 +109,7 @@ export interface Catalog { readonly capabilities?: SkuCapability[]; } +/** Property of a sku. */ export interface SkuProperty { /** An invariant to describe the feature. */ name?: string; @@ -91,27 +117,30 @@ export interface SkuProperty { value?: string; } -/** Pricing information about the SKU */ +/** Pricing information about the sku */ export interface CatalogMsrp { /** Amount in pricing currency. Tax not included. */ p1Y?: Price; } +/** Pricing information containing the amount and the currency code */ export interface Price { /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ currencyCode?: string; amount?: number; } +/** Restriction of a sku. */ export interface SkuRestriction { /** The type of restrictions. */ type?: string; - /** The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. */ + /** The value of restrictions. If the restriction type is set to location. This would be different locations where the sku is restricted. */ values?: string[]; /** The reason for restriction. */ reasonCode?: string; } +/** Capability of a sku. */ export interface SkuCapability { /** An invariant to describe the feature. */ name?: string; @@ -119,6 +148,7 @@ export interface SkuCapability { value?: string; } +/** The response for applied reservations api */ export interface AppliedReservations { /** * Identifier of the applied reservations @@ -135,55 +165,81 @@ export interface AppliedReservations { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; + /** Paginated list of applied reservations */ reservationOrderIds?: AppliedReservationList; } +/** Paginated list of applied reservations */ export interface AppliedReservationList { value?: string[]; /** Url to get the next page of reservations */ nextLink?: string; } +/** The request for reservation purchase */ export interface PurchaseRequest { + /** The name of sku */ sku?: SkuName; - /** The Azure Region where the reserved resource lives. */ + /** The Azure region where the reserved resource lives. */ location?: string; /** The type of the resource that is being reserved. */ reservedResourceType?: ReservedResourceType; - /** Subscription that will be charged for purchasing Reservation */ + /** Subscription that will be charged for purchasing reservation or savings plan */ billingScopeId?: string; - /** Represent the term of Reservation. */ + /** Represent the term of reservation. */ term?: ReservationTerm; /** Represent the billing plans. */ billingPlan?: ReservationBillingPlan; - /** Quantity of the SKUs that are part of the Reservation. */ + /** Quantity of the skus that are part of the reservation. */ quantity?: number; - /** Friendly name of the Reservation */ + /** Friendly name of the reservation */ displayName?: string; /** Type of the Applied Scope. */ appliedScopeType?: AppliedScopeType; /** List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. */ appliedScopes?: string[]; + /** Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup */ + appliedScopeProperties?: AppliedScopeProperties; /** Setting this to true will automatically purchase a new reservation on the expiration date time. */ renew?: boolean; /** Properties specific to each reserved resource type. Not required if not applicable. */ reservedResourceProperties?: PurchaseRequestPropertiesReservedResourceProperties; + /** This is the date-time when the Azure hybrid benefit needs to be reviewed. */ + reviewDateTime?: Date; } +/** The name of sku */ export interface SkuName { name?: string; } +/** Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup */ +export interface AppliedScopeProperties { + /** Tenant ID where the savings plan should apply benefit. */ + tenantId?: string; + /** Fully-qualified identifier of the management group where the benefit must be applied. */ + managementGroupId?: string; + /** Fully-qualified identifier of the subscription. */ + subscriptionId?: string; + /** Fully-qualified identifier of the resource group. */ + resourceGroupId?: string; + /** Display name */ + displayName?: string; +} + /** Properties specific to each reserved resource type. Not required if not applicable. */ export interface PurchaseRequestPropertiesReservedResourceProperties { /** Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type. */ instanceFlexibility?: InstanceFlexibility; } +/** The response of calculate price for reservation. */ export interface CalculatePriceResponse { + /** Properties for calculate price response */ properties?: CalculatePriceResponseProperties; } +/** Properties for calculate price response */ export interface CalculatePriceResponseProperties { /** Currency and amount that customer will be charged in customer's local currency. Tax is not included. */ billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; @@ -199,9 +255,9 @@ export interface CalculatePriceResponseProperties { isBillingPartnerManaged?: boolean; /** GUID that represents reservation order that can be placed after calculating price. */ reservationOrderId?: string; - /** Title of SKU that is being purchased. */ + /** Title of sku that is being purchased. */ skuTitle?: string; - /** Description of SKU that is being purchased. */ + /** Description of sku that is being purchased. */ skuDescription?: string; /** Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. */ pricingCurrencyTotal?: CalculatePriceResponsePropertiesPricingCurrencyTotal; @@ -246,12 +302,14 @@ export interface ExtendedStatusInfo { message?: string; } +/** List of `ReservationOrder`s */ export interface ReservationOrderList { value?: ReservationOrderResponse[]; /** Url to get the next page of reservationOrders. */ nextLink?: string; } +/** Details of a reservation order being returned. */ export interface ReservationOrderResponse { etag?: number; /** @@ -280,13 +338,15 @@ export interface ReservationOrderResponse { requestDateTime?: Date; /** This is the DateTime when the reservation was created. */ createdDateTime?: Date; - /** This is the date when the Reservation will expire. */ + /** This is the date when the reservation will expire. */ expiryDate?: Date; + /** This is the date-time when the reservation will expire. */ + expiryDateTime?: Date; /** This is the DateTime when the reservation benefit started. */ benefitStartTime?: Date; - /** Total Quantity of the SKUs purchased in the Reservation. */ + /** Total Quantity of the skus purchased in the reservation. */ originalQuantity?: number; - /** Represent the term of Reservation. */ + /** Represent the term of reservation. */ term?: ReservationTerm; /** Current state of the reservation. */ provisioningState?: ProvisioningState; @@ -295,6 +355,8 @@ export interface ReservationOrderResponse { /** Information describing the type of billing plan for this reservation. */ planInformation?: ReservationOrderBillingPlanInformation; reservations?: ReservationResponse[]; + /** This is the date-time when the Azure Hybrid Benefit needs to be reviewed. */ + reviewDateTime?: Date; } /** Information describing the type of billing plan for this reservation. */ @@ -308,44 +370,11 @@ export interface ReservationOrderBillingPlanInformation { transactions?: PaymentDetail[]; } -/** The definition of the reservation. */ -export interface ReservationResponse { - /** The Azure Region where the reserved resource lives. */ - location?: string; - etag?: number; - /** - * Identifier of the reservation - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * Name of the reservation - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** The sku information associated to this reservation */ - sku?: SkuName; - /** The properties associated to this reservation */ - properties?: ReservationsProperties; - /** - * Type of resource. "Microsoft.Capacity/reservationOrders/reservations" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** Resource Provider type to be reserved. */ - kind?: "Microsoft.Compute"; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - /** The properties of the reservations */ export interface ReservationsProperties { /** The type of the resource that is being reserved. */ reservedResourceType?: ReservedResourceType; - /** Allows reservation discount to be applied across skus within the same Autofit group. Not all skus support instance size flexibility. */ + /** Allows reservation discount to be applied across skus within the same auto fit group. Not all skus support instance size flexibility. */ instanceFlexibility?: InstanceFlexibility; /** Friendly name for user to easily identify the reservation */ displayName?: string; @@ -357,26 +386,30 @@ export interface ReservationsProperties { archived?: boolean; /** Capabilities of the reservation */ capabilities?: string; - /** Quantity of the SKUs that are part of the Reservation. */ + /** Quantity of the skus that are part of the reservation. */ quantity?: number; /** Current state of the reservation. */ provisioningState?: ProvisioningState; - /** DateTime of the Reservation starting when this version is effective from. */ + /** 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. + * DateTime of the last time the reservation was updated. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly lastUpdatedDateTime?: Date; - /** This is the date when the Reservation will expire. */ + /** This is the date when the reservation will expire. */ expiryDate?: Date; - /** Description of the SKU in english. */ + /** This is the date-time when the reservation will expire. */ + expiryDateTime?: Date; + /** This is the date-time when the Azure Hybrid Benefit needs to be reviewed. */ + reviewDateTime?: Date; + /** Description of the sku in english. */ skuDescription?: string; /** The message giving detailed information about the status code. */ extendedStatusInfo?: ExtendedStatusInfo; - /** The billing plan options available for this SKU. */ + /** The billing plan options available for this sku. */ billingPlan?: ReservationBillingPlan; /** * The provisioning state of the reservation for display, e.g. Succeeded @@ -384,15 +417,23 @@ export interface ReservationsProperties { */ readonly displayProvisioningState?: string; /** - * The provisioning state of the reservation, e.g. Succeeded + * The provisioning sub-state of the reservation, e.g. Succeeded * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningSubState?: string; - /** This is the date when the Reservation was purchased. */ + /** This is the date when the reservation was purchased. */ purchaseDate?: Date; + /** This is the date-time when the reservation was purchased. */ + purchaseDateTime?: Date; + /** Properties of reservation split */ splitProperties?: ReservationSplitProperties; + /** Properties of reservation merge */ mergeProperties?: ReservationMergeProperties; - /** Subscription that will be charged for purchasing Reservation */ + /** Properties of reservation swap */ + swapProperties?: ReservationSwapProperties; + /** Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup */ + appliedScopeProperties?: AppliedScopeProperties; + /** Subscription that will be charged for purchasing reservation or savings plan */ billingScopeId?: string; /** Setting this to true will automatically purchase a new reservation on the expiration date time. */ renew?: boolean; @@ -400,8 +441,9 @@ export interface ReservationsProperties { renewSource?: string; /** Reservation Id of the reservation which is purchased because of renew. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. */ renewDestination?: string; + /** The renew properties for a reservation. */ renewProperties?: RenewPropertiesResponse; - /** Represent the term of Reservation. */ + /** Represent the term of reservation. */ term?: ReservationTerm; /** * The applied scope type of the reservation for display, e.g. Shared @@ -420,21 +462,33 @@ export interface ReservationsProperties { readonly utilization?: ReservationsPropertiesUtilization; } +/** Properties of reservation split */ export interface ReservationSplitProperties { - /** List of destination Resource Id that are created due to split. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + /** List of destination resource id that are created due to split. Format of the resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ splitDestinations?: string[]; - /** Resource Id of the Reservation from which this is split. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + /** Resource id of the reservation from which this is split. Format of the resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ splitSource?: string; } +/** Properties of reservation merge */ export interface ReservationMergeProperties { - /** Reservation Resource Id Created due to the merge. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + /** Reservation resource id Created due to the merge. Format of the resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ mergeDestination?: string; - /** Resource Ids of the Source Reservation's merged to form this Reservation. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + /** Resource ids of the source reservation's merged to form this reservation. Format of the resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ mergeSources?: string[]; } +/** Properties of reservation swap */ +export interface ReservationSwapProperties { + /** Resource id of the source reservation that gets swapped. Format of the resource id is /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + swapSource?: string; + /** Reservation resource id that the original resource gets swapped to. Format of the resource id is /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + swapDestination?: string; +} + +/** The renew properties for a reservation. */ export interface RenewPropertiesResponse { + /** The request for reservation purchase */ purchaseProperties?: PurchaseRequest; /** Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. */ pricingCurrencyTotal?: RenewPropertiesResponsePricingCurrencyTotal; @@ -459,7 +513,7 @@ export interface RenewPropertiesResponseBillingCurrencyTotal { /** Reservation utilization */ export interface ReservationsPropertiesUtilization { /** - * The number of days trend for a reservation + * last 7 day utilization trend for a reservation * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly trend?: string; @@ -491,6 +545,30 @@ export interface ReservationUtilizationAggregates { readonly valueUnit?: string; } +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + /** Metadata pertaining to creation and last modification of the resource. */ export interface SystemData { /** The identity that created the resource. */ @@ -507,6 +585,7 @@ export interface SystemData { lastModifiedAt?: Date; } +/** The request for reservation split */ export interface SplitRequest { /** List of the quantities in the new reservations to create. */ quantities?: number[]; @@ -514,41 +593,51 @@ export interface SplitRequest { reservationId?: string; } +/** The request for reservation merge */ export interface MergeRequest { /** Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ sources?: string[]; } +/** List of `Reservation`s */ export interface ReservationList { value?: ReservationResponse[]; /** Url to get the next page of reservations. */ nextLink?: string; } +/** The request for reservation patch */ export interface Patch { /** Type of the Applied Scope. */ appliedScopeType?: AppliedScopeType; /** List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. */ appliedScopes?: string[]; + /** Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup */ + appliedScopeProperties?: AppliedScopeProperties; /** Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type. */ instanceFlexibility?: InstanceFlexibility; - /** Name of the Reservation */ + /** Display name of the reservation */ name?: string; /** Setting this to true will automatically purchase a new reservation on the expiration date time. */ renew?: boolean; renewProperties?: PatchPropertiesRenewProperties; + /** This is the date-time when the Azure hybrid benefit needs to be reviewed. */ + reviewDateTime?: Date; } export interface PatchPropertiesRenewProperties { + /** The request for reservation purchase */ purchaseProperties?: PurchaseRequest; } +/** Paginated list of operations */ export interface OperationList { value?: OperationResponse[]; /** Url to get the next page of items. */ nextLink?: string; } +/** The response containing operation information */ export interface OperationResponse { /** Name of the operation */ name?: string; @@ -562,6 +651,7 @@ export interface OperationResponse { properties?: Record; } +/** Information about an operation */ export interface OperationDisplay { provider?: string; resource?: string; @@ -569,12 +659,15 @@ export interface OperationDisplay { description?: string; } +/** Request containing information needed for calculating refund. */ export interface CalculateRefundRequest { /** Fully qualified identifier of the reservation order being returned */ id?: string; + /** Properties needed for calculate refund including the scope and the reservation to be returned. */ properties?: CalculateRefundRequestProperties; } +/** Properties needed for calculate refund including the scope and the reservation to be returned. */ export interface CalculateRefundRequestProperties { /** The scope of the refund, e.g. Reservation */ scope?: string; @@ -584,24 +677,29 @@ export interface CalculateRefundRequestProperties { /** Reservation to return */ export interface ReservationToReturn { - /** Fully qualified identifier of the Reservation being returned */ + /** Fully qualified identifier of the reservation being returned */ reservationId?: string; /** Quantity to be returned. Must be greater than zero. */ quantity?: number; } +/** The response of calculate refund containing refund information of reservation */ export interface CalculateRefundResponse { /** Fully qualified identifier of the reservation being returned */ id?: string; + /** The refund properties of reservation */ properties?: RefundResponseProperties; } +/** The refund properties of reservation */ export interface RefundResponseProperties { /** Refund session identifier */ sessionId?: string; /** Quantity to be returned */ quantity?: number; + /** Pricing information containing the amount and the currency code */ billingRefundAmount?: Price; + /** Pricing information containing the amount and the currency code */ pricingRefundAmount?: Price; /** Refund policy result */ policyResult?: RefundPolicyResult; @@ -617,7 +715,9 @@ export interface RefundPolicyResult { /** Refund policy result property */ export interface RefundPolicyResultProperty { + /** Pricing information containing the amount and the currency code */ consumedRefundsTotal?: Price; + /** Pricing information containing the amount and the currency code */ maxRefundLimit?: Price; /** Refund Policy errors */ policyErrors?: RefundPolicyError[]; @@ -625,6 +725,7 @@ export interface RefundPolicyResultProperty { /** error details */ export interface RefundPolicyError { + /** Error code describing the reason that service is not able to process the incoming request */ code?: ErrorResponseCode; message?: string; } @@ -637,15 +738,21 @@ export interface RefundBillingInformation { completedTransactions?: number; /** The number of total transactions in this reservation's payment */ totalTransactions?: number; + /** Pricing information containing the amount and the currency code */ billingCurrencyTotalPaidAmount?: Price; + /** Pricing information containing the amount and the currency code */ billingCurrencyProratedAmount?: Price; + /** Pricing information containing the amount and the currency code */ billingCurrencyRemainingCommitmentAmount?: Price; } +/** Request containing information needed for returning reservation. */ export interface RefundRequest { + /** Properties needed for refund request including the session id from calculate refund, the scope, the reservation to be returned and the return reason. */ properties?: RefundRequestProperties; } +/** Properties needed for refund request including the session id from calculate refund, the scope, the reservation to be returned and the return reason. */ export interface RefundRequestProperties { /** SessionId that was returned by CalculateRefund API. */ sessionId?: string; @@ -657,9 +764,11 @@ export interface RefundRequestProperties { returnReason?: string; } +/** The response of refund request containing refund information of reservation */ export interface RefundResponse { /** Fully qualified identifier of the reservation being returned */ id?: string; + /** The refund properties of reservation */ properties?: RefundResponseProperties; } @@ -673,10 +782,32 @@ export interface CalculateExchangeRequest { export interface CalculateExchangeRequestProperties { /** List of reservations that are being purchased in this exchange. */ reservationsToPurchase?: PurchaseRequest[]; + /** List of savings plans that are being purchased in this exchange. */ + savingsPlansToPurchase?: SavingsPlanPurchaseRequest[]; /** List of reservations that are being returned in this exchange. */ reservationsToExchange?: ReservationToReturn[]; } +/** Request body for savings plan purchase */ +export interface SavingsPlanPurchaseRequest { + /** The name of sku */ + sku?: SkuName; + /** Friendly name of the savings plan */ + displayName?: string; + /** Subscription that will be charged for purchasing reservation or savings plan */ + billingScopeId?: string; + /** Represent savings plan term in ISO 8601 format. */ + term?: SavingsPlanTerm; + /** Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. */ + billingPlan?: BillingPlan; + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup */ + appliedScopeProperties?: AppliedScopeProperties; + /** Commitment towards the benefit. */ + commitment?: Commitment; +} + /** CalculateExchange operation result */ export interface CalculateExchangeOperationResultResponse { /** It should match what is used to GET the operation result. */ @@ -695,11 +826,16 @@ export interface CalculateExchangeOperationResultResponse { export interface CalculateExchangeResponseProperties { /** Exchange session identifier */ sessionId?: string; + /** Pricing information containing the amount and the currency code */ netPayable?: Price; + /** Pricing information containing the amount and the currency code */ refundsTotal?: Price; + /** Pricing information containing the amount and the currency code */ purchasesTotal?: Price; /** Details of the reservations being purchased */ reservationsToPurchase?: ReservationToPurchaseCalculateExchange[]; + /** Details of the savings plans being purchased */ + savingsPlansToPurchase?: SavingsPlanToPurchaseCalculateExchange[]; /** Details of the reservations being returned */ reservationsToExchange?: ReservationToExchange[]; /** Exchange policy errors */ @@ -708,16 +844,27 @@ export interface CalculateExchangeResponseProperties { /** Reservation purchase details */ export interface ReservationToPurchaseCalculateExchange { + /** The request for reservation purchase */ properties?: PurchaseRequest; + /** Pricing information containing the amount and the currency code */ + billingCurrencyTotal?: Price; +} + +/** Savings plan purchase details */ +export interface SavingsPlanToPurchaseCalculateExchange { + /** Request body for savings plan purchase */ + properties?: SavingsPlanPurchaseRequest; + /** Pricing information containing the amount and the currency code */ billingCurrencyTotal?: Price; } /** Reservation refund details */ export interface ReservationToExchange { - /** Fully qualified id of the Reservation being returned. */ + /** Fully qualified id of the reservation being returned. */ reservationId?: string; /** Quantity to be returned */ quantity?: number; + /** Pricing information containing the amount and the currency code */ billingRefundAmount?: Price; /** billing information */ billingInformation?: BillingInformation; @@ -725,8 +872,11 @@ export interface ReservationToExchange { /** billing information */ export interface BillingInformation { + /** Pricing information containing the amount and the currency code */ billingCurrencyTotalPaidAmount?: Price; + /** Pricing information containing the amount and the currency code */ billingCurrencyProratedAmount?: Price; + /** Pricing information containing the amount and the currency code */ billingCurrencyRemainingCommitmentAmount?: Price; } @@ -780,11 +930,16 @@ export interface ExchangeOperationResultResponse { export interface ExchangeResponseProperties { /** Exchange session identifier */ sessionId?: string; + /** Pricing information containing the amount and the currency code */ netPayable?: Price; + /** Pricing information containing the amount and the currency code */ refundsTotal?: Price; + /** Pricing information containing the amount and the currency code */ purchasesTotal?: Price; /** Details of the reservations being purchased */ reservationsToPurchase?: ReservationToPurchaseExchange[]; + /** Details of the savings plans being purchased */ + savingsPlansToPurchase?: SavingsPlanToPurchaseExchange[]; /** Details of the reservations being returned */ reservationsToExchange?: ReservationToReturnForExchange[]; /** Exchange policy errors */ @@ -793,11 +948,27 @@ export interface ExchangeResponseProperties { /** Reservation purchase details */ export interface ReservationToPurchaseExchange { - /** Fully qualified id of the ReservationOrder being purchased */ + /** Fully qualified id of the reservationOrder being purchased */ reservationOrderId?: string; - /** Fully qualified id of the Reservation being purchased. This value is only guaranteed to be non-null if the purchase is successful. */ + /** Fully qualified id of the reservation being purchased. This value is only guaranteed to be non-null if the purchase is successful. */ reservationId?: string; + /** The request for reservation purchase */ properties?: PurchaseRequest; + /** Pricing information containing the amount and the currency code */ + billingCurrencyTotal?: Price; + /** Status of the individual operation. */ + status?: OperationStatus; +} + +/** Savings plan purchase details */ +export interface SavingsPlanToPurchaseExchange { + /** Fully qualified id of the savings plan order being purchased */ + savingsPlanOrderId?: string; + /** Fully qualified id of the savings plan being purchased. This value is only guaranteed to be non-null if the purchase is successful. */ + savingsPlanId?: string; + /** Request body for savings plan purchase */ + properties?: SavingsPlanPurchaseRequest; + /** Pricing information containing the amount and the currency code */ billingCurrencyTotal?: Price; /** Status of the individual operation. */ status?: OperationStatus; @@ -805,10 +976,11 @@ export interface ReservationToPurchaseExchange { /** Reservation refund details */ export interface ReservationToReturnForExchange { - /** Fully qualified id of the Reservation being returned. */ + /** Fully qualified id of the reservation being returned. */ reservationId?: string; /** Quantity to be returned */ quantity?: number; + /** Pricing information containing the amount and the currency code */ billingRefundAmount?: Price; /** billing information */ billingInformation?: BillingInformation; @@ -869,6 +1041,16 @@ export interface ReservationSummary { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly processingCount?: number; + /** + * The number of reservation in Warning state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly warningCount?: number; + /** + * The number of reservation in NoBenefit state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly noBenefitCount?: number; } /** Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. */ @@ -896,6 +1078,7 @@ export interface ErrorDetails { readonly target?: string; } +/** Request body for change directory of a reservation. */ export interface ChangeDirectoryRequest { /** Tenant id GUID that reservation order is to be transferred to */ destinationTenantId?: string; @@ -1252,6 +1435,62 @@ export interface QuotaRequestSubmitResponse { readonly type?: string; } +/** Commitment towards the benefit. */ +export interface Commitment extends Price { + /** Commitment grain. */ + grain?: CommitmentGrain; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +/** The definition of the reservation. */ +export interface ReservationResponse extends ProxyResource { + /** The Azure region where the reserved resource lives. */ + location?: string; + etag?: number; + /** The sku information associated to this reservation */ + sku?: SkuName; + /** The properties associated to this reservation */ + properties?: ReservationsProperties; + /** Resource Provider type to be reserved. */ + kind?: "Microsoft.Compute"; +} + +/** Defines headers for Reservation_split operation. */ +export interface ReservationSplitHeaders { + /** URL for determining when an operation has completed. Only use this value only when Azure-AsyncOperation isn't returned. */ + location?: string; + /** Clients should wait for the Retry-After interval before polling again */ + retryAfter?: number; +} + +/** Defines headers for Reservation_merge operation. */ +export interface ReservationMergeHeaders { + /** URL for determining when an operation has completed. Only use this value only when Azure-AsyncOperation isn't returned. */ + location?: string; + /** Clients should wait for the Retry-After interval before polling again */ + retryAfter?: number; +} + +/** Defines headers for Reservation_update operation. */ +export interface ReservationUpdateHeaders { + /** URL for checking the ongoing status of the operation. */ + azureAsyncOperation?: string; + /** URL for determining when an operation has completed. Only use this value only when Azure-AsyncOperation isn't returned. */ + location?: string; + /** Clients should wait for the Retry-After interval before polling again */ + retryAfter?: number; +} + +/** Defines headers for ReservationOrder_purchase operation. */ +export interface ReservationOrderPurchaseHeaders { + /** URL for determining when an operation has completed. Only use this value only when Azure-AsyncOperation isn't returned. */ + location?: string; + /** Clients should wait for the Retry-After interval before polling again */ + retryAfter?: number; +} + /** Defines headers for Return_post operation. */ export interface ReturnPostHeaders { location?: string; @@ -1615,7 +1854,9 @@ export enum KnownAppliedScopeType { /** Single */ Single = "Single", /** Shared */ - Shared = "Shared" + Shared = "Shared", + /** ManagementGroup */ + ManagementGroup = "ManagementGroup" } /** @@ -1624,7 +1865,8 @@ export enum KnownAppliedScopeType { * this enum contains the known values that the service supports. * ### Known values supported by the service * **Single** \ - * **Shared** + * **Shared** \ + * **ManagementGroup** */ export type AppliedScopeType = string; @@ -1787,6 +2029,54 @@ export enum KnownCreatedByType { */ export type CreatedByType = string; +/** Known values of {@link SavingsPlanTerm} that the service accepts. */ +export enum KnownSavingsPlanTerm { + /** P1Y */ + P1Y = "P1Y", + /** P3Y */ + P3Y = "P3Y" +} + +/** + * Defines values for SavingsPlanTerm. \ + * {@link KnownSavingsPlanTerm} can be used interchangeably with SavingsPlanTerm, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1Y** \ + * **P3Y** + */ +export type SavingsPlanTerm = string; + +/** Known values of {@link BillingPlan} that the service accepts. */ +export enum KnownBillingPlan { + /** P1M */ + P1M = "P1M" +} + +/** + * Defines values for BillingPlan. \ + * {@link KnownBillingPlan} can be used interchangeably with BillingPlan, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1M** + */ +export type BillingPlan = string; + +/** Known values of {@link CommitmentGrain} that the service accepts. */ +export enum KnownCommitmentGrain { + /** Hourly */ + Hourly = "Hourly" +} + +/** + * Defines values for CommitmentGrain. \ + * {@link KnownCommitmentGrain} can be used interchangeably with CommitmentGrain, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Hourly** + */ +export type CommitmentGrain = string; + /** Known values of {@link CalculateExchangeOperationResultStatus} that the service accepts. */ export enum KnownCalculateExchangeOperationResultStatus { /** Succeeded */ @@ -2015,7 +2305,11 @@ export enum KnownDisplayProvisioningState { /** Cancelled */ Cancelled = "Cancelled", /** Failed */ - Failed = "Failed" + Failed = "Failed", + /** Warning */ + Warning = "Warning", + /** NoBenefit */ + NoBenefit = "NoBenefit" } /** @@ -2029,7 +2323,9 @@ export enum KnownDisplayProvisioningState { * **Pending** \ * **Processing** \ * **Cancelled** \ - * **Failed** + * **Failed** \ + * **Warning** \ + * **NoBenefit** */ export type DisplayProvisioningState = string; @@ -2170,7 +2466,7 @@ export type ReservationListRevisionsResponse = ReservationList; /** Optional parameters. */ export interface ReservationListAllOptionalParams extends coreClient.OperationOptions { - /** May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState} */ + /** May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, expiryDateTime, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState} */ filter?: string; /** May be used to sort order by reservation properties. */ orderby?: string; @@ -2203,29 +2499,18 @@ export type ReservationListRevisionsNextResponse = ReservationList; /** Optional parameters. */ export interface ReservationListAllNextOptionalParams - extends coreClient.OperationOptions { - /** May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState} */ - filter?: string; - /** May be used to sort order by reservation properties. */ - orderby?: string; - /** To indicate whether to refresh the roll up counts of the reservations group by provisioning states */ - refreshSummary?: string; - /** The number of reservations to skip from the list before returning results */ - skiptoken?: number; - /** The selected provisioning state */ - selectedState?: string; - /** To number of reservations to return */ - take?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listAllNext operation. */ export type ReservationListAllNextResponse = ReservationsListResult; /** Optional parameters. */ export interface GetCatalogOptionalParams extends coreClient.OperationOptions { + /** May be used to filter by Catalog properties. The filter supports 'eq', 'or', and 'and'. */ + filter?: string; /** The type of the resource for which the skus should be provided. */ reservedResourceType?: string; - /** Filters the skus based on the location specified in this parameter. This can be an azure region or global */ + /** 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; @@ -2233,10 +2518,14 @@ export interface GetCatalogOptionalParams extends coreClient.OperationOptions { offerId?: string; /** Plan id used to get the third party products */ planId?: string; + /** The number of reservations to skip from the list before returning results */ + skip?: number; + /** To number of reservations to return */ + take?: number; } /** Contains response data for the getCatalog operation. */ -export type GetCatalogResponse = Catalog[]; +export type GetCatalogResponse = CatalogsResult; /** Optional parameters. */ export interface GetAppliedReservationListOptionalParams @@ -2245,6 +2534,13 @@ export interface GetAppliedReservationListOptionalParams /** Contains response data for the getAppliedReservationList operation. */ export type GetAppliedReservationListResponse = AppliedReservations; +/** Optional parameters. */ +export interface GetCatalogNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getCatalogNext operation. */ +export type GetCatalogNextResponse = CatalogsResult; + /** Optional parameters. */ export interface ReservationOrderCalculateOptionalParams extends coreClient.OperationOptions {} @@ -2317,7 +2613,12 @@ export interface CalculateRefundPostOptionalParams export type CalculateRefundPostResponse = CalculateRefundResponse; /** Optional parameters. */ -export interface ReturnPostOptionalParams extends coreClient.OperationOptions {} +export interface ReturnPostOptionalParams extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} /** Contains response data for the post operation. */ export type ReturnPostResponse = ReturnPostHeaders & RefundResponse; @@ -2415,18 +2716,7 @@ export type QuotaRequestStatusListResponse = QuotaRequestDetailsList; /** Optional parameters. */ export interface QuotaRequestStatusListNextOptionalParams - extends coreClient.OperationOptions { - /** - * | Field | Supported operators | - * |---------------------|------------------------| - * |requestSubmitTime | ge, le, eq, gt, lt | - */ - filter?: string; - /** Number of records to return. */ - top?: number; - /** Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies a starting point to use for subsequent calls. */ - skiptoken?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList; diff --git a/sdk/reservations/arm-reservations/src/models/mappers.ts b/sdk/reservations/arm-reservations/src/models/mappers.ts index 12fa4777ec75..a1fe563cb29d 100644 --- a/sdk/reservations/arm-reservations/src/models/mappers.ts +++ b/sdk/reservations/arm-reservations/src/models/mappers.ts @@ -139,6 +139,41 @@ export const ExtendedErrorInfo: coreClient.CompositeMapper = { } }; +export const CatalogsResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CatalogsResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Catalog" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + }, + totalItems: { + serializedName: "totalItems", + type: { + name: "Number" + } + } + } + } +}; + export const Catalog: coreClient.CompositeMapper = { type: { name: "Composite", @@ -500,6 +535,13 @@ export const PurchaseRequest: coreClient.CompositeMapper = { } } }, + appliedScopeProperties: { + serializedName: "properties.appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, renew: { defaultValue: false, serializedName: "properties.renew", @@ -513,6 +555,12 @@ export const PurchaseRequest: coreClient.CompositeMapper = { name: "Composite", className: "PurchaseRequestPropertiesReservedResourceProperties" } + }, + reviewDateTime: { + serializedName: "properties.reviewDateTime", + type: { + name: "DateTime" + } } } } @@ -533,6 +581,45 @@ export const SkuName: coreClient.CompositeMapper = { } }; +export const AppliedScopeProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppliedScopeProperties", + modelProperties: { + tenantId: { + serializedName: "tenantId", + type: { + name: "String" + } + }, + managementGroupId: { + serializedName: "managementGroupId", + type: { + name: "String" + } + }, + subscriptionId: { + serializedName: "subscriptionId", + type: { + name: "String" + } + }, + resourceGroupId: { + serializedName: "resourceGroupId", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + } + } + } +}; + export const PurchaseRequestPropertiesReservedResourceProperties: coreClient.CompositeMapper = { type: { name: "Composite", @@ -854,6 +941,12 @@ export const ReservationOrderResponse: coreClient.CompositeMapper = { name: "Date" } }, + expiryDateTime: { + serializedName: "properties.expiryDateTime", + type: { + name: "DateTime" + } + }, benefitStartTime: { serializedName: "properties.benefitStartTime", type: { @@ -902,6 +995,12 @@ export const ReservationOrderResponse: coreClient.CompositeMapper = { } } } + }, + reviewDateTime: { + serializedName: "properties.reviewDateTime", + type: { + name: "DateTime" + } } } } @@ -947,77 +1046,6 @@ export const ReservationOrderBillingPlanInformation: coreClient.CompositeMapper } }; -export const ReservationResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReservationResponse", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - etag: { - serializedName: "etag", - type: { - name: "Number" - } - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "SkuName" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "ReservationsProperties" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - kind: { - defaultValue: "Microsoft.Compute", - isConstant: true, - serializedName: "kind", - type: { - name: "String" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - export const ReservationsProperties: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1107,6 +1135,18 @@ export const ReservationsProperties: coreClient.CompositeMapper = { name: "Date" } }, + expiryDateTime: { + serializedName: "expiryDateTime", + type: { + name: "DateTime" + } + }, + reviewDateTime: { + serializedName: "reviewDateTime", + type: { + name: "DateTime" + } + }, skuDescription: { serializedName: "skuDescription", type: { @@ -1146,6 +1186,12 @@ export const ReservationsProperties: coreClient.CompositeMapper = { name: "Date" } }, + purchaseDateTime: { + serializedName: "purchaseDateTime", + type: { + name: "DateTime" + } + }, splitProperties: { serializedName: "splitProperties", type: { @@ -1160,6 +1206,20 @@ export const ReservationsProperties: coreClient.CompositeMapper = { className: "ReservationMergeProperties" } }, + swapProperties: { + serializedName: "swapProperties", + type: { + name: "Composite", + className: "ReservationSwapProperties" + } + }, + appliedScopeProperties: { + serializedName: "appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, billingScopeId: { serializedName: "billingScopeId", type: { @@ -1275,6 +1335,27 @@ export const ReservationMergeProperties: coreClient.CompositeMapper = { } }; +export const ReservationSwapProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationSwapProperties", + modelProperties: { + swapSource: { + serializedName: "swapSource", + type: { + name: "String" + } + }, + swapDestination: { + serializedName: "swapDestination", + type: { + name: "String" + } + } + } + } +}; + export const RenewPropertiesResponse: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1412,6 +1493,43 @@ export const ReservationUtilizationAggregates: coreClient.CompositeMapper = { } }; +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + 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" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + export const SystemData: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1552,6 +1670,13 @@ export const Patch: coreClient.CompositeMapper = { } } }, + appliedScopeProperties: { + serializedName: "properties.appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, instanceFlexibility: { serializedName: "properties.instanceFlexibility", type: { @@ -1577,6 +1702,12 @@ export const Patch: coreClient.CompositeMapper = { name: "Composite", className: "PatchPropertiesRenewProperties" } + }, + reviewDateTime: { + serializedName: "properties.reviewDateTime", + type: { + name: "DateTime" + } } } } @@ -2060,6 +2191,18 @@ export const CalculateExchangeRequestProperties: coreClient.CompositeMapper = { } } }, + savingsPlansToPurchase: { + serializedName: "savingsPlansToPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanPurchaseRequest" + } + } + } + }, reservationsToExchange: { serializedName: "reservationsToExchange", type: { @@ -2076,6 +2219,66 @@ export const CalculateExchangeRequestProperties: coreClient.CompositeMapper = { } }; +export const SavingsPlanPurchaseRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanPurchaseRequest", + modelProperties: { + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "SkuName" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + billingScopeId: { + serializedName: "properties.billingScopeId", + type: { + name: "String" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + appliedScopeProperties: { + serializedName: "properties.appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, + commitment: { + serializedName: "properties.commitment", + type: { + name: "Composite", + className: "Commitment" + } + } + } + } +}; + export const CalculateExchangeOperationResultResponse: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2161,6 +2364,18 @@ export const CalculateExchangeResponseProperties: coreClient.CompositeMapper = { } } }, + savingsPlansToPurchase: { + serializedName: "savingsPlansToPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanToPurchaseCalculateExchange" + } + } + } + }, reservationsToExchange: { serializedName: "reservationsToExchange", type: { @@ -2207,6 +2422,29 @@ export const ReservationToPurchaseCalculateExchange: coreClient.CompositeMapper } }; +export const SavingsPlanToPurchaseCalculateExchange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanToPurchaseCalculateExchange", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "SavingsPlanPurchaseRequest" + } + }, + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + } + } + } +}; + export const ReservationToExchange: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2451,6 +2689,18 @@ export const ExchangeResponseProperties: coreClient.CompositeMapper = { } } }, + savingsPlansToPurchase: { + serializedName: "savingsPlansToPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanToPurchaseExchange" + } + } + } + }, reservationsToExchange: { serializedName: "reservationsToExchange", type: { @@ -2515,6 +2765,47 @@ export const ReservationToPurchaseExchange: coreClient.CompositeMapper = { } }; +export const SavingsPlanToPurchaseExchange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanToPurchaseExchange", + modelProperties: { + savingsPlanOrderId: { + serializedName: "savingsPlanOrderId", + type: { + name: "String" + } + }, + savingsPlanId: { + serializedName: "savingsPlanId", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "SavingsPlanPurchaseRequest" + } + }, + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + export const ReservationToReturnForExchange: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2645,6 +2936,20 @@ export const ReservationSummary: coreClient.CompositeMapper = { type: { name: "Number" } + }, + warningCount: { + serializedName: "warningCount", + readOnly: true, + type: { + name: "Number" + } + }, + noBenefitCount: { + serializedName: "noBenefitCount", + readOnly: true, + type: { + name: "Number" + } } } } @@ -3431,6 +3736,166 @@ export const QuotaRequestSubmitResponse: coreClient.CompositeMapper = { } }; +export const Commitment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Commitment", + modelProperties: { + ...Price.type.modelProperties, + grain: { + serializedName: "grain", + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const ReservationResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationResponse", + modelProperties: { + ...ProxyResource.type.modelProperties, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + type: { + name: "Number" + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "SkuName" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ReservationsProperties" + } + }, + kind: { + defaultValue: "Microsoft.Compute", + isConstant: true, + serializedName: "kind", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationSplitHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationSplitHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const ReservationMergeHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationMergeHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const ReservationUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationUpdateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const ReservationOrderPurchaseHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationOrderPurchaseHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + export const ReturnPostHeaders: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/reservations/arm-reservations/src/models/parameters.ts b/sdk/reservations/arm-reservations/src/models/parameters.ts index 994017f6406c..7580de91e989 100644 --- a/sdk/reservations/arm-reservations/src/models/parameters.ts +++ b/sdk/reservations/arm-reservations/src/models/parameters.ts @@ -91,7 +91,7 @@ export const reservationId: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-03-01", + defaultValue: "2022-11-01", isConstant: true, serializedName: "api-version", type: { @@ -113,7 +113,7 @@ export const body2: OperationParameter = { export const expand: OperationQueryParameter = { parameterPath: ["options", "expand"], mapper: { - serializedName: "expand", + serializedName: "$expand", type: { name: "String" } @@ -258,21 +258,31 @@ export const planId: OperationQueryParameter = { } }; -export const body3: OperationParameter = { - parameterPath: "body", - mapper: PurchaseRequestMapper +export const skip: OperationQueryParameter = { + parameterPath: ["options", "skip"], + mapper: { + serializedName: "$skip", + type: { + name: "Number" + } + } }; -export const expand1: OperationQueryParameter = { - parameterPath: ["options", "expand"], +export const take1: OperationQueryParameter = { + parameterPath: ["options", "take"], mapper: { - serializedName: "$expand", + serializedName: "$take", type: { - name: "String" + name: "Number" } } }; +export const body3: OperationParameter = { + parameterPath: "body", + mapper: PurchaseRequestMapper +}; + export const body4: OperationParameter = { parameterPath: "body", mapper: ChangeDirectoryRequestMapper diff --git a/sdk/reservations/arm-reservations/src/operations/operation.ts b/sdk/reservations/arm-reservations/src/operations/operation.ts index ddf54ac4cd9e..38cefb491430 100644 --- a/sdk/reservations/arm-reservations/src/operations/operation.ts +++ b/sdk/reservations/arm-reservations/src/operations/operation.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Operation } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -48,22 +49,34 @@ export class OperationImpl implements Operation { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: OperationListOptionalParams + options?: OperationListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: OperationListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -130,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/reservations/arm-reservations/src/operations/quota.ts b/sdk/reservations/arm-reservations/src/operations/quota.ts index ff27b3047014..dc401f97c334 100644 --- a/sdk/reservations/arm-reservations/src/operations/quota.ts +++ b/sdk/reservations/arm-reservations/src/operations/quota.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Quota } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,13 +19,13 @@ import { CurrentQuotaLimitBase, QuotaListNextOptionalParams, QuotaListOptionalParams, + QuotaListResponse, QuotaGetOptionalParams, QuotaGetResponse, QuotaCreateOrUpdateOptionalParams, QuotaCreateOrUpdateResponse, QuotaUpdateOptionalParams, QuotaUpdateResponse, - QuotaListResponse, QuotaListNextResponse } from "../models"; @@ -68,12 +69,16 @@ export class QuotaImpl implements Quota { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( subscriptionId, providerId, location, - options + options, + settings ); } }; @@ -83,16 +88,18 @@ export class QuotaImpl implements Quota { subscriptionId: string, providerId: string, location: string, - options?: QuotaListOptionalParams + options?: QuotaListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - subscriptionId, - providerId, - location, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: QuotaListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(subscriptionId, providerId, location, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( subscriptionId, @@ -102,7 +109,9 @@ export class QuotaImpl implements Quota { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -559,7 +568,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.nextLink, diff --git a/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts b/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts index 24ed7688d736..60af93884247 100644 --- a/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts +++ b/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { QuotaRequestStatus } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { QuotaRequestDetails, QuotaRequestStatusListNextOptionalParams, QuotaRequestStatusListOptionalParams, + QuotaRequestStatusListResponse, QuotaRequestStatusGetOptionalParams, QuotaRequestStatusGetResponse, - QuotaRequestStatusListResponse, QuotaRequestStatusListNextResponse } from "../models"; @@ -62,12 +63,16 @@ export class QuotaRequestStatusImpl implements QuotaRequestStatus { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( subscriptionId, providerId, location, - options + options, + settings ); } }; @@ -77,16 +82,18 @@ export class QuotaRequestStatusImpl implements QuotaRequestStatus { subscriptionId: string, providerId: string, location: string, - options?: QuotaRequestStatusListOptionalParams + options?: QuotaRequestStatusListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - subscriptionId, - providerId, - location, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: QuotaRequestStatusListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(subscriptionId, providerId, location, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( subscriptionId, @@ -96,7 +103,9 @@ export class QuotaRequestStatusImpl implements QuotaRequestStatus { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -244,12 +253,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [ - Parameters.filter, - Parameters.apiVersion1, - Parameters.top, - Parameters.skiptoken1 - ], urlParameters: [ Parameters.$host, Parameters.nextLink, diff --git a/sdk/reservations/arm-reservations/src/operations/reservation.ts b/sdk/reservations/arm-reservations/src/operations/reservation.ts index 779e6c2a2410..89e596a4f13d 100644 --- a/sdk/reservations/arm-reservations/src/operations/reservation.ts +++ b/sdk/reservations/arm-reservations/src/operations/reservation.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Reservation } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,10 +19,13 @@ import { ReservationResponse, ReservationListNextOptionalParams, ReservationListOptionalParams, + ReservationListResponse, ReservationListRevisionsNextOptionalParams, ReservationListRevisionsOptionalParams, + ReservationListRevisionsResponse, ReservationListAllNextOptionalParams, ReservationListAllOptionalParams, + ReservationListAllResponse, AvailableScopeRequest, ReservationAvailableScopesOptionalParams, ReservationAvailableScopesResponse, @@ -31,7 +35,6 @@ import { MergeRequest, ReservationMergeOptionalParams, ReservationMergeResponse, - ReservationListResponse, ReservationGetOptionalParams, ReservationGetResponse, Patch, @@ -39,8 +42,6 @@ import { ReservationUpdateResponse, ReservationArchiveOptionalParams, ReservationUnarchiveOptionalParams, - ReservationListRevisionsResponse, - ReservationListAllResponse, ReservationListNextResponse, ReservationListRevisionsNextResponse, ReservationListAllNextResponse @@ -76,19 +77,29 @@ export class ReservationImpl implements Reservation { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(reservationOrderId, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(reservationOrderId, options, settings); } }; } private async *listPagingPage( reservationOrderId: string, - options?: ReservationListOptionalParams + options?: ReservationListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(reservationOrderId, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ReservationListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(reservationOrderId, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( reservationOrderId, @@ -96,7 +107,9 @@ export class ReservationImpl implements Reservation { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -111,18 +124,18 @@ export class ReservationImpl implements Reservation { /** * List of all the revisions for the `Reservation`. - * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation item * @param options The options parameters. */ public listRevisions( - reservationId: string, reservationOrderId: string, + reservationId: string, options?: ReservationListRevisionsOptionalParams ): PagedAsyncIterableIterator { const iter = this.listRevisionsPagingAll( - reservationId, reservationOrderId, + reservationId, options ); return { @@ -132,48 +145,61 @@ export class ReservationImpl implements Reservation { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listRevisionsPagingPage( - reservationId, reservationOrderId, - options + reservationId, + options, + settings ); } }; } private async *listRevisionsPagingPage( - reservationId: string, reservationOrderId: string, - options?: ReservationListRevisionsOptionalParams + reservationId: string, + options?: ReservationListRevisionsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listRevisions( - reservationId, - reservationOrderId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ReservationListRevisionsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listRevisions( + reservationOrderId, + reservationId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listRevisionsNext( - reservationId, reservationOrderId, + reservationId, continuationToken, options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } private async *listRevisionsPagingAll( - reservationId: string, reservationOrderId: string, + reservationId: string, options?: ReservationListRevisionsOptionalParams ): AsyncIterableIterator { for await (const page of this.listRevisionsPagingPage( - reservationId, reservationOrderId, + reservationId, options )) { yield* page; @@ -196,22 +222,34 @@ export class ReservationImpl implements Reservation { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listAllPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listAllPagingPage(options, settings); } }; } private async *listAllPagingPage( - options?: ReservationListAllOptionalParams + options?: ReservationListAllOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listAll(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ReservationListAllResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listAll(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listAllNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -224,11 +262,11 @@ export class ReservationImpl implements Reservation { } /** - * Get Available Scopes for `Reservation`. + * Check whether the scopes from request is valid for `Reservation`. * * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item - * @param body Available scope + * @param reservationId Id of the reservation item + * @param body Scopes to be checked for eligibility. * @param options The options parameters. */ async beginAvailableScopes( @@ -295,11 +333,11 @@ export class ReservationImpl implements Reservation { } /** - * Get Available Scopes for `Reservation`. + * Check whether the scopes from request is valid for `Reservation`. * * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item - * @param body Available scope + * @param reservationId Id of the reservation item + * @param body Scopes to be checked for eligibility. * @param options The options parameters. */ async beginAvailableScopesAndWait( @@ -504,17 +542,17 @@ export class ReservationImpl implements Reservation { /** * Get specific `Reservation` details. - * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation item * @param options The options parameters. */ get( - reservationId: string, reservationOrderId: string, + reservationId: string, options?: ReservationGetOptionalParams ): Promise { return this.client.sendOperationRequest( - { reservationId, reservationOrderId, options }, + { reservationOrderId, reservationId, options }, getOperationSpec ); } @@ -522,7 +560,7 @@ export class ReservationImpl implements Reservation { /** * Updates the applied scopes of the `Reservation`. * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item + * @param reservationId Id of the reservation item * @param parameters Information needed to patch a reservation item * @param options The options parameters. */ @@ -583,7 +621,8 @@ export class ReservationImpl implements Reservation { ); const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" }); await poller.poll(); return poller; @@ -592,7 +631,7 @@ export class ReservationImpl implements Reservation { /** * Updates the applied scopes of the `Reservation`. * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item + * @param reservationId Id of the reservation item * @param parameters Information needed to patch a reservation item * @param options The options parameters. */ @@ -614,7 +653,7 @@ export class ReservationImpl implements Reservation { /** * Archiving a `Reservation` moves it to `Archived` state. * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item + * @param reservationId Id of the reservation item * @param options The options parameters. */ archive( @@ -629,10 +668,10 @@ export class ReservationImpl implements Reservation { } /** - * Unarchiving a `Reservation` moves it to the state it was before archiving. + * Restores a `Reservation` to the state it was before archiving. * * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item + * @param reservationId Id of the reservation item * @param options The options parameters. */ unarchive( @@ -648,17 +687,17 @@ export class ReservationImpl implements Reservation { /** * List of all the revisions for the `Reservation`. - * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation item * @param options The options parameters. */ private _listRevisions( - reservationId: string, reservationOrderId: string, + reservationId: string, options?: ReservationListRevisionsOptionalParams ): Promise { return this.client.sendOperationRequest( - { reservationId, reservationOrderId, options }, + { reservationOrderId, reservationId, options }, listRevisionsOperationSpec ); } @@ -693,19 +732,19 @@ export class ReservationImpl implements Reservation { /** * ListRevisionsNext - * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation item * @param nextLink The nextLink from the previous successful call to the ListRevisions method. * @param options The options parameters. */ private _listRevisionsNext( - reservationId: string, reservationOrderId: string, + reservationId: string, nextLink: string, options?: ReservationListRevisionsNextOptionalParams ): Promise { return this.client.sendOperationRequest( - { reservationId, reservationOrderId, nextLink, options }, + { reservationOrderId, reservationId, nextLink, options }, listRevisionsNextOperationSpec ); } @@ -1036,7 +1075,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.reservationOrderId, @@ -1056,7 +1094,6 @@ const listRevisionsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.reservationOrderId, @@ -1077,15 +1114,6 @@ const listAllNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.orderby, - Parameters.refreshSummary, - Parameters.skiptoken, - Parameters.selectedState, - Parameters.take - ], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts b/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts index 3cfe090a8399..6d37af0899ac 100644 --- a/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts +++ b/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { ReservationOrder } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,10 +19,10 @@ import { ReservationOrderResponse, ReservationOrderListNextOptionalParams, ReservationOrderListOptionalParams, + ReservationOrderListResponse, PurchaseRequest, ReservationOrderCalculateOptionalParams, ReservationOrderCalculateResponse, - ReservationOrderListResponse, ReservationOrderPurchaseOptionalParams, ReservationOrderPurchaseResponse, ReservationOrderGetOptionalParams, @@ -60,22 +61,34 @@ export class ReservationOrderImpl implements ReservationOrder { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: ReservationOrderListOptionalParams + options?: ReservationOrderListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ReservationOrderListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -319,7 +332,7 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, - queryParameters: [Parameters.apiVersion, Parameters.expand1], + queryParameters: [Parameters.apiVersion, Parameters.expand], urlParameters: [Parameters.$host, Parameters.reservationOrderId], headerParameters: [Parameters.accept], serializer @@ -354,7 +367,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/reservations/arm-reservations/src/operations/return.ts b/sdk/reservations/arm-reservations/src/operations/return.ts index 1a6542d4cf8d..886feee94b08 100644 --- a/sdk/reservations/arm-reservations/src/operations/return.ts +++ b/sdk/reservations/arm-reservations/src/operations/return.ts @@ -11,6 +11,8 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; import { RefundRequest, ReturnPostOptionalParams, @@ -30,20 +32,84 @@ export class ReturnImpl implements Return { } /** - * Return a reservation. + * Return a reservation and get refund information. * @param reservationOrderId Order Id of the reservation * @param body Information needed for returning reservation. * @param options The options parameters. */ - post( + async beginPost( reservationOrderId: string, body: RefundRequest, options?: ReturnPostOptionalParams - ): Promise { - return this.client.sendOperationRequest( + ): Promise< + PollerLike, ReturnPostResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { reservationOrderId, body, options }, postOperationSpec ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Return a reservation and get refund information. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for returning reservation. + * @param options The options parameters. + */ + async beginPostAndWait( + reservationOrderId: string, + body: RefundRequest, + options?: ReturnPostOptionalParams + ): Promise { + const poller = await this.beginPost(reservationOrderId, body, options); + return poller.pollUntilDone(); } } // Operation Specifications @@ -54,10 +120,22 @@ const postOperationSpec: coreClient.OperationSpec = { "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return", httpMethod: "POST", responses: { + 200: { + bodyMapper: Mappers.RefundResponse, + headersMapper: Mappers.ReturnPostHeaders + }, + 201: { + bodyMapper: Mappers.RefundResponse, + headersMapper: Mappers.ReturnPostHeaders + }, 202: { bodyMapper: Mappers.RefundResponse, headersMapper: Mappers.ReturnPostHeaders }, + 204: { + bodyMapper: Mappers.RefundResponse, + headersMapper: Mappers.ReturnPostHeaders + }, default: { bodyMapper: Mappers.ErrorModel } diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts index 36e1875e8c6b..97e0398c9246 100644 --- a/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts @@ -45,13 +45,13 @@ export interface Reservation { ): PagedAsyncIterableIterator; /** * List of all the revisions for the `Reservation`. - * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation item * @param options The options parameters. */ listRevisions( - reservationId: string, reservationOrderId: string, + reservationId: string, options?: ReservationListRevisionsOptionalParams ): PagedAsyncIterableIterator; /** @@ -63,11 +63,11 @@ export interface Reservation { options?: ReservationListAllOptionalParams ): PagedAsyncIterableIterator; /** - * Get Available Scopes for `Reservation`. + * Check whether the scopes from request is valid for `Reservation`. * * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item - * @param body Available scope + * @param reservationId Id of the reservation item + * @param body Scopes to be checked for eligibility. * @param options The options parameters. */ beginAvailableScopes( @@ -82,11 +82,11 @@ export interface Reservation { > >; /** - * Get Available Scopes for `Reservation`. + * Check whether the scopes from request is valid for `Reservation`. * * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item - * @param body Available scope + * @param reservationId Id of the reservation item + * @param body Scopes to be checked for eligibility. * @param options The options parameters. */ beginAvailableScopesAndWait( @@ -153,19 +153,19 @@ export interface Reservation { ): Promise; /** * Get specific `Reservation` details. - * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation item * @param options The options parameters. */ get( - reservationId: string, reservationOrderId: string, + reservationId: string, options?: ReservationGetOptionalParams ): Promise; /** * Updates the applied scopes of the `Reservation`. * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item + * @param reservationId Id of the reservation item * @param parameters Information needed to patch a reservation item * @param options The options parameters. */ @@ -183,7 +183,7 @@ export interface Reservation { /** * Updates the applied scopes of the `Reservation`. * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item + * @param reservationId Id of the reservation item * @param parameters Information needed to patch a reservation item * @param options The options parameters. */ @@ -196,7 +196,7 @@ export interface Reservation { /** * Archiving a `Reservation` moves it to `Archived` state. * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item + * @param reservationId Id of the reservation item * @param options The options parameters. */ archive( @@ -205,10 +205,10 @@ export interface Reservation { options?: ReservationArchiveOptionalParams ): Promise; /** - * Unarchiving a `Reservation` moves it to the state it was before archiving. + * Restores a `Reservation` to the state it was before archiving. * * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item + * @param reservationId Id of the reservation item * @param options The options parameters. */ unarchive( diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/return.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/return.ts index 844229b808ca..dcd884b8c41e 100644 --- a/sdk/reservations/arm-reservations/src/operationsInterfaces/return.ts +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/return.ts @@ -6,6 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +import { PollerLike, PollOperationState } from "@azure/core-lro"; import { RefundRequest, ReturnPostOptionalParams, @@ -15,12 +16,25 @@ import { /** Interface representing a Return. */ export interface Return { /** - * Return a reservation. + * Return a reservation and get refund information. * @param reservationOrderId Order Id of the reservation * @param body Information needed for returning reservation. * @param options The options parameters. */ - post( + beginPost( + reservationOrderId: string, + body: RefundRequest, + options?: ReturnPostOptionalParams + ): Promise< + PollerLike, ReturnPostResponse> + >; + /** + * Return a reservation and get refund information. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for returning reservation. + * @param options The options parameters. + */ + beginPostAndWait( reservationOrderId: string, body: RefundRequest, options?: ReturnPostOptionalParams diff --git a/sdk/reservations/arm-reservations/src/pagingHelper.ts b/sdk/reservations/arm-reservations/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * 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. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +}