From 4bf4d2783a3f8adba43f1cdba6e4cbc6f42186a3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 4 Jan 2022 06:17:43 +0000 Subject: [PATCH] CodeGen from PR 17014 in Azure/azure-rest-api-specs Fixing S360 issues (#17014) * Fixing S360 issues * Fix style --- common/config/rush/pnpm-lock.yaml | 24 + rush.json | 5 + .../arm-reservations/CHANGELOG.md | 11 + .../arm-reservations/{LICENSE.txt => LICENSE} | 4 +- sdk/reservations/arm-reservations/README.md | 141 +- sdk/reservations/arm-reservations/_meta.json | 7 + .../arm-reservations/api-extractor.json | 18 + .../arm-reservations/package.json | 94 +- .../review/arm-reservations.api.md | 1605 +++++++ .../arm-reservations/rollup.config.js | 211 +- .../src/azureReservationAPI.ts | 244 +- .../src/azureReservationAPIContext.ts | 53 - .../{models/operationMappers.ts => index.ts} | 11 +- .../arm-reservations/src/lroImpl.ts | 34 + .../src/models/calculateExchangeMappers.ts | 28 - .../src/models/exchangeMappers.ts | 27 - .../arm-reservations/src/models/index.ts | 3749 ++++++++--------- .../arm-reservations/src/models/mappers.ts | 3003 +++++++------ .../arm-reservations/src/models/parameters.ts | 294 +- .../src/models/quotaMappers.ts | 42 - .../src/models/quotaRequestStatusMappers.ts | 39 - .../src/models/reservationMappers.ts | 47 - .../src/models/reservationOrderMappers.ts | 42 - .../src/operations/calculateExchange.ts | 156 +- .../src/operations/exchange.ts | 153 +- .../arm-reservations/src/operations/index.ts | 3 +- .../src/operations/operation.ts | 160 +- .../arm-reservations/src/operations/quota.ts | 687 +-- .../src/operations/quotaRequestStatus.ts | 320 +- .../src/operations/reservation.ts | 1219 ++++-- .../src/operations/reservationOrder.ts | 443 +- .../operationsInterfaces/calculateExchange.ts | 43 + .../src/operationsInterfaces/exchange.ts | 40 + .../src/operationsInterfaces/index.ts | 15 + .../src/operationsInterfaces/operation.ts | 22 + .../src/operationsInterfaces/quota.ts | 169 + .../quotaRequestStatus.ts | 51 + .../src/operationsInterfaces/reservation.ts | 194 + .../operationsInterfaces/reservationOrder.ts | 93 + .../arm-reservations/test/sampleTest.ts | 48 + .../arm-reservations/tsconfig.json | 6 +- sdk/reservations/ci.yml | 29 + 42 files changed, 8507 insertions(+), 5077 deletions(-) create mode 100644 sdk/reservations/arm-reservations/CHANGELOG.md rename sdk/reservations/arm-reservations/{LICENSE.txt => LICENSE} (96%) create mode 100644 sdk/reservations/arm-reservations/_meta.json create mode 100644 sdk/reservations/arm-reservations/api-extractor.json create mode 100644 sdk/reservations/arm-reservations/review/arm-reservations.api.md delete mode 100644 sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts rename sdk/reservations/arm-reservations/src/{models/operationMappers.ts => index.ts} (57%) create mode 100644 sdk/reservations/arm-reservations/src/lroImpl.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/calculateExchangeMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/exchangeMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/quotaMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/quotaRequestStatusMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/reservationMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/calculateExchange.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/exchange.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/index.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/operation.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/quota.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/quotaRequestStatus.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/reservationOrder.ts create mode 100644 sdk/reservations/arm-reservations/test/sampleTest.ts create mode 100644 sdk/reservations/ci.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 1b256991afbd..8ce45499fe9c 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -63,6 +63,7 @@ specifiers: '@rush-temp/arm-recoveryservices': file:./projects/arm-recoveryservices.tgz '@rush-temp/arm-rediscache': file:./projects/arm-rediscache.tgz '@rush-temp/arm-relay': file:./projects/arm-relay.tgz + '@rush-temp/arm-reservations': file:./projects/arm-reservations.tgz '@rush-temp/arm-resourcehealth': file:./projects/arm-resourcehealth.tgz '@rush-temp/arm-resources': file:./projects/arm-resources.tgz '@rush-temp/arm-resources-subscriptions': file:./projects/arm-resources-subscriptions.tgz @@ -243,6 +244,7 @@ dependencies: '@rush-temp/arm-recoveryservices': file:projects/arm-recoveryservices.tgz '@rush-temp/arm-rediscache': file:projects/arm-rediscache.tgz '@rush-temp/arm-relay': file:projects/arm-relay.tgz + '@rush-temp/arm-reservations': file:projects/arm-reservations.tgz '@rush-temp/arm-resourcehealth': file:projects/arm-resourcehealth.tgz '@rush-temp/arm-resources': file:projects/arm-resources.tgz '@rush-temp/arm-resources-subscriptions': file:projects/arm-resources-subscriptions.tgz @@ -1420,6 +1422,7 @@ packages: /@opentelemetry/node/0.22.0_@opentelemetry+api@1.0.3: resolution: {integrity: sha512-+HhGbDruQ7cwejVOIYyxRa28uosnG8W95NiQZ6qE8PXXPsDSyGeftAPbtYpGit0H2f5hrVcMlwmWHeAo9xkSLA==} engines: {node: '>=8.0.0'} + deprecated: Package renamed to @opentelemetry/sdk-trace-node peerDependencies: '@opentelemetry/api': ^1.0.0 dependencies: @@ -9103,6 +9106,27 @@ packages: uglify-js: 3.14.5 dev: false + file:projects/arm-reservations.tgz: + resolution: {integrity: sha512-J/R4V9py4vRdeRKf2VvEVcZ914mcO98QE1XX8lph8fwNKjc4jwVho5wdLJiU6VPNtz4nbP1Z9SHV3nWYhKQ+yA==, tarball: file:projects/arm-reservations.tgz} + name: '@rush-temp/arm-reservations' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.19.2 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + dev: false + file:projects/arm-resourcehealth.tgz: resolution: {integrity: sha512-2aZ/KsYKwAjiAVYNgPcnIHIZ1zPnIhoqJzsV188fdQ+QJAf5uP3LuyYbqv128SbEqrHQK5XSbAgWNQiAk7DecQ==, tarball: file:projects/arm-resourcehealth.tgz} name: '@rush-temp/arm-resourcehealth' diff --git a/rush.json b/rush.json index 19f6356fec02..0975a73de38d 100644 --- a/rush.json +++ b/rush.json @@ -1210,6 +1210,11 @@ "packageName": "@azure/arm-billing", "projectFolder": "sdk/billing/arm-billing", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-reservations", + "projectFolder": "sdk/reservations/arm-reservations", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/CHANGELOG.md b/sdk/reservations/arm-reservations/CHANGELOG.md new file mode 100644 index 000000000000..723fcb69ec6c --- /dev/null +++ b/sdk/reservations/arm-reservations/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 7.0.0 (2022-01-04) + +The package of @azure/arm-reservations is using our next generation design principles since version 7.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/reservations/arm-reservations/LICENSE.txt b/sdk/reservations/arm-reservations/LICENSE similarity index 96% rename from sdk/reservations/arm-reservations/LICENSE.txt rename to sdk/reservations/arm-reservations/LICENSE index 2d3163745319..5d1d36e0af80 100644 --- a/sdk/reservations/arm-reservations/LICENSE.txt +++ b/sdk/reservations/arm-reservations/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +Copyright (c) 2022 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/README.md b/sdk/reservations/arm-reservations/README.md index 16ddbfe2b48d..d93dec6fc892 100644 --- a/sdk/reservations/arm-reservations/README.md +++ b/sdk/reservations/arm-reservations/README.md @@ -1,103 +1,98 @@ -## Azure AzureReservationAPI SDK for JavaScript +# Azure Service client library for JavaScript -This package contains an isomorphic SDK for AzureReservationAPI. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client. + +This API describe Azure Reservation + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-reservations) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-reservations) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-reservations` package -### How to Install +Install the Azure Service client library for JavaScript with `npm`: ```bash npm install @azure/arm-reservations ``` -### How to use +### Create and authenticate a `AzureReservationAPI` -#### nodejs - Authentication, client creation and get quota as an example written in TypeScript. +To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. ```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript const { AzureReservationAPI } = require("@azure/arm-reservations"); -const { interactiveLogin } = require("@azure/ms-rest-nodeauth"); - -interactiveLogin().then((creds) => { - const client = new AzureReservationAPI(creds); - const subscriptionId = "testsubscriptionId"; - const providerId = "testproviderId"; - const location = "westus"; - const resourceName = "testresourceName"; - client.quota.get(subscriptionId, providerId, location, resourceName).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new AzureReservationAPI(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and get quota as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). -```bash -npm install @azure/ms-rest-browserauth -``` +## Key concepts + +### AzureReservationAPI -##### Sample code - -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-reservations sample - - - - - - - - +`AzureReservationAPI` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); ``` +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Freservations%2Farm-reservations%2FREADME.png) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/reservations/arm-reservations/README.png) +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/reservations/arm-reservations/_meta.json b/sdk/reservations/arm-reservations/_meta.json new file mode 100644 index 000000000000..9bf287ef408c --- /dev/null +++ b/sdk/reservations/arm-reservations/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "322d0edbc46e10b04a56f3279cecaa8fe4d3b69b", + "readme": "specification/reservations/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/reservations/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" +} \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/api-extractor.json b/sdk/reservations/arm-reservations/api-extractor.json new file mode 100644 index 000000000000..4e853dfd7c0e --- /dev/null +++ b/sdk/reservations/arm-reservations/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-reservations.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/reservations/arm-reservations/package.json b/sdk/reservations/arm-reservations/package.json index 3ed3ffb6d440..a03fce207bf0 100644 --- a/sdk/reservations/arm-reservations/package.json +++ b/sdk/reservations/arm-reservations/package.json @@ -1,57 +1,91 @@ { "name": "@azure/arm-reservations", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "AzureReservationAPI Library with typescript type definitions for node.js and browser.", - "version": "6.0.0", + "description": "A generated SDK for AzureReservationAPI.", + "version": "7.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-reservations.js", - "module": "./esm/azureReservationAPI.js", - "types": "./esm/azureReservationAPI.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-reservations.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-reservations.js.map'\" -o ./dist/arm-reservations.min.js ./dist/arm-reservations.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, "autoPublish": true diff --git a/sdk/reservations/arm-reservations/review/arm-reservations.api.md b/sdk/reservations/arm-reservations/review/arm-reservations.api.md new file mode 100644 index 000000000000..4e74f67b6a0a --- /dev/null +++ b/sdk/reservations/arm-reservations/review/arm-reservations.api.md @@ -0,0 +1,1605 @@ +## API Report File for "@azure/arm-reservations" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public (undocumented) +export interface AppliedReservationList { + nextLink?: string; + // (undocumented) + value?: string[]; +} + +// @public (undocumented) +export interface AppliedReservations { + readonly id?: string; + readonly name?: string; + // (undocumented) + reservationOrderIds?: AppliedReservationList; + readonly type?: string; +} + +// @public +export type AppliedScopeType = string; + +// @public (undocumented) +export interface AvailableScopeProperties { + // (undocumented) + properties?: SubscriptionScopeProperties; +} + +// @public +export interface AvailableScopeRequest { + properties?: AvailableScopeRequestProperties; +} + +// @public +export interface AvailableScopeRequestProperties { + // (undocumented) + scopes?: string[]; +} + +// @public (undocumented) +export class AzureReservationAPI extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, options?: AzureReservationAPIOptionalParams); + // (undocumented) + calculateExchange: CalculateExchange; + // (undocumented) + exchange: Exchange; + getAppliedReservationList(subscriptionId: string, options?: GetAppliedReservationListOptionalParams): Promise; + getCatalog(subscriptionId: string, options?: GetCatalogOptionalParams): Promise; + // (undocumented) + operation: Operation; + // (undocumented) + quota: Quota; + // (undocumented) + quotaRequestStatus: QuotaRequestStatus; + // (undocumented) + reservation: Reservation; + // (undocumented) + reservationOrder: ReservationOrder; +} + +// @public +export interface AzureReservationAPIOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + endpoint?: string; +} + +// @public +export interface BillingInformation { + // (undocumented) + billingCurrencyProratedAmount?: Price; + // (undocumented) + billingCurrencyRemainingCommitmentAmount?: Price; + // (undocumented) + billingCurrencyTotalPaidAmount?: Price; +} + +// @public +export interface CalculateExchange { + beginPost(body: CalculateExchangeRequest, options?: CalculateExchangePostOptionalParams): Promise, CalculateExchangePostResponse>>; + beginPostAndWait(body: CalculateExchangeRequest, options?: CalculateExchangePostOptionalParams): Promise; +} + +// @public +export interface CalculateExchangeOperationResultResponse { + error?: OperationResultError; + id?: string; + name?: string; + properties?: CalculateExchangeResponseProperties; + status?: CalculateExchangeOperationResultStatus; +} + +// @public +export type CalculateExchangeOperationResultStatus = string; + +// @public +export interface CalculateExchangePostHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface CalculateExchangePostOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CalculateExchangePostResponse = CalculateExchangeOperationResultResponse; + +// @public +export interface CalculateExchangeRequest { + properties?: CalculateExchangeRequestProperties; +} + +// @public +export interface CalculateExchangeRequestProperties { + reservationsToExchange?: ReservationToReturn[]; + reservationsToPurchase?: PurchaseRequest[]; +} + +// @public +export interface CalculateExchangeResponseProperties { + // (undocumented) + netPayable?: Price; + policyResult?: ExchangePolicyErrors; + // (undocumented) + purchasesTotal?: Price; + // (undocumented) + refundsTotal?: Price; + reservationsToExchange?: ReservationToExchange[]; + reservationsToPurchase?: ReservationToPurchaseCalculateExchange[]; + sessionId?: string; +} + +// @public (undocumented) +export interface CalculatePriceResponse { + // (undocumented) + properties?: CalculatePriceResponseProperties; +} + +// @public (undocumented) +export interface CalculatePriceResponseProperties { + billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; + grandTotal?: number; + isBillingPartnerManaged?: boolean; + isTaxIncluded?: boolean; + netTotal?: number; + // (undocumented) + paymentSchedule?: PaymentDetail[]; + pricingCurrencyTotal?: CalculatePriceResponsePropertiesPricingCurrencyTotal; + reservationOrderId?: string; + skuDescription?: string; + skuTitle?: string; + taxTotal?: number; +} + +// @public +export interface CalculatePriceResponsePropertiesBillingCurrencyTotal { + amount?: number; + currencyCode?: string; +} + +// @public +export interface CalculatePriceResponsePropertiesPricingCurrencyTotal { + // (undocumented) + amount?: number; + currencyCode?: string; +} + +// @public (undocumented) +export interface Catalog { + billingPlans?: { + [propertyName: string]: ReservationBillingPlan[]; + }; + readonly capabilities?: SkuCapability[]; + readonly locations?: string[]; + readonly msrp?: CatalogMsrp; + readonly name?: string; + readonly resourceType?: string; + readonly restrictions?: SkuRestriction[]; + readonly size?: string; + readonly skuProperties?: SkuProperty[]; + readonly terms?: ReservationTerm[]; + readonly tier?: string; +} + +// @public +export interface CatalogMsrp { + p1Y?: Price; +} + +// @public (undocumented) +export interface ChangeDirectoryRequest { + destinationTenantId?: string; +} + +// @public +export interface ChangeDirectoryResponse { + reservationOrder?: ChangeDirectoryResult; + // (undocumented) + reservations?: ChangeDirectoryResult[]; +} + +// @public +export interface ChangeDirectoryResult { + error?: string; + id?: string; + isSucceeded?: boolean; + name?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface CreateGenericQuotaRequestParameters { + value?: CurrentQuotaLimitBase[]; +} + +// @public +export interface CurrentQuotaLimit { + readonly message?: string; + properties?: QuotaProperties; + readonly provisioningState?: QuotaRequestState; +} + +// @public +export interface CurrentQuotaLimitBase { + properties?: QuotaProperties; +} + +// @public +export type DisplayProvisioningState = string; + +// @public +export interface ErrorDetails { + readonly code?: string; + readonly message?: string; + readonly target?: string; +} + +// @public (undocumented) +export interface ErrorModel { + // (undocumented) + error?: ExtendedErrorInfo; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetails; +} + +// @public +export type ErrorResponseCode = string; + +// @public +export interface ExceptionResponse { + error?: ServiceError; +} + +// @public +export interface Exchange { + beginPost(body: ExchangeRequest, options?: ExchangePostOptionalParams): Promise, ExchangePostResponse>>; + beginPostAndWait(body: ExchangeRequest, options?: ExchangePostOptionalParams): Promise; +} + +// @public +export interface ExchangeOperationResultResponse { + error?: OperationResultError; + id?: string; + name?: string; + properties?: ExchangeResponseProperties; + status?: ExchangeOperationResultStatus; +} + +// @public +export type ExchangeOperationResultStatus = string; + +// @public +export interface ExchangePolicyError { + // (undocumented) + code?: string; + // (undocumented) + message?: string; +} + +// @public +export interface ExchangePolicyErrors { + policyErrors?: ExchangePolicyError[]; +} + +// @public +export interface ExchangePostHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface ExchangePostOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ExchangePostResponse = ExchangeOperationResultResponse; + +// @public +export interface ExchangeRequest { + properties?: ExchangeRequestProperties; +} + +// @public +export interface ExchangeRequestProperties { + sessionId?: string; +} + +// @public +export interface ExchangeResponseProperties { + // (undocumented) + netPayable?: Price; + policyResult?: ExchangePolicyErrors; + // (undocumented) + purchasesTotal?: Price; + // (undocumented) + refundsTotal?: Price; + reservationsToExchange?: ReservationToReturnForExchange[]; + reservationsToPurchase?: ReservationToPurchaseExchange[]; + sessionId?: string; +} + +// @public (undocumented) +export interface ExtendedErrorInfo { + // (undocumented) + code?: ErrorResponseCode; + // (undocumented) + message?: string; +} + +// @public (undocumented) +export interface ExtendedStatusInfo { + message?: string; + // (undocumented) + statusCode?: ReservationStatusCode; +} + +// @public +export interface GetAppliedReservationListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GetAppliedReservationListResponse = AppliedReservations; + +// @public +export interface GetCatalogOptionalParams extends coreClient.OperationOptions { + location?: string; + reservedResourceType?: string; +} + +// @public +export type GetCatalogResponse = Catalog[]; + +// @public +export type InstanceFlexibility = string; + +// @public +export enum KnownAppliedScopeType { + // (undocumented) + Shared = "Shared", + // (undocumented) + Single = "Single" +} + +// @public +export enum KnownCalculateExchangeOperationResultStatus { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Pending = "Pending", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownDisplayProvisioningState { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Expired = "Expired", + // (undocumented) + Expiring = "Expiring", + // (undocumented) + Failed = "Failed", + // (undocumented) + Pending = "Pending", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownErrorResponseCode { + // (undocumented) + ActivateQuoteFailed = "ActivateQuoteFailed", + // (undocumented) + AppliedScopesNotAssociatedWithCommerceAccount = "AppliedScopesNotAssociatedWithCommerceAccount", + // (undocumented) + AppliedScopesSameAsExisting = "AppliedScopesSameAsExisting", + // (undocumented) + AuthorizationFailed = "AuthorizationFailed", + // (undocumented) + BadRequest = "BadRequest", + // (undocumented) + BillingCustomerInputError = "BillingCustomerInputError", + // (undocumented) + BillingError = "BillingError", + // (undocumented) + BillingPaymentInstrumentHardError = "BillingPaymentInstrumentHardError", + // (undocumented) + BillingPaymentInstrumentSoftError = "BillingPaymentInstrumentSoftError", + // (undocumented) + BillingScopeIdCannotBeChanged = "BillingScopeIdCannotBeChanged", + // (undocumented) + BillingTransientError = "BillingTransientError", + // (undocumented) + CalculatePriceFailed = "CalculatePriceFailed", + // (undocumented) + CapacityUpdateScopesFailed = "CapacityUpdateScopesFailed", + // (undocumented) + ClientCertificateThumbprintNotSet = "ClientCertificateThumbprintNotSet", + // (undocumented) + CreateQuoteFailed = "CreateQuoteFailed", + // (undocumented) + Forbidden = "Forbidden", + // (undocumented) + FulfillmentConfigurationError = "FulfillmentConfigurationError", + // (undocumented) + FulfillmentError = "FulfillmentError", + // (undocumented) + FulfillmentOutOfStockError = "FulfillmentOutOfStockError", + // (undocumented) + FulfillmentTransientError = "FulfillmentTransientError", + // (undocumented) + HttpMethodNotSupported = "HttpMethodNotSupported", + // (undocumented) + InternalServerError = "InternalServerError", + // (undocumented) + InvalidAccessToken = "InvalidAccessToken", + // (undocumented) + InvalidFulfillmentRequestParameters = "InvalidFulfillmentRequestParameters", + // (undocumented) + InvalidHealthCheckType = "InvalidHealthCheckType", + // (undocumented) + InvalidLocationId = "InvalidLocationId", + // (undocumented) + InvalidRefundQuantity = "InvalidRefundQuantity", + // (undocumented) + InvalidRequestContent = "InvalidRequestContent", + // (undocumented) + InvalidRequestUri = "InvalidRequestUri", + // (undocumented) + InvalidReservationId = "InvalidReservationId", + // (undocumented) + InvalidReservationOrderId = "InvalidReservationOrderId", + // (undocumented) + InvalidSingleAppliedScopesCount = "InvalidSingleAppliedScopesCount", + // (undocumented) + InvalidSubscriptionId = "InvalidSubscriptionId", + // (undocumented) + InvalidTenantId = "InvalidTenantId", + // (undocumented) + MissingAppliedScopesForSingle = "MissingAppliedScopesForSingle", + // (undocumented) + MissingTenantId = "MissingTenantId", + // (undocumented) + NonsupportedAccountId = "NonsupportedAccountId", + // (undocumented) + NotSpecified = "NotSpecified", + // (undocumented) + NotSupportedCountry = "NotSupportedCountry", + // (undocumented) + NoValidReservationsToReRate = "NoValidReservationsToReRate", + // (undocumented) + OperationCannotBePerformedInCurrentState = "OperationCannotBePerformedInCurrentState", + // (undocumented) + OperationFailed = "OperationFailed", + // (undocumented) + PatchValuesSameAsExisting = "PatchValuesSameAsExisting", + // (undocumented) + PaymentInstrumentNotFound = "PaymentInstrumentNotFound", + // (undocumented) + PurchaseError = "PurchaseError", + // (undocumented) + ReRateOnlyAllowedForEA = "ReRateOnlyAllowedForEA", + // (undocumented) + ReservationIdNotInReservationOrder = "ReservationIdNotInReservationOrder", + // (undocumented) + ReservationOrderCreationFailed = "ReservationOrderCreationFailed", + // (undocumented) + ReservationOrderIdAlreadyExists = "ReservationOrderIdAlreadyExists", + // (undocumented) + ReservationOrderNotEnabled = "ReservationOrderNotEnabled", + // (undocumented) + ReservationOrderNotFound = "ReservationOrderNotFound", + // (undocumented) + RiskCheckFailed = "RiskCheckFailed", + // (undocumented) + RoleAssignmentCreationFailed = "RoleAssignmentCreationFailed", + // (undocumented) + ServerTimeout = "ServerTimeout", + // (undocumented) + UnauthenticatedRequestsThrottled = "UnauthenticatedRequestsThrottled", + // (undocumented) + UnsupportedReservationTerm = "UnsupportedReservationTerm" +} + +// @public +export enum KnownExchangeOperationResultStatus { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + PendingPurchases = "PendingPurchases", + // (undocumented) + PendingRefunds = "PendingRefunds", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownInstanceFlexibility { + // (undocumented) + Off = "Off", + // (undocumented) + On = "On" +} + +// @public +export enum KnownLocation { + // (undocumented) + Australiaeast = "australiaeast", + // (undocumented) + Australiasoutheast = "australiasoutheast", + // (undocumented) + Brazilsouth = "brazilsouth", + // (undocumented) + Canadacentral = "canadacentral", + // (undocumented) + Canadaeast = "canadaeast", + // (undocumented) + Centralindia = "centralindia", + // (undocumented) + Centralus = "centralus", + // (undocumented) + Eastasia = "eastasia", + // (undocumented) + Eastus = "eastus", + // (undocumented) + Eastus2 = "eastus2", + // (undocumented) + Japaneast = "japaneast", + // (undocumented) + Japanwest = "japanwest", + // (undocumented) + Northcentralus = "northcentralus", + // (undocumented) + Northeurope = "northeurope", + // (undocumented) + Southcentralus = "southcentralus", + // (undocumented) + Southeastasia = "southeastasia", + // (undocumented) + Southindia = "southindia", + // (undocumented) + Uksouth = "uksouth", + // (undocumented) + Ukwest = "ukwest", + // (undocumented) + Westcentralus = "westcentralus", + // (undocumented) + Westeurope = "westeurope", + // (undocumented) + Westindia = "westindia", + // (undocumented) + Westus = "westus", + // (undocumented) + Westus2 = "westus2" +} + +// @public +export enum KnownOperationStatus { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Pending = "Pending", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownPaymentStatus { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Scheduled = "Scheduled", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + BillingFailed = "BillingFailed", + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + ConfirmedBilling = "ConfirmedBilling", + // (undocumented) + ConfirmedResourceHold = "ConfirmedResourceHold", + // (undocumented) + Created = "Created", + // (undocumented) + Creating = "Creating", + // (undocumented) + Expired = "Expired", + // (undocumented) + Failed = "Failed", + // (undocumented) + Merged = "Merged", + // (undocumented) + PendingBilling = "PendingBilling", + // (undocumented) + PendingResourceHold = "PendingResourceHold", + // (undocumented) + Split = "Split", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownQuotaRequestState { + // (undocumented) + Accepted = "Accepted", + // (undocumented) + Failed = "Failed", + // (undocumented) + InProgress = "InProgress", + // (undocumented) + Invalid = "Invalid", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownReservationBillingPlan { + // (undocumented) + Monthly = "Monthly", + // (undocumented) + Upfront = "Upfront" +} + +// @public +export enum KnownReservationStatusCode { + // (undocumented) + Active = "Active", + // (undocumented) + Expired = "Expired", + // (undocumented) + Merged = "Merged", + // (undocumented) + None = "None", + // (undocumented) + PaymentInstrumentError = "PaymentInstrumentError", + // (undocumented) + Pending = "Pending", + // (undocumented) + PurchaseError = "PurchaseError", + // (undocumented) + Split = "Split", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownReservationTerm { + // (undocumented) + P1Y = "P1Y", + // (undocumented) + P3Y = "P3Y", + // (undocumented) + P5Y = "P5Y" +} + +// @public +export enum KnownReservedResourceType { + // (undocumented) + AppService = "AppService", + // (undocumented) + AVS = "AVS", + // (undocumented) + AzureDataExplorer = "AzureDataExplorer", + // (undocumented) + AzureFiles = "AzureFiles", + // (undocumented) + BlockBlob = "BlockBlob", + // (undocumented) + CosmosDb = "CosmosDb", + // (undocumented) + Databricks = "Databricks", + // (undocumented) + DataFactory = "DataFactory", + // (undocumented) + DedicatedHost = "DedicatedHost", + // (undocumented) + ManagedDisk = "ManagedDisk", + // (undocumented) + MariaDb = "MariaDb", + // (undocumented) + MySql = "MySql", + // (undocumented) + NetAppStorage = "NetAppStorage", + // (undocumented) + PostgreSql = "PostgreSql", + // (undocumented) + RedHat = "RedHat", + // (undocumented) + RedHatOsa = "RedHatOsa", + // (undocumented) + RedisCache = "RedisCache", + // (undocumented) + SapHana = "SapHana", + // (undocumented) + SqlAzureHybridBenefit = "SqlAzureHybridBenefit", + // (undocumented) + SqlDatabases = "SqlDatabases", + // (undocumented) + SqlDataWarehouse = "SqlDataWarehouse", + // (undocumented) + SqlEdge = "SqlEdge", + // (undocumented) + SuseLinux = "SuseLinux", + // (undocumented) + VirtualMachines = "VirtualMachines", + // (undocumented) + VMwareCloudSimple = "VMwareCloudSimple" +} + +// @public +export enum KnownResourceType { + // (undocumented) + Dedicated = "dedicated", + // (undocumented) + LowPriority = "lowPriority", + // (undocumented) + ServiceSpecific = "serviceSpecific", + // (undocumented) + Shared = "shared", + // (undocumented) + Standard = "standard" +} + +// @public +export enum KnownUserFriendlyAppliedScopeType { + // (undocumented) + ManagementGroup = "ManagementGroup", + // (undocumented) + None = "None", + // (undocumented) + ResourceGroup = "ResourceGroup", + // (undocumented) + Shared = "Shared", + // (undocumented) + Single = "Single" +} + +// @public +export enum KnownUserFriendlyRenewState { + // (undocumented) + NotApplicable = "NotApplicable", + // (undocumented) + NotRenewed = "NotRenewed", + // (undocumented) + Off = "Off", + // (undocumented) + On = "On", + // (undocumented) + Renewed = "Renewed" +} + +// @public +type Location_2 = string; +export { Location_2 as Location } + +// @public (undocumented) +export interface MergeRequest { + sources?: string[]; +} + +// @public +export interface Operation { + list(options?: OperationListOptionalParams): PagedAsyncIterableIterator; +} + +// @public (undocumented) +export interface OperationDisplay { + // (undocumented) + description?: string; + // (undocumented) + operation?: string; + // (undocumented) + provider?: string; + // (undocumented) + resource?: string; +} + +// @public (undocumented) +export interface OperationList { + nextLink?: string; + // (undocumented) + value?: OperationResponse[]; +} + +// @public +export interface OperationListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationListNextResponse = OperationList; + +// @public +export interface OperationListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationListResponse = OperationList; + +// @public (undocumented) +export interface OperationResponse { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; + properties?: Record; +} + +// @public +export interface OperationResultError { + code?: string; + message?: string; +} + +// @public +export type OperationStatus = string; + +// @public (undocumented) +export interface Patch { + appliedScopes?: string[]; + appliedScopeType?: AppliedScopeType; + instanceFlexibility?: InstanceFlexibility; + name?: string; + renew?: boolean; + // (undocumented) + renewProperties?: PatchPropertiesRenewProperties; +} + +// @public (undocumented) +export interface PatchPropertiesRenewProperties { + // (undocumented) + purchaseProperties?: PurchaseRequest; +} + +// @public +export interface PaymentDetail { + billingAccount?: string; + billingCurrencyTotal?: Price; + dueDate?: Date; + // (undocumented) + extendedStatusInfo?: ExtendedStatusInfo; + paymentDate?: Date; + pricingCurrencyTotal?: Price; + status?: PaymentStatus; +} + +// @public +export type PaymentStatus = string; + +// @public (undocumented) +export interface Price { + // (undocumented) + amount?: number; + currencyCode?: string; +} + +// @public +export type ProvisioningState = string; + +// @public (undocumented) +export interface PurchaseRequest { + appliedScopes?: string[]; + appliedScopeType?: AppliedScopeType; + billingPlan?: ReservationBillingPlan; + billingScopeId?: string; + displayName?: string; + location?: string; + quantity?: number; + renew?: boolean; + reservedResourceProperties?: PurchaseRequestPropertiesReservedResourceProperties; + reservedResourceType?: ReservedResourceType; + // (undocumented) + sku?: SkuName; + term?: ReservationTerm; +} + +// @public +export interface PurchaseRequestPropertiesReservedResourceProperties { + instanceFlexibility?: InstanceFlexibility; +} + +// @public +export interface Quota { + beginCreateOrUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise, QuotaCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise; + beginUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise, QuotaUpdateResponse>>; + beginUpdateAndWait(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise; + get(subscriptionId: string, providerId: string, location: string, resourceName: string, options?: QuotaGetOptionalParams): Promise; + list(subscriptionId: string, providerId: string, location: string, options?: QuotaListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface QuotaCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type QuotaCreateOrUpdateResponse = QuotaRequestOneResourceSubmitResponse; + +// @public +export interface QuotaGetHeaders { + eTag?: string; +} + +// @public +export interface QuotaGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type QuotaGetResponse = QuotaGetHeaders & CurrentQuotaLimitBase; + +// @public +export interface QuotaLimits { + nextLink?: string; + value?: CurrentQuotaLimitBase[]; +} + +// @public +export interface QuotaLimitsResponse { + nextLink?: string; + value?: CurrentQuotaLimit[]; +} + +// @public +export interface QuotaListHeaders { + eTag?: string; +} + +// @public +export interface QuotaListNextHeaders { + eTag?: string; +} + +// @public +export interface QuotaListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type QuotaListNextResponse = QuotaListNextHeaders & QuotaLimits; + +// @public +export interface QuotaListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type QuotaListResponse = QuotaListHeaders & QuotaLimits; + +// @public +export interface QuotaProperties { + readonly currentValue?: number; + limit?: number; + name?: ResourceName; + properties?: Record; + readonly quotaPeriod?: string; + resourceType?: ResourceType; + unit?: string; +} + +// @public +export interface QuotaRequestDetails { + readonly id?: string; + readonly message?: string; + readonly name?: string; + provisioningState?: QuotaRequestState; + readonly requestSubmitTime?: Date; + readonly type?: string; + value?: SubRequest[]; +} + +// @public +export interface QuotaRequestDetailsList { + nextLink?: string; + value?: QuotaRequestDetails[]; +} + +// @public +export interface QuotaRequestOneResourceSubmitResponse { + readonly id?: string; + readonly message?: string; + readonly name?: string; + properties?: QuotaProperties; + readonly provisioningState?: QuotaRequestState; + readonly requestSubmitTime?: Date; + readonly type?: string; +} + +// @public +export interface QuotaRequestProperties { + readonly message?: string; + provisioningState?: QuotaRequestState; + readonly requestSubmitTime?: Date; + value?: SubRequest[]; +} + +// @public +export type QuotaRequestState = string; + +// @public +export interface QuotaRequestStatus { + get(subscriptionId: string, providerId: string, location: string, id: string, options?: QuotaRequestStatusGetOptionalParams): Promise; + list(subscriptionId: string, providerId: string, location: string, options?: QuotaRequestStatusListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface QuotaRequestStatusGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type QuotaRequestStatusGetResponse = QuotaRequestDetails; + +// @public +export interface QuotaRequestStatusListNextOptionalParams extends coreClient.OperationOptions { + filter?: string; + skiptoken?: string; + top?: number; +} + +// @public +export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList; + +// @public +export interface QuotaRequestStatusListOptionalParams extends coreClient.OperationOptions { + filter?: string; + skiptoken?: string; + top?: number; +} + +// @public +export type QuotaRequestStatusListResponse = QuotaRequestDetailsList; + +// @public +export interface QuotaRequestSubmitResponse { + readonly id?: string; + readonly name?: string; + properties?: QuotaRequestProperties; + readonly type?: string; +} + +// @public +export interface QuotaRequestSubmitResponse201 { + readonly id?: string; + readonly message?: string; + readonly name?: string; + readonly provisioningState?: QuotaRequestState; + readonly type?: string; +} + +// @public +export interface QuotaUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type QuotaUpdateResponse = QuotaRequestOneResourceSubmitResponse; + +// @public (undocumented) +export interface RenewPropertiesResponse { + billingCurrencyTotal?: RenewPropertiesResponseBillingCurrencyTotal; + pricingCurrencyTotal?: RenewPropertiesResponsePricingCurrencyTotal; + // (undocumented) + purchaseProperties?: PurchaseRequest; +} + +// @public +export interface RenewPropertiesResponseBillingCurrencyTotal { + // (undocumented) + amount?: number; + currencyCode?: string; +} + +// @public +export interface RenewPropertiesResponsePricingCurrencyTotal { + // (undocumented) + amount?: number; + currencyCode?: string; +} + +// @public +export interface Reservation { + beginAvailableScopes(reservationOrderId: string, reservationId: string, body: AvailableScopeRequest, options?: ReservationAvailableScopesOptionalParams): Promise, ReservationAvailableScopesResponse>>; + beginAvailableScopesAndWait(reservationOrderId: string, reservationId: string, body: AvailableScopeRequest, options?: ReservationAvailableScopesOptionalParams): Promise; + beginMerge(reservationOrderId: string, body: MergeRequest, options?: ReservationMergeOptionalParams): Promise, ReservationMergeResponse>>; + beginMergeAndWait(reservationOrderId: string, body: MergeRequest, options?: ReservationMergeOptionalParams): Promise; + beginSplit(reservationOrderId: string, body: SplitRequest, options?: ReservationSplitOptionalParams): Promise, ReservationSplitResponse>>; + 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; + list(reservationOrderId: string, options?: ReservationListOptionalParams): PagedAsyncIterableIterator; + listAll(options?: ReservationListAllOptionalParams): PagedAsyncIterableIterator; + listRevisions(reservationId: string, reservationOrderId: string, options?: ReservationListRevisionsOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ReservationAvailableScopesOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ReservationAvailableScopesResponse = AvailableScopeProperties; + +// @public +export type ReservationBillingPlan = string; + +// @public +export interface ReservationGetOptionalParams extends coreClient.OperationOptions { + expand?: string; +} + +// @public +export type ReservationGetResponse = ReservationResponse; + +// @public (undocumented) +export interface ReservationList { + nextLink?: string; + // (undocumented) + value?: ReservationResponse[]; +} + +// @public +export interface ReservationListAllNextOptionalParams extends coreClient.OperationOptions { + filter?: string; + orderby?: string; + refreshSummary?: string; + selectedState?: string; + skiptoken?: number; + take?: number; +} + +// @public +export type ReservationListAllNextResponse = ReservationsListResult; + +// @public +export interface ReservationListAllOptionalParams extends coreClient.OperationOptions { + filter?: string; + orderby?: string; + refreshSummary?: string; + selectedState?: string; + skiptoken?: number; + take?: number; +} + +// @public +export type ReservationListAllResponse = ReservationsListResult; + +// @public +export interface ReservationListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationListNextResponse = ReservationList; + +// @public +export interface ReservationListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationListResponse = ReservationList; + +// @public +export interface ReservationListRevisionsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationListRevisionsNextResponse = ReservationList; + +// @public +export interface ReservationListRevisionsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationListRevisionsResponse = ReservationList; + +// @public +export interface ReservationMergeOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface ReservationMergeProperties { + mergeDestination?: string; + mergeSources?: string[]; +} + +// @public +export type ReservationMergeResponse = ReservationResponse[]; + +// @public +export interface ReservationOrder { + beginPurchase(reservationOrderId: string, body: PurchaseRequest, options?: ReservationOrderPurchaseOptionalParams): Promise, ReservationOrderPurchaseResponse>>; + beginPurchaseAndWait(reservationOrderId: string, body: PurchaseRequest, options?: ReservationOrderPurchaseOptionalParams): Promise; + calculate(body: PurchaseRequest, options?: ReservationOrderCalculateOptionalParams): Promise; + changeDirectory(reservationOrderId: string, body: ChangeDirectoryRequest, options?: ReservationOrderChangeDirectoryOptionalParams): Promise; + get(reservationOrderId: string, options?: ReservationOrderGetOptionalParams): Promise; + list(options?: ReservationOrderListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ReservationOrderBillingPlanInformation { + nextPaymentDueDate?: Date; + pricingCurrencyTotal?: Price; + startDate?: Date; + // (undocumented) + transactions?: PaymentDetail[]; +} + +// @public +export interface ReservationOrderCalculateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderCalculateResponse = CalculatePriceResponse; + +// @public +export interface ReservationOrderChangeDirectoryOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderChangeDirectoryResponse = ChangeDirectoryResponse; + +// @public +export interface ReservationOrderGetOptionalParams extends coreClient.OperationOptions { + expand?: string; +} + +// @public +export type ReservationOrderGetResponse = ReservationOrderResponse; + +// @public (undocumented) +export interface ReservationOrderList { + nextLink?: string; + // (undocumented) + value?: ReservationOrderResponse[]; +} + +// @public +export interface ReservationOrderListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderListNextResponse = ReservationOrderList; + +// @public +export interface ReservationOrderListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderListResponse = ReservationOrderList; + +// @public +export interface ReservationOrderPurchaseOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ReservationOrderPurchaseResponse = ReservationOrderResponse; + +// @public (undocumented) +export interface ReservationOrderResponse { + billingPlan?: ReservationBillingPlan; + createdDateTime?: Date; + displayName?: string; + // (undocumented) + etag?: number; + expiryDate?: Date; + readonly id?: string; + readonly name?: string; + originalQuantity?: number; + planInformation?: ReservationOrderBillingPlanInformation; + provisioningState?: ProvisioningState; + requestDateTime?: Date; + // (undocumented) + reservations?: ReservationResponse[]; + readonly systemData?: SystemData; + term?: ReservationTerm; + readonly type?: string; +} + +// @public +export interface ReservationResponse { + // (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 +export interface ReservationsListResult { + readonly nextLink?: string; + summary?: ReservationSummary; + readonly value?: ReservationResponse[]; +} + +// @public +export interface ReservationSplitOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface ReservationSplitProperties { + splitDestinations?: string[]; + splitSource?: string; +} + +// @public +export type ReservationSplitResponse = ReservationResponse[]; + +// @public +export interface ReservationsProperties { + appliedScopes?: string[]; + appliedScopeType?: AppliedScopeType; + archived?: boolean; + billingPlan?: ReservationBillingPlan; + billingScopeId?: string; + capabilities?: string; + displayName?: string; + readonly displayProvisioningState?: string; + effectiveDateTime?: Date; + expiryDate?: Date; + extendedStatusInfo?: ExtendedStatusInfo; + instanceFlexibility?: InstanceFlexibility; + readonly lastUpdatedDateTime?: Date; + // (undocumented) + mergeProperties?: ReservationMergeProperties; + provisioningState?: ProvisioningState; + readonly provisioningSubState?: string; + purchaseDate?: Date; + quantity?: number; + renew?: boolean; + renewDestination?: string; + // (undocumented) + renewProperties?: RenewPropertiesResponse; + renewSource?: string; + reservedResourceType?: ReservedResourceType; + skuDescription?: string; + // (undocumented) + splitProperties?: ReservationSplitProperties; + term?: ReservationTerm; + readonly userFriendlyAppliedScopeType?: string; + readonly userFriendlyRenewState?: string; + readonly utilization?: ReservationsPropertiesUtilization; +} + +// @public +export interface ReservationsPropertiesUtilization { + aggregates?: ReservationUtilizationAggregates[]; + readonly trend?: string; +} + +// @public +export type ReservationStatusCode = string; + +// @public +export interface ReservationSummary { + readonly cancelledCount?: number; + readonly expiredCount?: number; + readonly expiringCount?: number; + readonly failedCount?: number; + readonly pendingCount?: number; + readonly succeededCount?: number; +} + +// @public +export type ReservationTerm = string; + +// @public +export interface ReservationToExchange { + billingInformation?: BillingInformation; + // (undocumented) + billingRefundAmount?: Price; + quantity?: number; + reservationId?: string; +} + +// @public +export interface ReservationToPurchaseCalculateExchange { + // (undocumented) + billingCurrencyTotal?: Price; + // (undocumented) + properties?: PurchaseRequest; +} + +// @public +export interface ReservationToPurchaseExchange { + // (undocumented) + billingCurrencyTotal?: Price; + // (undocumented) + properties?: PurchaseRequest; + reservationId?: string; + reservationOrderId?: string; + status?: OperationStatus; +} + +// @public +export interface ReservationToReturn { + quantity?: number; + reservationId?: string; +} + +// @public +export interface ReservationToReturnForExchange { + billingInformation?: BillingInformation; + // (undocumented) + billingRefundAmount?: Price; + quantity?: number; + reservationId?: string; + status?: OperationStatus; +} + +// @public +export interface ReservationUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ReservationUpdateResponse = ReservationResponse; + +// @public +export interface ReservationUtilizationAggregates { + readonly grain?: number; + readonly grainUnit?: string; + readonly value?: number; + readonly valueUnit?: string; +} + +// @public +export type ReservedResourceType = string; + +// @public +export interface ResourceName { + readonly localizedValue?: string; + value?: string; +} + +// @public +export type ResourceType = string; + +// @public (undocumented) +export interface ScopeProperties { + // (undocumented) + scope?: string; + // (undocumented) + valid?: boolean; +} + +// @public +export interface ServiceError { + code?: string; + readonly details?: ServiceErrorDetail[]; + message?: string; +} + +// @public +export interface ServiceErrorDetail { + readonly code?: string; + readonly message?: string; +} + +// @public (undocumented) +export interface SkuCapability { + name?: string; + value?: string; +} + +// @public (undocumented) +export interface SkuName { + // (undocumented) + name?: string; +} + +// @public (undocumented) +export interface SkuProperty { + name?: string; + value?: string; +} + +// @public (undocumented) +export interface SkuRestriction { + reasonCode?: string; + type?: string; + values?: string[]; +} + +// @public (undocumented) +export interface SplitRequest { + quantities?: number[]; + reservationId?: string; +} + +// @public +export interface SubRequest { + readonly limit?: number; + readonly message?: string; + name?: ResourceName; + provisioningState?: QuotaRequestState; + readonly resourceType?: string; + readonly subRequestId?: string; + unit?: string; +} + +// @public (undocumented) +export interface SubscriptionScopeProperties { + // (undocumented) + scopes?: ScopeProperties[]; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type UserFriendlyAppliedScopeType = string; + +// @public +export type UserFriendlyRenewState = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/reservations/arm-reservations/rollup.config.js b/sdk/reservations/arm-reservations/rollup.config.js index 254b7e0e555f..9be1955eb7f1 100644 --- a/sdk/reservations/arm-reservations/rollup.config.js +++ b/sdk/reservations/arm-reservations/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/azureReservationAPI.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-reservations.js", - format: "umd", - name: "Azure.ArmReservations", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false }; -export default config; +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/reservations/arm-reservations/src/azureReservationAPI.ts b/sdk/reservations/arm-reservations/src/azureReservationAPI.ts index 6f761cb07da8..37d3da80f33d 100644 --- a/sdk/reservations/arm-reservations/src/azureReservationAPI.ts +++ b/sdk/reservations/arm-reservations/src/azureReservationAPI.ts @@ -3,136 +3,145 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + ReservationImpl, + ReservationOrderImpl, + OperationImpl, + CalculateExchangeImpl, + ExchangeImpl, + QuotaImpl, + QuotaRequestStatusImpl +} from "./operations"; +import { + Reservation, + ReservationOrder, + Operation, + CalculateExchange, + Exchange, + Quota, + QuotaRequestStatus +} from "./operationsInterfaces"; import * as Parameters from "./models/parameters"; -import * as operations from "./operations"; -import { AzureReservationAPIContext } from "./azureReservationAPIContext"; - +import * as Mappers from "./models/mappers"; +import { + AzureReservationAPIOptionalParams, + GetCatalogOptionalParams, + GetCatalogResponse, + GetAppliedReservationListOptionalParams, + GetAppliedReservationListResponse +} from "./models"; -class AzureReservationAPI extends AzureReservationAPIContext { - // Operation groups - reservation: operations.Reservation; - reservationOrder: operations.ReservationOrder; - operation: operations.Operation; - calculateExchange: operations.CalculateExchange; - exchange: operations.Exchange; - quota: operations.Quota; - quotaRequestStatus: operations.QuotaRequestStatus; +export class AzureReservationAPI extends coreClient.ServiceClient { + $host: string; /** * Initializes a new instance of the AzureReservationAPI class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param [options] The parameter options + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) { - super(credentials, options); - this.reservation = new operations.Reservation(this); - this.reservationOrder = new operations.ReservationOrder(this); - this.operation = new operations.Operation(this); - this.calculateExchange = new operations.CalculateExchange(this); - this.exchange = new operations.Exchange(this); - this.quota = new operations.Quota(this); - this.quotaRequestStatus = new operations.QuotaRequestStatus(this); + constructor( + credentials: coreAuth.TokenCredential, + options?: AzureReservationAPIOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: AzureReservationAPIOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-reservations/7.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: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.reservation = new ReservationImpl(this); + this.reservationOrder = new ReservationOrderImpl(this); + this.operation = new OperationImpl(this); + this.calculateExchange = new CalculateExchangeImpl(this); + this.exchange = new ExchangeImpl(this); + this.quota = new QuotaImpl(this); + this.quotaRequestStatus = new QuotaRequestStatusImpl(this); } /** - * @summary Get the regions and skus that are available for RI purchase for the specified Azure - * subscription. + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. * @param subscriptionId Id of the subscription - * @param reservedResourceType The type of the resource for which the skus should be provided. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams): Promise; - /** - * @param subscriptionId Id of the subscription - * @param reservedResourceType The type of the resource for which the skus should be provided. - * @param callback The callback - */ - getCatalog(subscriptionId: string, reservedResourceType: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Id of the subscription - * @param reservedResourceType The type of the resource for which the skus should be provided. - * @param options The optional parameters - * @param callback The callback - */ - getCatalog(subscriptionId: string, reservedResourceType: string, options: Models.AzureReservationAPIGetCatalogOptionalParams, callback: msRest.ServiceCallback): void; - getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getCatalog( + subscriptionId: string, + options?: GetCatalogOptionalParams + ): Promise { return this.sendOperationRequest( - { - subscriptionId, - reservedResourceType, - options - }, - getCatalogOperationSpec, - callback) as Promise; + { subscriptionId, options }, + getCatalogOperationSpec + ); } /** - * Get applicable `Reservation`s that are applied to this subscription or a resource group under - * this subscription. - * @summary Get list of applicable `Reservation`s. - * @param subscriptionId Id of the subscription - * @param [options] The optional parameters - * @returns Promise - */ - getAppliedReservationList(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId Id of the subscription - * @param callback The callback - */ - getAppliedReservationList(subscriptionId: string, callback: msRest.ServiceCallback): void; - /** + * Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. * @param subscriptionId Id of the subscription - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - getAppliedReservationList(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getAppliedReservationList(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getAppliedReservationList( + subscriptionId: string, + options?: GetAppliedReservationListOptionalParams + ): Promise { return this.sendOperationRequest( - { - subscriptionId, - options - }, - getAppliedReservationListOperationSpec, - callback) as Promise; + { subscriptionId, options }, + getAppliedReservationListOperationSpec + ); } -} + reservation: Reservation; + reservationOrder: ReservationOrder; + operation: Operation; + calculateExchange: CalculateExchange; + exchange: Exchange; + quota: Quota; + quotaRequestStatus: QuotaRequestStatus; +} // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getCatalogOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getCatalogOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion0, - Parameters.reservedResourceType, - Parameters.location0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "Catalog" - } - } + element: { type: { name: "Composite", className: "Catalog" } } } } }, @@ -140,21 +149,19 @@ const getCatalogOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.reservedResourceType, + Parameters.location + ], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const getAppliedReservationListOperationSpec: msRest.OperationSpec = { +const getAppliedReservationListOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.AppliedReservations @@ -163,13 +170,8 @@ const getAppliedReservationListOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -export { - AzureReservationAPI, - AzureReservationAPIContext, - Models as AzureReservationAPIModels, - Mappers as AzureReservationAPIMappers -}; -export * from "./operations"; diff --git a/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts b/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts deleted file mode 100644 index 49da34adf76d..000000000000 --- a/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-reservations"; -const packageVersion = "6.0.0"; - -export class AzureReservationAPIContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - - /** - * Initializes a new instance of the AzureReservationAPI class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if (!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/reservations/arm-reservations/src/models/operationMappers.ts b/sdk/reservations/arm-reservations/src/index.ts similarity index 57% rename from sdk/reservations/arm-reservations/src/models/operationMappers.ts rename to sdk/reservations/arm-reservations/src/index.ts index e8357d65a5d4..17b76c65cbec 100644 --- a/sdk/reservations/arm-reservations/src/models/operationMappers.ts +++ b/sdk/reservations/arm-reservations/src/index.ts @@ -6,10 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - ErrorModel, - ExtendedErrorInfo, - OperationDisplay, - OperationList, - OperationResponse -} from "../models/mappers"; +/// +export * from "./models"; +export { AzureReservationAPI } from "./azureReservationAPI"; +export * from "./operationsInterfaces"; diff --git a/sdk/reservations/arm-reservations/src/lroImpl.ts b/sdk/reservations/arm-reservations/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/reservations/arm-reservations/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/reservations/arm-reservations/src/models/calculateExchangeMappers.ts b/sdk/reservations/arm-reservations/src/models/calculateExchangeMappers.ts deleted file mode 100644 index f7f3a0268aa3..000000000000 --- a/sdk/reservations/arm-reservations/src/models/calculateExchangeMappers.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 { - BillingInformation, - CalculateExchangeOperationResultResponse, - CalculateExchangePostHeaders, - CalculateExchangeRequest, - CalculateExchangeRequestProperties, - CalculateExchangeResponseProperties, - ErrorModel, - ExchangePolicyError, - ExchangePolicyErrors, - ExtendedErrorInfo, - OperationResultError, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - ReservationToExchange, - ReservationToPurchaseCalculateExchange, - ReservationToReturn, - SkuName -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/exchangeMappers.ts b/sdk/reservations/arm-reservations/src/models/exchangeMappers.ts deleted file mode 100644 index d948db0c59ee..000000000000 --- a/sdk/reservations/arm-reservations/src/models/exchangeMappers.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 { - BillingInformation, - ErrorModel, - ExchangeOperationResultResponse, - ExchangePolicyError, - ExchangePolicyErrors, - ExchangePostHeaders, - ExchangeRequest, - ExchangeRequestProperties, - ExchangeResponseProperties, - ExtendedErrorInfo, - OperationResultError, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - ReservationToPurchaseExchange, - ReservationToReturnForExchange, - SkuName -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/index.ts b/sdk/reservations/arm-reservations/src/models/index.ts index 6d94f9ae195d..46cce6a15a26 100644 --- a/sdk/reservations/arm-reservations/src/models/index.ts +++ b/sdk/reservations/arm-reservations/src/models/index.ts @@ -6,2313 +6,2070 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +/** Available scope */ +export interface AvailableScopeRequest { + /** Available scope request properties */ + properties?: AvailableScopeRequestProperties; +} -/** - * Available scope request properties - */ +/** Available scope request properties */ export interface AvailableScopeRequestProperties { scopes?: string[]; } -/** - * Available scope - */ -export interface AvailableScopeRequest { - properties?: AvailableScopeRequestProperties; +export interface AvailableScopeProperties { + properties?: SubscriptionScopeProperties; } -/** - * An interface representing SkuName. - */ -export interface SkuName { - name?: string; +export interface SubscriptionScopeProperties { + scopes?: ScopeProperties[]; } -/** - * Properties specific to each reserved resource type. Not required if not applicable. - */ -export interface PurchaseRequestPropertiesReservedResourceProperties { - /** - * Possible values include: 'On', 'Off' - */ - instanceFlexibility?: InstanceFlexibility; +export interface ScopeProperties { + scope?: string; + valid?: boolean; } -/** - * An interface representing PurchaseRequest. - */ -export interface PurchaseRequest { - sku?: SkuName; - /** - * The Azure Region where the reserved resource lives. - */ - location?: string; +export interface ErrorModel { + error?: ExtendedErrorInfo; +} + +export interface ExtendedErrorInfo { + code?: ErrorResponseCode; + message?: string; +} + +export interface Catalog { /** - * Possible values include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', - * 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', 'Databricks', 'AppService', - * 'ManagedDisk', 'BlockBlob', 'RedisCache', 'AzureDataExplorer', 'MySql', 'MariaDb', - * 'PostgreSql', 'DedicatedHost', 'SapHana', 'SqlAzureHybridBenefit' + * The type of resource the SKU applies to. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - reservedResourceType?: ReservedResourceType; - billingScopeId?: string; + readonly resourceType?: string; /** - * Possible values include: 'P1Y', 'P3Y' + * The name of SKU + * NOTE: This property will not be serialized. It can only be populated by the server. */ - term?: ReservationTerm; + readonly name?: string; + /** The billing plan options available for this SKU. */ + billingPlans?: { [propertyName: string]: ReservationBillingPlan[] }; /** - * Possible values include: 'Upfront', 'Monthly' + * Available reservation terms for this resource + * NOTE: This property will not be serialized. It can only be populated by the server. */ - billingPlan?: ReservationBillingPlan; - quantity?: number; + readonly terms?: ReservationTerm[]; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly locations?: string[]; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly skuProperties?: SkuProperty[]; /** - * Friendly name of the Reservation + * Pricing information about the SKU + * NOTE: This property will not be serialized. It can only be populated by the server. */ - displayName?: string; + readonly msrp?: CatalogMsrp; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly restrictions?: SkuRestriction[]; /** - * Possible values include: 'Single', 'Shared' + * The tier of this SKU + * NOTE: This property will not be serialized. It can only be populated by the server. */ - appliedScopeType?: AppliedScopeType; - appliedScopes?: string[]; - renew?: boolean; + readonly tier?: string; /** - * Properties specific to each reserved resource type. Not required if not applicable. + * The size of this SKU + * NOTE: This property will not be serialized. It can only be populated by the server. */ - reservedResourceProperties?: PurchaseRequestPropertiesReservedResourceProperties; + readonly size?: string; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly capabilities?: SkuCapability[]; } -/** - * Reservation to return - */ -export interface ReservationToReturn { +export interface SkuProperty { + /** An invariant to describe the feature. */ + name?: string; + /** An invariant if the feature is measured by quantity. */ + value?: string; +} + +/** Pricing information about the SKU */ +export interface CatalogMsrp { + /** Amount in pricing currency. Tax not included. */ + p1Y?: Price; +} + +export interface Price { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; +} + +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. */ + values?: string[]; + /** The reason for restriction. */ + reasonCode?: string; +} + +export interface SkuCapability { + /** An invariant to describe the feature. */ + name?: string; + /** An invariant if the feature is measured by quantity. */ + value?: string; +} + +export interface AppliedReservations { /** - * Fully qualified identifier of the Reservation being returned + * Identifier of the applied reservations + * NOTE: This property will not be serialized. It can only be populated by the server. */ - reservationId?: string; + readonly id?: string; + /** + * Name of resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; /** - * Quantity to be returned. Must be greater than zero. + * Type of resource. "Microsoft.Capacity/AppliedReservations" + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly type?: string; + reservationOrderIds?: AppliedReservationList; +} + +export interface AppliedReservationList { + value?: string[]; + /** Url to get the next page of reservations */ + nextLink?: string; +} + +export interface PurchaseRequest { + sku?: SkuName; + /** 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 */ + billingScopeId?: string; + /** Represent the term of Reservation. */ + term?: ReservationTerm; + /** Represent the billing plans. */ + billingPlan?: ReservationBillingPlan; + /** Quantity of the SKUs that are part of the Reservation. */ quantity?: number; + /** 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[]; + /** 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; } -/** - * Calculate exchange request properties - */ -export interface CalculateExchangeRequestProperties { - /** - * List of reservations that are being purchased in this exchange. - */ - reservationsToPurchase?: PurchaseRequest[]; - /** - * List of reservations that are being returned in this exchange. - */ - reservationsToExchange?: ReservationToReturn[]; +export interface SkuName { + name?: string; } -/** - * Calculate exchange request - */ -export interface CalculateExchangeRequest { - properties?: CalculateExchangeRequestProperties; +/** 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; } -/** - * Exchange request properties - */ -export interface ExchangeRequestProperties { - /** - * SessionId that was returned by CalculateExchange API. - */ - sessionId?: string; +export interface CalculatePriceResponse { + properties?: CalculatePriceResponseProperties; } -/** - * Exchange request - */ -export interface ExchangeRequest { - properties?: ExchangeRequestProperties; +export interface CalculatePriceResponseProperties { + /** Currency and amount that customer will be charged in customer's local currency. Tax is not included. */ + billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; + /** Net total amount in pricing currency. */ + netTotal?: number; + /** Tax amount in pricing currency. */ + taxTotal?: number; + /** Total amount in pricing currency. */ + grandTotal?: number; + /** Whether or not tax is included in grand total */ + isTaxIncluded?: boolean; + /** True if billing is managed by Microsoft Partner. Used only for CSP accounts. */ + isBillingPartnerManaged?: boolean; + /** GUID that represents reservation order that can be placed after calculating price. */ + reservationOrderId?: string; + /** Title of SKU that is being purchased. */ + skuTitle?: string; + /** 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; + paymentSchedule?: PaymentDetail[]; } -/** - * An interface representing Price. - */ -export interface Price { - /** - * The ISO 4217 3-letter currency code for the currency used by this purchase record. - */ +/** Currency and amount that customer will be charged in customer's local currency. Tax is not included. */ +export interface CalculatePriceResponsePropertiesBillingCurrencyTotal { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ currencyCode?: string; + /** Amount in pricing currency. Tax is not included. */ amount?: number; } -/** - * Reservation purchase details - */ -export interface ReservationToPurchaseCalculateExchange { - properties?: PurchaseRequest; +/** Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. */ +export interface CalculatePriceResponsePropertiesPricingCurrencyTotal { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; +} + +/** Information about payment related to a reservation order. */ +export interface PaymentDetail { + /** Date when the payment needs to be done. */ + dueDate?: Date; + /** Date when the transaction is completed. Is null when it is scheduled. */ + paymentDate?: Date; + /** Amount in pricing currency. Tax not included. */ + pricingCurrencyTotal?: Price; + /** Amount charged in Billing currency. Tax not included. Is null for future payments */ billingCurrencyTotal?: Price; + /** Shows the Account that is charged for this payment. */ + billingAccount?: string; + /** Describes whether the payment is completed, failed, cancelled or scheduled in the future. */ + status?: PaymentStatus; + extendedStatusInfo?: ExtendedStatusInfo; } -/** - * billing information - */ -export interface BillingInformation { - billingCurrencyTotalPaidAmount?: Price; - billingCurrencyProratedAmount?: Price; - billingCurrencyRemainingCommitmentAmount?: Price; +export interface ExtendedStatusInfo { + statusCode?: ReservationStatusCode; + /** The message giving detailed information about the status code. */ + message?: string; } -/** - * Reservation refund details - */ -export interface ReservationToExchange { +export interface ReservationOrderList { + value?: ReservationOrderResponse[]; + /** Url to get the next page of reservationOrders. */ + nextLink?: string; +} + +export interface ReservationOrderResponse { + etag?: number; /** - * Fully qualified id of the Reservation being returned. + * Identifier of the reservation + * NOTE: This property will not be serialized. It can only be populated by the server. */ - reservationId?: string; + readonly id?: string; /** - * Quantity to be returned + * Name of the reservation + * NOTE: This property will not be serialized. It can only be populated by the server. */ - quantity?: number; - billingRefundAmount?: Price; - billingInformation?: BillingInformation; + readonly name?: string; + /** + * Type of resource. "Microsoft.Capacity/reservations" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * 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; + /** Friendly name for user to easily identified the reservation. */ + displayName?: string; + /** This is the DateTime when the reservation was initially requested for purchase. */ + requestDateTime?: Date; + /** This is the DateTime when the reservation was created. */ + createdDateTime?: Date; + /** This is the date when the Reservation will expire. */ + expiryDate?: Date; + /** Total Quantity of the SKUs purchased in the Reservation. */ + originalQuantity?: number; + /** Represent the term of Reservation. */ + term?: ReservationTerm; + /** Current state of the reservation. */ + provisioningState?: ProvisioningState; + /** Represent the billing plans. */ + billingPlan?: ReservationBillingPlan; + /** Information describing the type of billing plan for this reservation. */ + planInformation?: ReservationOrderBillingPlanInformation; + reservations?: ReservationResponse[]; } -/** - * error details - */ -export interface ExchangePolicyError { - code?: string; - message?: string; +/** Information describing the type of billing plan for this reservation. */ +export interface ReservationOrderBillingPlanInformation { + /** Amount of money to be paid for the Order. Tax is not included. */ + pricingCurrencyTotal?: Price; + /** Date when the billing plan has started. */ + startDate?: Date; + /** For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid off. */ + nextPaymentDueDate?: Date; + transactions?: PaymentDetail[]; } -/** - * Exchange policy errors - */ -export interface ExchangePolicyErrors { +/** The definition of the reservation. */ +export interface ReservationResponse { + /** The Azure Region where the reserved resource lives. */ + location?: string; + etag?: number; /** - * Exchange Policy errors + * Identifier of the reservation + * NOTE: This property will not be serialized. It can only be populated by the server. */ - policyErrors?: ExchangePolicyError[]; -} - -/** - * CalculateExchange response properties - */ -export interface CalculateExchangeResponseProperties { + readonly id?: string; /** - * Exchange session identifier + * Name of the reservation + * NOTE: This property will not be serialized. It can only be populated by the server. */ - sessionId?: string; - netPayable?: Price; - refundsTotal?: Price; - purchasesTotal?: Price; + readonly name?: string; + /** The sku information associated to this reservation */ + sku?: SkuName; + /** The properties associated to this reservation */ + properties?: ReservationsProperties; /** - * Details of the reservations being purchased + * Type of resource. "Microsoft.Capacity/reservationOrders/reservations" + * NOTE: This property will not be serialized. It can only be populated by the server. */ - reservationsToPurchase?: ReservationToPurchaseCalculateExchange[]; + readonly type?: string; + /** Resource Provider type to be reserved. */ + kind?: "Microsoft.Compute"; /** - * Details of the reservations being returned + * 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. */ - reservationsToExchange?: ReservationToExchange[]; - policyResult?: ExchangePolicyErrors; + readonly systemData?: SystemData; } -/** - * Required if status == failed or status == canceled. - */ -export interface OperationResultError { - /** - * Required if status == failed or status == cancelled. If status == failed, provide an invariant - * error code used for error troubleshooting, aggregation, and analysis. - */ - code?: string; - /** - * Required if status == failed. Localized. If status == failed, provide an actionable error - * message indicating what error occurred, and what the user can do to address the issue. - */ - message?: string; -} - -/** - * CalculateExchange operation result - */ -export interface CalculateExchangeOperationResultResponse { +/** 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. */ + instanceFlexibility?: InstanceFlexibility; + /** Friendly name for user to easily identify the reservation */ + displayName?: string; + /** The list of applied scopes */ + appliedScopes?: string[]; + /** The applied scope type */ + appliedScopeType?: AppliedScopeType; + /** Indicates if the reservation is archived */ + archived?: boolean; + /** Capabilities of the reservation */ + capabilities?: string; + /** 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. */ + effectiveDateTime?: Date; /** - * It should match what is used to GET the operation result. + * DateTime of the last time the Reservation was updated. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - id?: string; + readonly lastUpdatedDateTime?: Date; + /** This is the date when the Reservation will expire. */ + expiryDate?: 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. */ + billingPlan?: ReservationBillingPlan; /** - * It must match the last segment of the id field, and will typically be a GUID / system - * generated value. + * The provisioning state of the reservation for display, e.g. Succeeded + * NOTE: This property will not be serialized. It can only be populated by the server. */ - name?: string; + readonly displayProvisioningState?: string; /** - * Status of the operation. Possible values include: 'Succeeded', 'Failed', 'Cancelled', - * 'Pending' + * The provisioning state of the reservation, e.g. Succeeded + * NOTE: This property will not be serialized. It can only be populated by the server. */ - status?: CalculateExchangeOperationResultStatus; - properties?: CalculateExchangeResponseProperties; - error?: OperationResultError; -} - -/** - * Reservation purchase details - */ -export interface ReservationToPurchaseExchange { + readonly provisioningSubState?: string; + /** This is the date when the Reservation was purchased. */ + purchaseDate?: Date; + splitProperties?: ReservationSplitProperties; + mergeProperties?: ReservationMergeProperties; + /** Subscription that will be charged for purchasing Reservation */ + billingScopeId?: string; + /** Setting this to true will automatically purchase a new reservation on the expiration date time. */ + renew?: boolean; + /** Reservation Id of the reservation from which this reservation is renewed. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. */ + 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; + renewProperties?: RenewPropertiesResponse; + /** Represent the term of Reservation. */ + term?: ReservationTerm; /** - * Fully qualified id of the ReservationOrder being purchased + * The applied scope type of the reservation for display, e.g. Shared + * NOTE: This property will not be serialized. It can only be populated by the server. */ - reservationOrderId?: string; + readonly userFriendlyAppliedScopeType?: string; /** - * Fully qualified id of the Reservation being purchased. This value is only guaranteed to be - * non-null if the purchase is successful. + * The renew state of the reservation for display, e.g. On + * NOTE: This property will not be serialized. It can only be populated by the server. */ - reservationId?: string; - properties?: PurchaseRequest; - billingCurrencyTotal?: Price; + readonly userFriendlyRenewState?: string; /** - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' + * Reservation utilization + * NOTE: This property will not be serialized. It can only be populated by the server. */ - status?: OperationStatus; + readonly utilization?: ReservationsPropertiesUtilization; } -/** - * Reservation refund details - */ -export interface ReservationToReturnForExchange { - /** - * Fully qualified id of the Reservation being returned. - */ - reservationId?: string; - /** - * Quantity to be returned - */ - quantity?: number; - billingRefundAmount?: Price; - billingInformation?: BillingInformation; - /** - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' - */ - status?: OperationStatus; +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} */ + 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} */ + splitSource?: string; } -/** - * Exchange response properties - */ -export interface ExchangeResponseProperties { - /** - * Exchange session identifier - */ - sessionId?: string; - netPayable?: Price; - refundsTotal?: Price; - purchasesTotal?: Price; - /** - * Details of the reservations being purchased - */ - reservationsToPurchase?: ReservationToPurchaseExchange[]; - /** - * Details of the reservations being returned - */ - reservationsToExchange?: ReservationToReturnForExchange[]; - policyResult?: ExchangePolicyErrors; +export interface ReservationMergeProperties { + /** 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} */ + mergeSources?: string[]; } -/** - * Exchange operation result - */ -export interface ExchangeOperationResultResponse { - /** - * It should match what is used to GET the operation result. - */ - id?: string; - /** - * It must match the last segment of the id field, and will typically be a GUID / system - * generated value. - */ - name?: string; - /** - * Status of the operation. Possible values include: 'Succeeded', 'Failed', 'Cancelled', - * 'PendingRefunds', 'PendingPurchases' - */ - status?: ExchangeOperationResultStatus; - properties?: ExchangeResponseProperties; - error?: OperationResultError; +export interface RenewPropertiesResponse { + 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; + /** Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. */ + billingCurrencyTotal?: RenewPropertiesResponseBillingCurrencyTotal; } -/** - * An interface representing SkuProperty. - */ -export interface SkuProperty { - /** - * An invariant to describe the feature. - */ - name?: string; - /** - * An invariant if the feature is measured by quantity. - */ - value?: string; +/** 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. */ +export interface RenewPropertiesResponsePricingCurrencyTotal { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; } -/** - * An interface representing SkuRestriction. - */ -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. - */ - values?: string[]; - /** - * The reason for restriction. - */ - reasonCode?: string; +/** Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. */ +export interface RenewPropertiesResponseBillingCurrencyTotal { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; } -/** - * An interface representing Catalog. - */ -export interface Catalog { - /** - * 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 - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; +/** Reservation utilization */ +export interface ReservationsPropertiesUtilization { /** - * The billing plan options available for this SKU. + * The number of days trend for a reservation + * NOTE: This property will not be serialized. It can only be populated by the server. */ - billingPlans?: { [propertyName: string]: ReservationBillingPlan[] }; + readonly trend?: string; + /** The array of aggregates of a reservation's utilization */ + aggregates?: ReservationUtilizationAggregates[]; +} + +/** The aggregate values of reservation utilization */ +export interface ReservationUtilizationAggregates { /** - * Available reservation terms for this resource - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The grain of the aggregate + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly terms?: ReservationTerm[]; + readonly grain?: number; /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The grain unit of the aggregate + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly locations?: string[]; + readonly grainUnit?: string; /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The aggregate value + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly skuProperties?: SkuProperty[]; + readonly value?: number; /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The aggregate value unit + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly restrictions?: SkuRestriction[]; + readonly valueUnit?: string; } -/** - * An interface representing ExtendedStatusInfo. - */ -export interface ExtendedStatusInfo { - /** - * Possible values include: 'None', 'Pending', 'Active', 'PurchaseError', - * 'PaymentInstrumentError', 'Split', 'Merged', 'Expired', 'Succeeded' - */ - statusCode?: ReservationStatusCode; - /** - * The message giving detailed information about the status code. - */ - message?: string; +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; } -/** - * Information about payment related to a reservation order. - */ -export interface PaymentDetail { - /** - * Date when the payment needs to be done. - */ - dueDate?: Date; - /** - * Date when the transaction is completed. Is null when it is scheduled. - */ - paymentDate?: Date; - /** - * Amount in pricing currency. Tax not included. - */ - pricingCurrencyTotal?: Price; - /** - * Amount charged in Billing currency. Tax not included. Is null for future payments - */ - billingCurrencyTotal?: Price; - /** - * Shows the Account that is charged for this payment. - */ - billingAccount?: string; - /** - * Possible values include: 'Succeeded', 'Failed', 'Scheduled', 'Cancelled' - */ - status?: PaymentStatus; - extendedStatusInfo?: ExtendedStatusInfo; +export interface SplitRequest { + /** List of the quantities in the new reservations to create. */ + quantities?: number[]; + /** Resource id of the reservation to be split. Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + reservationId?: string; } -/** - * Information describing the type of billing plan for this reservation. - */ -export interface ReservationOrderBillingPlanInformation { - /** - * Amount of money to be paid for the Order. Tax is not included. - */ - pricingCurrencyTotal?: Price; - /** - * Date when the billing plan has started. - */ - startDate?: Date; - /** - * For recurring billing plans, indicates the date when next payment will be processed. Null when - * total is paid off. - */ - nextPaymentDueDate?: Date; - transactions?: PaymentDetail[]; +export interface MergeRequest { + /** Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + sources?: string[]; } -/** - * An interface representing ReservationSplitProperties. - */ -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} - */ - 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} - */ - splitSource?: string; +export interface ReservationList { + value?: ReservationResponse[]; + /** Url to get the next page of reservations. */ + nextLink?: string; } -/** - * An interface representing ReservationMergeProperties. - */ -export interface ReservationMergeProperties { - /** - * 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} - */ - mergeSources?: string[]; +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[]; + /** 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 */ + name?: string; + /** Setting this to true will automatically purchase a new reservation on the expiration date time. */ + renew?: boolean; + renewProperties?: PatchPropertiesRenewProperties; } -/** - * 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. - */ -export interface RenewPropertiesResponsePricingCurrencyTotal { - currencyCode?: string; - amount?: number; +export interface PatchPropertiesRenewProperties { + purchaseProperties?: PurchaseRequest; } -/** - * Currency and amount that customer will be charged in customer's local currency for renewal - * purchase. Tax is not included. - */ -export interface RenewPropertiesResponseBillingCurrencyTotal { - currencyCode?: string; - amount?: number; +export interface OperationList { + value?: OperationResponse[]; + /** Url to get the next page of items. */ + nextLink?: string; } -/** - * An interface representing RenewPropertiesResponse. - */ -export interface RenewPropertiesResponse { - 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; - /** - * Currency and amount that customer will be charged in customer's local currency for renewal - * purchase. Tax is not included. - */ - billingCurrencyTotal?: RenewPropertiesResponseBillingCurrencyTotal; +export interface OperationResponse { + /** Name of the operation */ + name?: string; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; + /** Display of the operation */ + display?: OperationDisplay; + /** Origin of the operation */ + origin?: string; + /** Properties of the operation */ + properties?: Record; } -/** - * An interface representing ReservationProperties. - */ -export interface ReservationProperties { - /** - * Possible values include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', - * 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', 'Databricks', 'AppService', - * 'ManagedDisk', 'BlockBlob', 'RedisCache', 'AzureDataExplorer', 'MySql', 'MariaDb', - * 'PostgreSql', 'DedicatedHost', 'SapHana', 'SqlAzureHybridBenefit' - */ - reservedResourceType?: ReservedResourceType; - /** - * Possible values include: 'On', 'Off' - */ - instanceFlexibility?: InstanceFlexibility; - /** - * Friendly name for user to easily identify the reservation - */ - displayName?: string; - appliedScopes?: string[]; - /** - * Possible values include: 'Single', 'Shared' - */ - appliedScopeType?: AppliedScopeType; - quantity?: number; - /** - * Current state of the reservation. - */ - provisioningState?: string; - /** - * DateTime of the Reservation starting when this version is effective from. - */ - effectiveDateTime?: Date; - /** - * DateTime of the last time the Reservation was updated. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastUpdatedDateTime?: Date; - /** - * This is the date when the Reservation will expire. - */ - expiryDate?: Date; - /** - * Description of the SKU in english. - */ - skuDescription?: string; - extendedStatusInfo?: ExtendedStatusInfo; - /** - * Possible values include: 'Upfront', 'Monthly' - */ - billingPlan?: ReservationBillingPlan; - splitProperties?: ReservationSplitProperties; - mergeProperties?: ReservationMergeProperties; - billingScopeId?: string; - renew?: boolean; - /** - * Reservation Id of the reservation from which this reservation is renewed. Format of the - * resource Id is - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - */ - 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; - renewProperties?: RenewPropertiesResponse; - /** - * Possible values include: 'P1Y', 'P3Y' - */ - term?: ReservationTerm; -} - -/** - * An interface representing ReservationResponse. - */ -export interface ReservationResponse extends BaseResource { - /** - * The Azure Region where the reserved resource lives. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly 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; - sku?: SkuName; - properties?: ReservationProperties; - /** - * 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; -} - -/** - * An interface representing ReservationOrderResponse. - */ -export interface ReservationOrderResponse extends BaseResource { - 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; - /** - * Friendly name for user to easily identified the reservation. - */ - displayName?: string; - /** - * This is the DateTime when the reservation was initially requested for purchase. - */ - requestDateTime?: Date; - /** - * This is the DateTime when the reservation was created. - */ - createdDateTime?: Date; - /** - * This is the date when the Reservation will expire. - */ - expiryDate?: Date; - originalQuantity?: number; - /** - * Possible values include: 'P1Y', 'P3Y' - */ - term?: ReservationTerm; - /** - * Current state of the reservation. - */ - provisioningState?: string; - /** - * Possible values include: 'Upfront', 'Monthly' - */ - billingPlan?: ReservationBillingPlan; - planInformation?: ReservationOrderBillingPlanInformation; - reservations?: ReservationResponse[]; - /** - * Type of resource. "Microsoft.Capacity/reservations" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; -} - -/** - * Currency and amount that customer will be charged in customer's local currency. Tax is not - * included. - */ -export interface CalculatePriceResponsePropertiesBillingCurrencyTotal { - currencyCode?: string; - amount?: number; -} - -/** - * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is - * not included. - */ -export interface CalculatePriceResponsePropertiesPricingCurrencyTotal { - currencyCode?: string; - amount?: number; -} - -/** - * An interface representing CalculatePriceResponseProperties. - */ -export interface CalculatePriceResponseProperties { - /** - * Currency and amount that customer will be charged in customer's local currency. Tax is not - * included. - */ - billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; - /** - * True if billing is managed by Microsoft Partner. Used only for CSP accounts. - */ - isBillingPartnerManaged?: boolean; - /** - * GUID that represents reservation order that can be placed after calculating price. - */ - reservationOrderId?: string; - /** - * Title of SKU that is being purchased. - */ - skuTitle?: string; - /** - * 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; - paymentSchedule?: PaymentDetail[]; -} - -/** - * An interface representing CalculatePriceResponse. - */ -export interface CalculatePriceResponse { - properties?: CalculatePriceResponseProperties; -} - -/** - * An interface representing PatchPropertiesRenewProperties. - */ -export interface PatchPropertiesRenewProperties { - purchaseProperties?: PurchaseRequest; +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; + description?: string; } -/** - * An interface representing MergeRequest. - */ -export interface MergeRequest { - /** - * Format of the resource id should be - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} - */ - sources?: string[]; +/** Calculate exchange request */ +export interface CalculateExchangeRequest { + /** Calculate exchange request properties */ + properties?: CalculateExchangeRequestProperties; } -/** - * An interface representing Patch. - */ -export interface Patch { - /** - * Possible values include: 'Single', 'Shared' - */ - appliedScopeType?: AppliedScopeType; - appliedScopes?: string[]; - /** - * Possible values include: 'On', 'Off' - */ - instanceFlexibility?: InstanceFlexibility; - /** - * Name of the Reservation - */ - name?: string; - renew?: boolean; - renewProperties?: PatchPropertiesRenewProperties; +/** Calculate exchange request properties */ +export interface CalculateExchangeRequestProperties { + /** List of reservations that are being purchased in this exchange. */ + reservationsToPurchase?: PurchaseRequest[]; + /** List of reservations that are being returned in this exchange. */ + reservationsToExchange?: ReservationToReturn[]; } -/** - * An interface representing SplitRequest. - */ -export interface SplitRequest { - /** - * List of the quantities in the new reservations to create. - */ - quantities?: number[]; - /** - * Resource id of the reservation to be split. Format of the resource id should be - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} - */ +/** Reservation to return */ +export interface ReservationToReturn { + /** Fully qualified identifier of the Reservation being returned */ reservationId?: string; + /** Quantity to be returned. Must be greater than zero. */ + quantity?: number; } -/** - * An interface representing ExtendedErrorInfo. - */ -export interface ExtendedErrorInfo { - /** - * Possible values include: 'NotSpecified', 'InternalServerError', 'ServerTimeout', - * 'AuthorizationFailed', 'BadRequest', 'ClientCertificateThumbprintNotSet', - * 'InvalidRequestContent', 'OperationFailed', 'HttpMethodNotSupported', 'InvalidRequestUri', - * 'MissingTenantId', 'InvalidTenantId', 'InvalidReservationOrderId', 'InvalidReservationId', - * 'ReservationIdNotInReservationOrder', 'ReservationOrderNotFound', 'InvalidSubscriptionId', - * 'InvalidAccessToken', 'InvalidLocationId', 'UnauthenticatedRequestsThrottled', - * 'InvalidHealthCheckType', 'Forbidden', 'BillingScopeIdCannotBeChanged', - * 'AppliedScopesNotAssociatedWithCommerceAccount', 'PatchValuesSameAsExisting', - * 'RoleAssignmentCreationFailed', 'ReservationOrderCreationFailed', - * 'ReservationOrderNotEnabled', 'CapacityUpdateScopesFailed', 'UnsupportedReservationTerm', - * 'ReservationOrderIdAlreadyExists', 'RiskCheckFailed', 'CreateQuoteFailed', - * 'ActivateQuoteFailed', 'NonsupportedAccountId', 'PaymentInstrumentNotFound', - * 'MissingAppliedScopesForSingle', 'NoValidReservationsToReRate', 'ReRateOnlyAllowedForEA', - * 'OperationCannotBePerformedInCurrentState', 'InvalidSingleAppliedScopesCount', - * 'InvalidFulfillmentRequestParameters', 'NotSupportedCountry', 'InvalidRefundQuantity', - * 'PurchaseError', 'BillingCustomerInputError', 'BillingPaymentInstrumentSoftError', - * 'BillingPaymentInstrumentHardError', 'BillingTransientError', 'BillingError', - * 'FulfillmentConfigurationError', 'FulfillmentOutOfStockError', 'FulfillmentTransientError', - * 'FulfillmentError', 'CalculatePriceFailed' - */ - code?: ErrorResponseCode; - message?: string; -} - -/** - * An interface representing ErrorModel. - */ -export interface ErrorModel { - error?: ExtendedErrorInfo; -} - -/** - * An interface representing AppliedReservationList. - */ -export interface AppliedReservationList { - value?: string[]; - /** - * Url to get the next page of reservations - */ - nextLink?: string; -} - -/** - * An interface representing AppliedReservations. - */ -export interface AppliedReservations { - /** - * Identifier of the applied reservations - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Name of resource - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Type of resource. "Microsoft.Capacity/AppliedReservations" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - reservationOrderIds?: AppliedReservationList; -} - -/** - * An interface representing OperationDisplay. - */ -export interface OperationDisplay { - provider?: string; - resource?: string; - operation?: string; - description?: string; -} - -/** - * An interface representing OperationResponse. - */ -export interface OperationResponse { +/** CalculateExchange operation result */ +export interface CalculateExchangeOperationResultResponse { + /** It should match what is used to GET the operation result. */ + id?: string; + /** It must match the last segment of the id field, and will typically be a GUID / system generated value. */ name?: string; - display?: OperationDisplay; - origin?: string; -} - -/** - * An interface representing ScopeProperties. - */ -export interface ScopeProperties { - scope?: string; - valid?: boolean; + /** Status of the operation. */ + status?: CalculateExchangeOperationResultStatus; + /** CalculateExchange response properties */ + properties?: CalculateExchangeResponseProperties; + /** Required if status == failed or status == canceled. */ + error?: OperationResultError; } -/** - * An interface representing SubscriptionScopeProperties. - */ -export interface SubscriptionScopeProperties { - scopes?: ScopeProperties[]; +/** CalculateExchange response properties */ +export interface CalculateExchangeResponseProperties { + /** Exchange session identifier */ + sessionId?: string; + netPayable?: Price; + refundsTotal?: Price; + purchasesTotal?: Price; + /** Details of the reservations being purchased */ + reservationsToPurchase?: ReservationToPurchaseCalculateExchange[]; + /** Details of the reservations being returned */ + reservationsToExchange?: ReservationToExchange[]; + /** Exchange policy errors */ + policyResult?: ExchangePolicyErrors; } -/** - * An interface representing AvailableScopeProperties. - */ -export interface AvailableScopeProperties { - properties?: SubscriptionScopeProperties; +/** Reservation purchase details */ +export interface ReservationToPurchaseCalculateExchange { + properties?: PurchaseRequest; + billingCurrencyTotal?: Price; } -/** - * Resource name provided by the resource provider. Use this property for quotaRequest parameter. - */ -export interface ResourceName { - /** - * Resource name. - */ - value?: string; - /** - * Resource display localized name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly localizedValue?: string; +/** Reservation refund details */ +export interface ReservationToExchange { + /** Fully qualified id of the Reservation being returned. */ + reservationId?: string; + /** Quantity to be returned */ + quantity?: number; + billingRefundAmount?: Price; + /** billing information */ + billingInformation?: BillingInformation; } -/** - * Quota properties for the resource. - */ -export interface QuotaProperties { - /** - * Quota properties. - */ - limit?: number; - /** - * Current usage value for the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly currentValue?: number; - /** - * The limit units, such as **count** and **bytes**. Use the unit field provided in the response - * of the GET quota operation. - */ - unit?: string; - /** - * Name of the resource provide by the resource provider. Use this property for quotaRequests - * resource operations. - */ - name?: ResourceName; - /** - * The name of the resource type. - */ - resourceType?: any; - /** - * The time period over which the quota usage values are summarized. For example, P1D (per one - * day), PT1M (per one minute), and PT1S (per one second). This parameter is optional because, - * for some resources such as compute, the time period is irrelevant. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly quotaPeriod?: string; - /** - * Additional properties for the specified resource provider. - */ - properties?: any; +/** billing information */ +export interface BillingInformation { + billingCurrencyTotalPaidAmount?: Price; + billingCurrencyProratedAmount?: Price; + billingCurrencyRemainingCommitmentAmount?: Price; } -/** - * Quota properties. - */ -export interface CurrentQuotaLimitBase extends BaseResource { - /** - * Quota properties for the resource. - */ - properties?: QuotaProperties; +/** Exchange policy errors */ +export interface ExchangePolicyErrors { + /** Exchange Policy errors */ + policyErrors?: ExchangePolicyError[]; } -/** - * Current quota limits. - */ -export interface CurrentQuotaLimit extends BaseResource { - /** - * Quota properties for the resource. - */ - properties?: QuotaProperties; - /** - * The details of the quota request status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: any; - /** - * A user friendly message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; +/** error details */ +export interface ExchangePolicyError { + code?: string; + message?: string; } -/** - * Quotas (service limits) in the request response. - */ -export interface QuotaLimitsResponse { - /** - * List of quotas with the quota request status. - */ - value?: CurrentQuotaLimit[]; - /** - * The URI for fetching the next page of quota limits. When no more pages exist, the value is - * null. - */ - nextLink?: string; +/** Required if status == failed or status == canceled. */ +export interface OperationResultError { + /** Required if status == failed or status == cancelled. If status == failed, provide an invariant error code used for error troubleshooting, aggregation, and analysis. */ + code?: string; + /** Required if status == failed. Localized. If status == failed, provide an actionable error message indicating what error occurred, and what the user can do to address the issue. */ + message?: string; } -/** - * Quota change requests information. - */ -export interface CreateGenericQuotaRequestParameters { - /** - * Quota change requests. - */ - value?: CurrentQuotaLimitBase[]; +/** Exchange request */ +export interface ExchangeRequest { + /** Exchange request properties */ + properties?: ExchangeRequestProperties; } -/** - * The sub-request submitted with the quota request. - */ -export interface SubRequest { - /** - * Quota (resource limit). - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly limit?: number; - /** - * The resource name. - */ - name?: ResourceName; - /** - * Resource type for which the quota check was made. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly resourceType?: string; - /** - * The limit units, such as **count** and **bytes**. Use the unit field provided in the response - * of the GET quota operation. - */ - unit?: string; - /** - * The quota request status. - */ - provisioningState?: any; - /** - * User-friendly status message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * Sub request ID for individual request. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly subRequestId?: string; +/** Exchange request properties */ +export interface ExchangeRequestProperties { + /** SessionId that was returned by CalculateExchange API. */ + sessionId?: string; } -/** - * Response for the quota submission request. - */ -export interface QuotaRequestOneResourceSubmitResponse extends BaseResource { - /** - * The quota request ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The name of the quota request. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Type of resource. "Microsoft.Capacity/ServiceLimits" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The quota request status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: any; - /** - * User friendly status message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified - * by the ISO 8601 standard. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly requestSubmitTime?: Date; - /** - * Quota properties for the resource. - */ - properties?: QuotaProperties; +/** Exchange operation result */ +export interface ExchangeOperationResultResponse { + /** It should match what is used to GET the operation result. */ + id?: string; + /** It must match the last segment of the id field, and will typically be a GUID / system generated value. */ + name?: string; + /** Status of the operation. */ + status?: ExchangeOperationResultStatus; + /** Exchange response properties */ + properties?: ExchangeResponseProperties; + /** Required if status == failed or status == canceled. */ + error?: OperationResultError; } -/** - * The details of quota request. - */ -export interface QuotaRequestProperties { - /** - * The quota request status. - */ - provisioningState?: any; - /** - * User friendly status message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified - * by the ISO 8601 standard. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly requestSubmitTime?: Date; - /** - * The quotaRequests. - */ - value?: SubRequest[]; +/** Exchange response properties */ +export interface ExchangeResponseProperties { + /** Exchange session identifier */ + sessionId?: string; + netPayable?: Price; + refundsTotal?: Price; + purchasesTotal?: Price; + /** Details of the reservations being purchased */ + reservationsToPurchase?: ReservationToPurchaseExchange[]; + /** Details of the reservations being returned */ + reservationsToExchange?: ReservationToReturnForExchange[]; + /** Exchange policy errors */ + policyResult?: ExchangePolicyErrors; } -/** - * Response for the quota submission request. - */ -export interface QuotaRequestSubmitResponse extends BaseResource { - /** - * The quota request ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The name of the quota request. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The quota request details. - */ - properties?: QuotaRequestProperties; - /** - * Type of resource. "Microsoft.Capacity/serviceLimits" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; +/** Reservation purchase details */ +export interface ReservationToPurchaseExchange { + /** 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. */ + reservationId?: string; + properties?: PurchaseRequest; + billingCurrencyTotal?: Price; + /** Status of the individual operation. */ + status?: OperationStatus; } -/** - * Response with request ID that the quota request was accepted. - */ -export interface QuotaRequestSubmitResponse201 { - /** - * The quota request ID. Use the requestId parameter to check the request status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Operation ID - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Resource type - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; +/** Reservation refund details */ +export interface ReservationToReturnForExchange { + /** Fully qualified id of the Reservation being returned. */ + reservationId?: string; + /** Quantity to be returned */ + quantity?: number; + billingRefundAmount?: Price; + /** billing information */ + billingInformation?: BillingInformation; + /** Status of the individual operation. */ + status?: OperationStatus; +} + +/** The list of reservations and summary of roll out count of reservations in each state. */ +export interface ReservationsListResult { /** - * The details of the quota request status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The list of reservations. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provisioningState?: any; + readonly value?: ReservationResponse[]; /** - * A user friendly message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * 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 message?: string; + readonly nextLink?: string; + /** The roll out count summary of the reservations */ + summary?: ReservationSummary; } -/** - * Quota request details. - */ -export interface QuotaRequestDetails extends BaseResource { - /** - * Quota request ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; +/** The roll up count summary of reservations in each state */ +export interface ReservationSummary { /** - * Quota request name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The number of reservation in Succeeded state + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; + readonly succeededCount?: number; /** - * The quota request status. + * The number of reservation in Failed state + * NOTE: This property will not be serialized. It can only be populated by the server. */ - provisioningState?: any; + readonly failedCount?: number; /** - * User friendly status message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The number of reservation in Expiring state + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly message?: string; + readonly expiringCount?: number; /** - * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified - * by the ISO 8601 standard. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The number of reservation in Expired state + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly requestSubmitTime?: Date; + readonly expiredCount?: number; /** - * The quotaRequests. + * The number of reservation in Pending state + * NOTE: This property will not be serialized. It can only be populated by the server. */ - value?: SubRequest[]; + readonly pendingCount?: number; /** - * Resource type - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The number of reservation in Cancelled state + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; + readonly cancelledCount?: number; } -/** - * The error details. - */ -export interface ServiceErrorDetail { - /** - * The error code. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly code?: string; - /** - * The error message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; +/** Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. */ +export interface ErrorResponse { + /** The details of the error. */ + error?: ErrorDetails; } -/** - * The API error details. - */ -export interface ServiceError { +/** The details of the error. */ +export interface ErrorDetails { /** - * The error code. + * Error code. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - code?: string; + readonly code?: string; /** - * The error message text. + * Error message indicating why the operation failed. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - message?: string; + readonly message?: string; /** - * The list of error details. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The target of the particular error. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly details?: ServiceErrorDetail[]; + readonly target?: string; } -/** - * The API error. - */ -export interface ExceptionResponse { - /** - * The API error details. - */ - error?: ServiceError; +export interface ChangeDirectoryRequest { + /** Tenant id GUID that reservation order is to be transferred to */ + destinationTenantId?: string; } -/** - * Optional Parameters. - */ -export interface ReservationGetOptionalParams extends msRest.RequestOptionsBase { - /** - * Supported value of this query is renewProperties - */ - expand?: string; +/** Change directory response */ +export interface ChangeDirectoryResponse { + /** Change directory result for reservation order or reservation */ + reservationOrder?: ChangeDirectoryResult; + reservations?: ChangeDirectoryResult[]; } -/** - * Optional Parameters. - */ -export interface AzureReservationAPIGetCatalogOptionalParams extends msRest.RequestOptionsBase { - /** - * Filters the skus based on the location specified in this parameter. This can be an azure - * region or global - */ - location?: string; +/** Change directory result for reservation order or reservation */ +export interface ChangeDirectoryResult { + /** Identifier of the reservation order or reservation */ + id?: string; + /** Name of the reservation order or reservation */ + name?: string; + /** True if change directory operation succeeded on this reservation order or reservation */ + isSucceeded?: boolean; + /** Error reason if operation failed. Null otherwise */ + error?: string; } -/** - * Optional Parameters. - */ -export interface ReservationOrderGetOptionalParams extends msRest.RequestOptionsBase { - /** - * May be used to expand the planInformation. - */ - expand?: string; +/** Quota properties. */ +export interface CurrentQuotaLimitBase { + /** Quota properties for the resource. */ + properties?: QuotaProperties; } -/** - * Optional Parameters. - */ -export interface QuotaRequestStatusListOptionalParams extends msRest.RequestOptionsBase { - /** - * | Field | Supported operators - * |---------------------|------------------------ - * - * |requestSubmitTime | ge, le, eq, gt, lt - */ - filter?: string; +/** Quota properties for the resource. */ +export interface QuotaProperties { + /** Quota properties. */ + limit?: number; /** - * Number of records to return. + * Current usage value for the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - top?: number; + readonly currentValue?: number; + /** The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota operation. */ + unit?: string; + /** Name of the resource provide by the resource provider. Use this property for quotaRequests resource operations. */ + name?: ResourceName; + /** The name of the resource type. */ + resourceType?: ResourceType; /** - * 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. + * The time period over which the quota usage values are summarized. For example, P1D (per one day), PT1M (per one minute), and PT1S (per one second). This parameter is optional because, for some resources such as compute, the time period is irrelevant. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - skiptoken?: string; + readonly quotaPeriod?: string; + /** Additional properties for the specified resource provider. */ + properties?: Record; } -/** - * Optional Parameters. - */ -export interface QuotaRequestStatusListNextOptionalParams extends msRest.RequestOptionsBase { - /** - * | Field | Supported operators - * |---------------------|------------------------ - * - * |requestSubmitTime | ge, le, eq, gt, lt - */ - filter?: string; - /** - * Number of records to return. - */ - top?: number; +/** Resource name provided by the resource provider. Use this property for quotaRequest parameter. */ +export interface ResourceName { + /** Resource name. */ + value?: string; /** - * 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. + * Resource display localized name. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - skiptoken?: string; -} - -/** - * An interface representing AzureReservationAPIOptions. - */ -export interface AzureReservationAPIOptions extends AzureServiceClientOptions { - baseUri?: string; + readonly localizedValue?: string; } -/** - * Defines headers for Post operation. - */ -export interface CalculateExchangePostHeaders { - /** - * 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; +/** The API error. */ +export interface ExceptionResponse { + /** The API error details. */ + error?: ServiceError; } -/** - * Defines headers for Post operation. - */ -export interface ExchangePostHeaders { - /** - * 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; +/** The API error details. */ +export interface ServiceError { + /** The error code. */ + code?: string; + /** The error message text. */ + message?: string; /** - * Clients should wait for the Retry-After interval before polling again + * The list of error details. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - retryAfter: number; + readonly details?: ServiceErrorDetail[]; } -/** - * Defines headers for Get operation. - */ -export interface QuotaGetHeaders { +/** The error details. */ +export interface ServiceErrorDetail { /** - * Current entity state version. It should be treated as opaque and used to make conditional HTTP - * requests. + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - eTag: string; -} - -/** - * Defines headers for List operation. - */ -export interface QuotaListHeaders { + readonly code?: string; /** - * Current entity state version. Should be treated as opaque and used to make conditional HTTP - * requests. + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - eTag: string; + readonly message?: string; } -/** - * @interface - * An interface representing the ReservationList. - * @extends Array - */ -export interface ReservationList extends Array { +/** Response for the quota submission request. */ +export interface QuotaRequestOneResourceSubmitResponse { /** - * Url to get the next page of reservations. + * The quota request ID. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - nextLink?: string; -} - -/** - * @interface - * An interface representing the ReservationOrderList. - * @extends Array - */ -export interface ReservationOrderList extends Array { + readonly id?: string; /** - * Url to get the next page of reservationOrders. + * The name of the quota request. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - nextLink?: string; -} - -/** - * @interface - * An interface representing the OperationList. - * @extends Array - */ -export interface OperationList extends Array { + readonly name?: string; /** - * Url to get the next page of items. + * Type of resource. "Microsoft.Capacity/ServiceLimits" + * NOTE: This property will not be serialized. It can only be populated by the server. */ - nextLink?: string; -} - -/** - * @interface - * Quota limits. - * @extends Array - */ -export interface QuotaLimits extends Array { + readonly type?: string; /** - * The URI for fetching the next page of quotas (service limits). When no more pages exist, the - * value is null. + * The quota request status. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - nextLink?: string; -} - -/** - * @interface - * Quota request details. - * @extends Array - */ -export interface QuotaRequestDetailsList extends Array { + readonly provisioningState?: QuotaRequestState; /** - * The URI to fetch the next page of quota limits. When there are no more pages, this is null. - */ - nextLink?: string; -} - -/** - * Defines values for ReservedResourceType. - * Possible values include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', - * 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', 'Databricks', 'AppService', 'ManagedDisk', - * 'BlockBlob', 'RedisCache', 'AzureDataExplorer', 'MySql', 'MariaDb', 'PostgreSql', - * 'DedicatedHost', 'SapHana', 'SqlAzureHybridBenefit' - * @readonly - * @enum {string} - */ -export type ReservedResourceType = 'VirtualMachines' | 'SqlDatabases' | 'SuseLinux' | 'CosmosDb' | 'RedHat' | 'SqlDataWarehouse' | 'VMwareCloudSimple' | 'RedHatOsa' | 'Databricks' | 'AppService' | 'ManagedDisk' | 'BlockBlob' | 'RedisCache' | 'AzureDataExplorer' | 'MySql' | 'MariaDb' | 'PostgreSql' | 'DedicatedHost' | 'SapHana' | 'SqlAzureHybridBenefit'; - -/** - * Defines values for ReservationTerm. - * Possible values include: 'P1Y', 'P3Y' - * @readonly - * @enum {string} - */ -export type ReservationTerm = 'P1Y' | 'P3Y'; - -/** - * Defines values for ReservationBillingPlan. - * Possible values include: 'Upfront', 'Monthly' - * @readonly - * @enum {string} - */ -export type ReservationBillingPlan = 'Upfront' | 'Monthly'; - -/** - * Defines values for AppliedScopeType. - * Possible values include: 'Single', 'Shared' - * @readonly - * @enum {string} - */ -export type AppliedScopeType = 'Single' | 'Shared'; - -/** - * Defines values for InstanceFlexibility. - * Possible values include: 'On', 'Off' - * @readonly - * @enum {string} - */ -export type InstanceFlexibility = 'On' | 'Off'; - -/** - * Defines values for ReservationStatusCode. - * Possible values include: 'None', 'Pending', 'Active', 'PurchaseError', 'PaymentInstrumentError', - * 'Split', 'Merged', 'Expired', 'Succeeded' - * @readonly - * @enum {string} - */ -export type ReservationStatusCode = 'None' | 'Pending' | 'Active' | 'PurchaseError' | 'PaymentInstrumentError' | 'Split' | 'Merged' | 'Expired' | 'Succeeded'; - -/** - * Defines values for ErrorResponseCode. - * Possible values include: 'NotSpecified', 'InternalServerError', 'ServerTimeout', - * 'AuthorizationFailed', 'BadRequest', 'ClientCertificateThumbprintNotSet', - * 'InvalidRequestContent', 'OperationFailed', 'HttpMethodNotSupported', 'InvalidRequestUri', - * 'MissingTenantId', 'InvalidTenantId', 'InvalidReservationOrderId', 'InvalidReservationId', - * 'ReservationIdNotInReservationOrder', 'ReservationOrderNotFound', 'InvalidSubscriptionId', - * 'InvalidAccessToken', 'InvalidLocationId', 'UnauthenticatedRequestsThrottled', - * 'InvalidHealthCheckType', 'Forbidden', 'BillingScopeIdCannotBeChanged', - * 'AppliedScopesNotAssociatedWithCommerceAccount', 'PatchValuesSameAsExisting', - * 'RoleAssignmentCreationFailed', 'ReservationOrderCreationFailed', 'ReservationOrderNotEnabled', - * 'CapacityUpdateScopesFailed', 'UnsupportedReservationTerm', 'ReservationOrderIdAlreadyExists', - * 'RiskCheckFailed', 'CreateQuoteFailed', 'ActivateQuoteFailed', 'NonsupportedAccountId', - * 'PaymentInstrumentNotFound', 'MissingAppliedScopesForSingle', 'NoValidReservationsToReRate', - * 'ReRateOnlyAllowedForEA', 'OperationCannotBePerformedInCurrentState', - * 'InvalidSingleAppliedScopesCount', 'InvalidFulfillmentRequestParameters', 'NotSupportedCountry', - * 'InvalidRefundQuantity', 'PurchaseError', 'BillingCustomerInputError', - * 'BillingPaymentInstrumentSoftError', 'BillingPaymentInstrumentHardError', - * 'BillingTransientError', 'BillingError', 'FulfillmentConfigurationError', - * 'FulfillmentOutOfStockError', 'FulfillmentTransientError', 'FulfillmentError', - * 'CalculatePriceFailed' - * @readonly - * @enum {string} - */ -export type ErrorResponseCode = 'NotSpecified' | 'InternalServerError' | 'ServerTimeout' | 'AuthorizationFailed' | 'BadRequest' | 'ClientCertificateThumbprintNotSet' | 'InvalidRequestContent' | 'OperationFailed' | 'HttpMethodNotSupported' | 'InvalidRequestUri' | 'MissingTenantId' | 'InvalidTenantId' | 'InvalidReservationOrderId' | 'InvalidReservationId' | 'ReservationIdNotInReservationOrder' | 'ReservationOrderNotFound' | 'InvalidSubscriptionId' | 'InvalidAccessToken' | 'InvalidLocationId' | 'UnauthenticatedRequestsThrottled' | 'InvalidHealthCheckType' | 'Forbidden' | 'BillingScopeIdCannotBeChanged' | 'AppliedScopesNotAssociatedWithCommerceAccount' | 'PatchValuesSameAsExisting' | 'RoleAssignmentCreationFailed' | 'ReservationOrderCreationFailed' | 'ReservationOrderNotEnabled' | 'CapacityUpdateScopesFailed' | 'UnsupportedReservationTerm' | 'ReservationOrderIdAlreadyExists' | 'RiskCheckFailed' | 'CreateQuoteFailed' | 'ActivateQuoteFailed' | 'NonsupportedAccountId' | 'PaymentInstrumentNotFound' | 'MissingAppliedScopesForSingle' | 'NoValidReservationsToReRate' | 'ReRateOnlyAllowedForEA' | 'OperationCannotBePerformedInCurrentState' | 'InvalidSingleAppliedScopesCount' | 'InvalidFulfillmentRequestParameters' | 'NotSupportedCountry' | 'InvalidRefundQuantity' | 'PurchaseError' | 'BillingCustomerInputError' | 'BillingPaymentInstrumentSoftError' | 'BillingPaymentInstrumentHardError' | 'BillingTransientError' | 'BillingError' | 'FulfillmentConfigurationError' | 'FulfillmentOutOfStockError' | 'FulfillmentTransientError' | 'FulfillmentError' | 'CalculatePriceFailed'; - -/** - * Defines values for CalculateExchangeOperationResultStatus. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' - * @readonly - * @enum {string} - */ -export type CalculateExchangeOperationResultStatus = 'Succeeded' | 'Failed' | 'Cancelled' | 'Pending'; - -/** - * Defines values for ExchangeOperationResultStatus. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'PendingRefunds', - * 'PendingPurchases' - * @readonly - * @enum {string} - */ -export type ExchangeOperationResultStatus = 'Succeeded' | 'Failed' | 'Cancelled' | 'PendingRefunds' | 'PendingPurchases'; - -/** - * Defines values for OperationStatus. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' - * @readonly - * @enum {string} - */ -export type OperationStatus = 'Succeeded' | 'Failed' | 'Cancelled' | 'Pending'; - -/** - * Defines values for PaymentStatus. - * Possible values include: 'Succeeded', 'Failed', 'Scheduled', 'Cancelled' - * @readonly - * @enum {string} - */ -export type PaymentStatus = 'Succeeded' | 'Failed' | 'Scheduled' | 'Cancelled'; - -/** - * Contains response data for the availableScopes operation. - */ -export type ReservationAvailableScopesResponse = AvailableScopeProperties & { + * User friendly status message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; /** - * The underlying HTTP response. + * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: AvailableScopeProperties; - }; -}; + readonly requestSubmitTime?: Date; + /** Quota properties for the resource. */ + properties?: QuotaProperties; +} -/** - * Contains response data for the split operation. - */ -export type ReservationSplitResponse = Array & { +/** Response with request ID that the quota request was accepted. */ +export interface QuotaRequestSubmitResponse201 { /** - * The underlying HTTP response. + * The quota request ID. Use the requestId parameter to check the request status. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse[]; - }; -}; - -/** - * Contains response data for the merge operation. - */ -export type ReservationMergeResponse = Array & { + readonly id?: string; /** - * The underlying HTTP response. + * Operation ID + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse[]; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type ReservationListResponse = ReservationList & { + readonly name?: string; /** - * The underlying HTTP response. + * Resource type + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationList; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type ReservationGetResponse = ReservationResponse & { + readonly type?: string; /** - * The underlying HTTP response. + * The details of the quota request status. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type ReservationUpdateResponse = ReservationResponse & { + readonly provisioningState?: QuotaRequestState; /** - * The underlying HTTP response. + * A user friendly message. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + readonly message?: string; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse; - }; -}; +/** Quota limits. */ +export interface QuotaLimits { + /** List of quotas (service limits). */ + value?: CurrentQuotaLimitBase[]; + /** The URI for fetching the next page of quotas (service limits). When no more pages exist, the value is null. */ + nextLink?: string; +} -/** - * Contains response data for the listRevisions operation. - */ -export type ReservationListRevisionsResponse = ReservationList & { +/** Quota request details. */ +export interface QuotaRequestDetails { /** - * The underlying HTTP response. + * Quota request ID. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationList; - }; -}; - -/** - * Contains response data for the beginAvailableScopes operation. - */ -export type ReservationBeginAvailableScopesResponse = AvailableScopeProperties & { + readonly id?: string; /** - * The underlying HTTP response. + * Quota request name. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: AvailableScopeProperties; - }; -}; - -/** - * Contains response data for the beginSplit operation. - */ -export type ReservationBeginSplitResponse = Array & { + readonly name?: string; /** - * The underlying HTTP response. + * Resource type + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse[]; - }; -}; - -/** - * Contains response data for the beginMerge operation. - */ -export type ReservationBeginMergeResponse = Array & { + readonly type?: string; + /** The quota request status. */ + provisioningState?: QuotaRequestState; /** - * The underlying HTTP response. + * User friendly status message. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse[]; - }; -}; - -/** - * Contains response data for the beginUpdate operation. - */ -export type ReservationBeginUpdateResponse = ReservationResponse & { + readonly message?: string; /** - * The underlying HTTP response. + * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse; - }; -}; + readonly requestSubmitTime?: Date; + /** The quotaRequests. */ + value?: SubRequest[]; +} -/** - * Contains response data for the listNext operation. - */ -export type ReservationListNextResponse = ReservationList & { +/** The details of quota request. */ +export interface QuotaRequestProperties { + /** The quota request status. */ + provisioningState?: QuotaRequestState; /** - * The underlying HTTP response. + * User friendly status message. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationList; - }; -}; - -/** - * Contains response data for the listRevisionsNext operation. - */ -export type ReservationListRevisionsNextResponse = ReservationList & { + readonly message?: string; /** - * The underlying HTTP response. + * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationList; - }; -}; + readonly requestSubmitTime?: Date; + /** The quotaRequests. */ + value?: SubRequest[]; +} -/** - * Contains response data for the getCatalog operation. - */ -export type GetCatalogResponse = Array & { +/** The sub-request submitted with the quota request. */ +export interface SubRequest { /** - * The underlying HTTP response. + * Quota (resource limit). + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Catalog[]; - }; -}; - -/** - * Contains response data for the getAppliedReservationList operation. - */ -export type GetAppliedReservationListResponse = AppliedReservations & { + readonly limit?: number; + /** The resource name. */ + name?: ResourceName; /** - * The underlying HTTP response. + * Resource type for which the quota check was made. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: AppliedReservations; - }; -}; - -/** - * Contains response data for the calculate operation. - */ -export type ReservationOrderCalculateResponse = CalculatePriceResponse & { + readonly resourceType?: string; + /** The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota operation. */ + unit?: string; + /** The quota request status. */ + provisioningState?: QuotaRequestState; /** - * The underlying HTTP response. + * User-friendly status message. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CalculatePriceResponse; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type ReservationOrderListResponse = ReservationOrderList & { + readonly message?: string; /** - * The underlying HTTP response. + * Sub request ID for individual request. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + readonly subRequestId?: string; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderList; - }; -}; +/** Quota request details. */ +export interface QuotaRequestDetailsList { + /** The quota requests. */ + value?: QuotaRequestDetails[]; + /** The URI to fetch the next page of quota limits. When there are no more pages, this is null. */ + nextLink?: string; +} -/** - * Contains response data for the purchase operation. - */ -export type ReservationOrderPurchaseResponse = ReservationOrderResponse & { +/** Current quota limits. */ +export interface CurrentQuotaLimit { /** - * The underlying HTTP response. + * The details of the quota request status. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderResponse; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type ReservationOrderGetResponse = ReservationOrderResponse & { + readonly provisioningState?: QuotaRequestState; /** - * The underlying HTTP response. + * A user friendly message. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + readonly message?: string; + /** Quota properties for the resource. */ + properties?: QuotaProperties; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderResponse; - }; -}; +/** Quotas (service limits) in the request response. */ +export interface QuotaLimitsResponse { + /** List of quotas with the quota request status. */ + value?: CurrentQuotaLimit[]; + /** The URI for fetching the next page of quota limits. When no more pages exist, the value is null. */ + nextLink?: string; +} -/** - * Contains response data for the beginPurchase operation. - */ -export type ReservationOrderBeginPurchaseResponse = ReservationOrderResponse & { +/** Quota change requests information. */ +export interface CreateGenericQuotaRequestParameters { + /** Quota change requests. */ + value?: CurrentQuotaLimitBase[]; +} + +/** Response for the quota submission request. */ +export interface QuotaRequestSubmitResponse { /** - * The underlying HTTP response. + * The quota request ID. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderResponse; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type ReservationOrderListNextResponse = ReservationOrderList & { + readonly id?: string; /** - * The underlying HTTP response. + * The name of the quota request. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderList; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type OperationListResponse = OperationList & { + readonly name?: string; + /** The quota request details. */ + properties?: QuotaRequestProperties; /** - * The underlying HTTP response. + * Type of resource. "Microsoft.Capacity/serviceLimits" + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + readonly type?: string; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationList; - }; -}; +/** Defines headers for CalculateExchange_post operation. */ +export interface CalculateExchangePostHeaders { + /** 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; +} -/** - * Contains response data for the listNext operation. - */ -export type OperationListNextResponse = OperationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Defines headers for Exchange_post operation. */ +export interface ExchangePostHeaders { + /** 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; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationList; - }; -}; +/** Defines headers for Quota_get operation. */ +export interface QuotaGetHeaders { + /** Current entity state version. It should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} -/** - * Contains response data for the post operation. - */ -export type CalculateExchangePostResponse = CalculateExchangeOperationResultResponse & CalculateExchangePostHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CalculateExchangePostHeaders; +/** Defines headers for Quota_list operation. */ +export interface QuotaListHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Quota_listNext operation. */ +export interface QuotaListNextHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Known values of {@link ErrorResponseCode} that the service accepts. */ +export enum KnownErrorResponseCode { + NotSpecified = "NotSpecified", + InternalServerError = "InternalServerError", + ServerTimeout = "ServerTimeout", + AuthorizationFailed = "AuthorizationFailed", + BadRequest = "BadRequest", + ClientCertificateThumbprintNotSet = "ClientCertificateThumbprintNotSet", + InvalidRequestContent = "InvalidRequestContent", + OperationFailed = "OperationFailed", + HttpMethodNotSupported = "HttpMethodNotSupported", + InvalidRequestUri = "InvalidRequestUri", + MissingTenantId = "MissingTenantId", + InvalidTenantId = "InvalidTenantId", + InvalidReservationOrderId = "InvalidReservationOrderId", + InvalidReservationId = "InvalidReservationId", + ReservationIdNotInReservationOrder = "ReservationIdNotInReservationOrder", + ReservationOrderNotFound = "ReservationOrderNotFound", + InvalidSubscriptionId = "InvalidSubscriptionId", + InvalidAccessToken = "InvalidAccessToken", + InvalidLocationId = "InvalidLocationId", + UnauthenticatedRequestsThrottled = "UnauthenticatedRequestsThrottled", + InvalidHealthCheckType = "InvalidHealthCheckType", + Forbidden = "Forbidden", + BillingScopeIdCannotBeChanged = "BillingScopeIdCannotBeChanged", + AppliedScopesNotAssociatedWithCommerceAccount = "AppliedScopesNotAssociatedWithCommerceAccount", + PatchValuesSameAsExisting = "PatchValuesSameAsExisting", + RoleAssignmentCreationFailed = "RoleAssignmentCreationFailed", + ReservationOrderCreationFailed = "ReservationOrderCreationFailed", + ReservationOrderNotEnabled = "ReservationOrderNotEnabled", + CapacityUpdateScopesFailed = "CapacityUpdateScopesFailed", + UnsupportedReservationTerm = "UnsupportedReservationTerm", + ReservationOrderIdAlreadyExists = "ReservationOrderIdAlreadyExists", + RiskCheckFailed = "RiskCheckFailed", + CreateQuoteFailed = "CreateQuoteFailed", + ActivateQuoteFailed = "ActivateQuoteFailed", + NonsupportedAccountId = "NonsupportedAccountId", + PaymentInstrumentNotFound = "PaymentInstrumentNotFound", + MissingAppliedScopesForSingle = "MissingAppliedScopesForSingle", + NoValidReservationsToReRate = "NoValidReservationsToReRate", + ReRateOnlyAllowedForEA = "ReRateOnlyAllowedForEA", + OperationCannotBePerformedInCurrentState = "OperationCannotBePerformedInCurrentState", + InvalidSingleAppliedScopesCount = "InvalidSingleAppliedScopesCount", + InvalidFulfillmentRequestParameters = "InvalidFulfillmentRequestParameters", + NotSupportedCountry = "NotSupportedCountry", + InvalidRefundQuantity = "InvalidRefundQuantity", + PurchaseError = "PurchaseError", + BillingCustomerInputError = "BillingCustomerInputError", + BillingPaymentInstrumentSoftError = "BillingPaymentInstrumentSoftError", + BillingPaymentInstrumentHardError = "BillingPaymentInstrumentHardError", + BillingTransientError = "BillingTransientError", + BillingError = "BillingError", + FulfillmentConfigurationError = "FulfillmentConfigurationError", + FulfillmentOutOfStockError = "FulfillmentOutOfStockError", + FulfillmentTransientError = "FulfillmentTransientError", + FulfillmentError = "FulfillmentError", + CalculatePriceFailed = "CalculatePriceFailed", + AppliedScopesSameAsExisting = "AppliedScopesSameAsExisting" +} + +/** + * Defines values for ErrorResponseCode. \ + * {@link KnownErrorResponseCode} can be used interchangeably with ErrorResponseCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotSpecified** \ + * **InternalServerError** \ + * **ServerTimeout** \ + * **AuthorizationFailed** \ + * **BadRequest** \ + * **ClientCertificateThumbprintNotSet** \ + * **InvalidRequestContent** \ + * **OperationFailed** \ + * **HttpMethodNotSupported** \ + * **InvalidRequestUri** \ + * **MissingTenantId** \ + * **InvalidTenantId** \ + * **InvalidReservationOrderId** \ + * **InvalidReservationId** \ + * **ReservationIdNotInReservationOrder** \ + * **ReservationOrderNotFound** \ + * **InvalidSubscriptionId** \ + * **InvalidAccessToken** \ + * **InvalidLocationId** \ + * **UnauthenticatedRequestsThrottled** \ + * **InvalidHealthCheckType** \ + * **Forbidden** \ + * **BillingScopeIdCannotBeChanged** \ + * **AppliedScopesNotAssociatedWithCommerceAccount** \ + * **PatchValuesSameAsExisting** \ + * **RoleAssignmentCreationFailed** \ + * **ReservationOrderCreationFailed** \ + * **ReservationOrderNotEnabled** \ + * **CapacityUpdateScopesFailed** \ + * **UnsupportedReservationTerm** \ + * **ReservationOrderIdAlreadyExists** \ + * **RiskCheckFailed** \ + * **CreateQuoteFailed** \ + * **ActivateQuoteFailed** \ + * **NonsupportedAccountId** \ + * **PaymentInstrumentNotFound** \ + * **MissingAppliedScopesForSingle** \ + * **NoValidReservationsToReRate** \ + * **ReRateOnlyAllowedForEA** \ + * **OperationCannotBePerformedInCurrentState** \ + * **InvalidSingleAppliedScopesCount** \ + * **InvalidFulfillmentRequestParameters** \ + * **NotSupportedCountry** \ + * **InvalidRefundQuantity** \ + * **PurchaseError** \ + * **BillingCustomerInputError** \ + * **BillingPaymentInstrumentSoftError** \ + * **BillingPaymentInstrumentHardError** \ + * **BillingTransientError** \ + * **BillingError** \ + * **FulfillmentConfigurationError** \ + * **FulfillmentOutOfStockError** \ + * **FulfillmentTransientError** \ + * **FulfillmentError** \ + * **CalculatePriceFailed** \ + * **AppliedScopesSameAsExisting** + */ +export type ErrorResponseCode = string; + +/** Known values of {@link ReservationBillingPlan} that the service accepts. */ +export enum KnownReservationBillingPlan { + Upfront = "Upfront", + Monthly = "Monthly" +} + +/** + * Defines values for ReservationBillingPlan. \ + * {@link KnownReservationBillingPlan} can be used interchangeably with ReservationBillingPlan, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Upfront** \ + * **Monthly** + */ +export type ReservationBillingPlan = string; + +/** Known values of {@link ReservationTerm} that the service accepts. */ +export enum KnownReservationTerm { + P1Y = "P1Y", + P3Y = "P3Y", + P5Y = "P5Y" +} + +/** + * Defines values for ReservationTerm. \ + * {@link KnownReservationTerm} can be used interchangeably with ReservationTerm, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1Y** \ + * **P3Y** \ + * **P5Y** + */ +export type ReservationTerm = string; + +/** Known values of {@link ReservedResourceType} that the service accepts. */ +export enum KnownReservedResourceType { + VirtualMachines = "VirtualMachines", + SqlDatabases = "SqlDatabases", + SuseLinux = "SuseLinux", + CosmosDb = "CosmosDb", + RedHat = "RedHat", + SqlDataWarehouse = "SqlDataWarehouse", + VMwareCloudSimple = "VMwareCloudSimple", + RedHatOsa = "RedHatOsa", + Databricks = "Databricks", + AppService = "AppService", + ManagedDisk = "ManagedDisk", + BlockBlob = "BlockBlob", + RedisCache = "RedisCache", + AzureDataExplorer = "AzureDataExplorer", + MySql = "MySql", + MariaDb = "MariaDb", + PostgreSql = "PostgreSql", + DedicatedHost = "DedicatedHost", + SapHana = "SapHana", + SqlAzureHybridBenefit = "SqlAzureHybridBenefit", + AVS = "AVS", + DataFactory = "DataFactory", + NetAppStorage = "NetAppStorage", + AzureFiles = "AzureFiles", + SqlEdge = "SqlEdge" +} + +/** + * Defines values for ReservedResourceType. \ + * {@link KnownReservedResourceType} can be used interchangeably with ReservedResourceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **VirtualMachines** \ + * **SqlDatabases** \ + * **SuseLinux** \ + * **CosmosDb** \ + * **RedHat** \ + * **SqlDataWarehouse** \ + * **VMwareCloudSimple** \ + * **RedHatOsa** \ + * **Databricks** \ + * **AppService** \ + * **ManagedDisk** \ + * **BlockBlob** \ + * **RedisCache** \ + * **AzureDataExplorer** \ + * **MySql** \ + * **MariaDb** \ + * **PostgreSql** \ + * **DedicatedHost** \ + * **SapHana** \ + * **SqlAzureHybridBenefit** \ + * **AVS** \ + * **DataFactory** \ + * **NetAppStorage** \ + * **AzureFiles** \ + * **SqlEdge** + */ +export type ReservedResourceType = string; + +/** Known values of {@link AppliedScopeType} that the service accepts. */ +export enum KnownAppliedScopeType { + Single = "Single", + Shared = "Shared" +} + +/** + * Defines values for AppliedScopeType. \ + * {@link KnownAppliedScopeType} can be used interchangeably with AppliedScopeType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Single** \ + * **Shared** + */ +export type AppliedScopeType = string; + +/** Known values of {@link InstanceFlexibility} that the service accepts. */ +export enum KnownInstanceFlexibility { + On = "On", + Off = "Off" +} + +/** + * Defines values for InstanceFlexibility. \ + * {@link KnownInstanceFlexibility} can be used interchangeably with InstanceFlexibility, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **On** \ + * **Off** + */ +export type InstanceFlexibility = string; + +/** Known values of {@link PaymentStatus} that the service accepts. */ +export enum KnownPaymentStatus { + Succeeded = "Succeeded", + Failed = "Failed", + Scheduled = "Scheduled", + Cancelled = "Cancelled" +} + +/** + * Defines values for PaymentStatus. \ + * {@link KnownPaymentStatus} can be used interchangeably with PaymentStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Scheduled** \ + * **Cancelled** + */ +export type PaymentStatus = string; + +/** Known values of {@link ReservationStatusCode} that the service accepts. */ +export enum KnownReservationStatusCode { + None = "None", + Pending = "Pending", + Active = "Active", + PurchaseError = "PurchaseError", + PaymentInstrumentError = "PaymentInstrumentError", + Split = "Split", + Merged = "Merged", + Expired = "Expired", + Succeeded = "Succeeded" +} + +/** + * Defines values for ReservationStatusCode. \ + * {@link KnownReservationStatusCode} can be used interchangeably with ReservationStatusCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Pending** \ + * **Active** \ + * **PurchaseError** \ + * **PaymentInstrumentError** \ + * **Split** \ + * **Merged** \ + * **Expired** \ + * **Succeeded** + */ +export type ReservationStatusCode = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Creating = "Creating", + PendingResourceHold = "PendingResourceHold", + ConfirmedResourceHold = "ConfirmedResourceHold", + PendingBilling = "PendingBilling", + ConfirmedBilling = "ConfirmedBilling", + Created = "Created", + Succeeded = "Succeeded", + Cancelled = "Cancelled", + Expired = "Expired", + BillingFailed = "BillingFailed", + Failed = "Failed", + Split = "Split", + Merged = "Merged" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Creating** \ + * **PendingResourceHold** \ + * **ConfirmedResourceHold** \ + * **PendingBilling** \ + * **ConfirmedBilling** \ + * **Created** \ + * **Succeeded** \ + * **Cancelled** \ + * **Expired** \ + * **BillingFailed** \ + * **Failed** \ + * **Split** \ + * **Merged** + */ +export type ProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link CalculateExchangeOperationResultStatus} that the service accepts. */ +export enum KnownCalculateExchangeOperationResultStatus { + Succeeded = "Succeeded", + Failed = "Failed", + Cancelled = "Cancelled", + Pending = "Pending" +} + +/** + * Defines values for CalculateExchangeOperationResultStatus. \ + * {@link KnownCalculateExchangeOperationResultStatus} can be used interchangeably with CalculateExchangeOperationResultStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Cancelled** \ + * **Pending** + */ +export type CalculateExchangeOperationResultStatus = string; + +/** Known values of {@link ExchangeOperationResultStatus} that the service accepts. */ +export enum KnownExchangeOperationResultStatus { + Succeeded = "Succeeded", + Failed = "Failed", + Cancelled = "Cancelled", + PendingRefunds = "PendingRefunds", + PendingPurchases = "PendingPurchases" +} + +/** + * Defines values for ExchangeOperationResultStatus. \ + * {@link KnownExchangeOperationResultStatus} can be used interchangeably with ExchangeOperationResultStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Cancelled** \ + * **PendingRefunds** \ + * **PendingPurchases** + */ +export type ExchangeOperationResultStatus = string; + +/** Known values of {@link OperationStatus} that the service accepts. */ +export enum KnownOperationStatus { + Succeeded = "Succeeded", + Failed = "Failed", + Cancelled = "Cancelled", + Pending = "Pending" +} + +/** + * Defines values for OperationStatus. \ + * {@link KnownOperationStatus} can be used interchangeably with OperationStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Cancelled** \ + * **Pending** + */ +export type OperationStatus = string; + +/** Known values of {@link ResourceType} that the service accepts. */ +export enum KnownResourceType { + Standard = "standard", + Dedicated = "dedicated", + LowPriority = "lowPriority", + Shared = "shared", + ServiceSpecific = "serviceSpecific" +} + +/** + * Defines values for ResourceType. \ + * {@link KnownResourceType} can be used interchangeably with ResourceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **standard** \ + * **dedicated** \ + * **lowPriority** \ + * **shared** \ + * **serviceSpecific** + */ +export type ResourceType = string; + +/** Known values of {@link QuotaRequestState} that the service accepts. */ +export enum KnownQuotaRequestState { + Accepted = "Accepted", + Invalid = "Invalid", + Succeeded = "Succeeded", + Failed = "Failed", + InProgress = "InProgress" +} + +/** + * Defines values for QuotaRequestState. \ + * {@link KnownQuotaRequestState} can be used interchangeably with QuotaRequestState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted** \ + * **Invalid** \ + * **Succeeded** \ + * **Failed** \ + * **InProgress** + */ +export type QuotaRequestState = string; + +/** Known values of {@link Location} that the service accepts. */ +export enum KnownLocation { + Westus = "westus", + Eastus = "eastus", + Eastus2 = "eastus2", + Northcentralus = "northcentralus", + Westus2 = "westus2", + Southcentralus = "southcentralus", + Centralus = "centralus", + Westeurope = "westeurope", + Northeurope = "northeurope", + Eastasia = "eastasia", + Southeastasia = "southeastasia", + Japaneast = "japaneast", + Japanwest = "japanwest", + Brazilsouth = "brazilsouth", + Australiaeast = "australiaeast", + Australiasoutheast = "australiasoutheast", + Southindia = "southindia", + Westindia = "westindia", + Centralindia = "centralindia", + Canadacentral = "canadacentral", + Canadaeast = "canadaeast", + Uksouth = "uksouth", + Westcentralus = "westcentralus", + Ukwest = "ukwest" +} + +/** + * Defines values for Location. \ + * {@link KnownLocation} can be used interchangeably with Location, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **westus** \ + * **eastus** \ + * **eastus2** \ + * **northcentralus** \ + * **westus2** \ + * **southcentralus** \ + * **centralus** \ + * **westeurope** \ + * **northeurope** \ + * **eastasia** \ + * **southeastasia** \ + * **japaneast** \ + * **japanwest** \ + * **brazilsouth** \ + * **australiaeast** \ + * **australiasoutheast** \ + * **southindia** \ + * **westindia** \ + * **centralindia** \ + * **canadacentral** \ + * **canadaeast** \ + * **uksouth** \ + * **westcentralus** \ + * **ukwest** + */ +export type Location = string; + +/** Known values of {@link DisplayProvisioningState} that the service accepts. */ +export enum KnownDisplayProvisioningState { + Succeeded = "Succeeded", + Expiring = "Expiring", + Expired = "Expired", + Pending = "Pending", + Cancelled = "Cancelled", + Failed = "Failed" +} + +/** + * Defines values for DisplayProvisioningState. \ + * {@link KnownDisplayProvisioningState} can be used interchangeably with DisplayProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Expiring** \ + * **Expired** \ + * **Pending** \ + * **Cancelled** \ + * **Failed** + */ +export type DisplayProvisioningState = string; + +/** Known values of {@link UserFriendlyAppliedScopeType} that the service accepts. */ +export enum KnownUserFriendlyAppliedScopeType { + None = "None", + Shared = "Shared", + Single = "Single", + ResourceGroup = "ResourceGroup", + ManagementGroup = "ManagementGroup" +} + +/** + * Defines values for UserFriendlyAppliedScopeType. \ + * {@link KnownUserFriendlyAppliedScopeType} can be used interchangeably with UserFriendlyAppliedScopeType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Shared** \ + * **Single** \ + * **ResourceGroup** \ + * **ManagementGroup** + */ +export type UserFriendlyAppliedScopeType = string; + +/** Known values of {@link UserFriendlyRenewState} that the service accepts. */ +export enum KnownUserFriendlyRenewState { + On = "On", + Off = "Off", + Renewed = "Renewed", + NotRenewed = "NotRenewed", + NotApplicable = "NotApplicable" +} + +/** + * Defines values for UserFriendlyRenewState. \ + * {@link KnownUserFriendlyRenewState} can be used interchangeably with UserFriendlyRenewState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **On** \ + * **Off** \ + * **Renewed** \ + * **NotRenewed** \ + * **NotApplicable** + */ +export type UserFriendlyRenewState = string; + +/** Optional parameters. */ +export interface ReservationAvailableScopesOptionalParams + 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 availableScopes operation. */ +export type ReservationAvailableScopesResponse = AvailableScopeProperties; + +/** Optional parameters. */ +export interface ReservationSplitOptionalParams + 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 split operation. */ +export type ReservationSplitResponse = ReservationResponse[]; + +/** Optional parameters. */ +export interface ReservationMergeOptionalParams + 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 merge operation. */ +export type ReservationMergeResponse = ReservationResponse[]; + +/** Optional parameters. */ +export interface ReservationListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ReservationListResponse = ReservationList; + +/** Optional parameters. */ +export interface ReservationGetOptionalParams + extends coreClient.OperationOptions { + /** Supported value of this query is renewProperties */ + expand?: string; +} - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the get operation. */ +export type ReservationGetResponse = ReservationResponse; - /** - * The response body as parsed JSON or XML - */ - parsedBody: CalculateExchangeOperationResultResponse; - }; -}; +/** Optional parameters. */ +export interface ReservationUpdateOptionalParams + 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 ExchangePostResponse = ExchangeOperationResultResponse & ExchangePostHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: ExchangePostHeaders; +/** Contains response data for the update operation. */ +export type ReservationUpdateResponse = ReservationResponse; - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface ReservationListRevisionsOptionalParams + extends coreClient.OperationOptions {} - /** - * The response body as parsed JSON or XML - */ - parsedBody: ExchangeOperationResultResponse; - }; -}; +/** Contains response data for the listRevisions operation. */ +export type ReservationListRevisionsResponse = ReservationList; -/** - * Contains response data for the get operation. - */ -export type QuotaGetResponse = CurrentQuotaLimitBase & QuotaGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: QuotaGetHeaders; +/** 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} */ + 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; +} + +/** Contains response data for the listAll operation. */ +export type ReservationListAllResponse = ReservationsListResult; + +/** Optional parameters. */ +export interface ReservationListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ReservationListNextResponse = ReservationList; + +/** Optional parameters. */ +export interface ReservationListRevisionsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listRevisionsNext operation. */ +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; +} + +/** Contains response data for the listAllNext operation. */ +export type ReservationListAllNextResponse = ReservationsListResult; + +/** Optional parameters. */ +export interface GetCatalogOptionalParams extends coreClient.OperationOptions { + /** 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 */ + location?: string; +} - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the getCatalog operation. */ +export type GetCatalogResponse = Catalog[]; - /** - * The response body as parsed JSON or XML - */ - parsedBody: CurrentQuotaLimitBase; - }; -}; +/** Optional parameters. */ +export interface GetAppliedReservationListOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the createOrUpdate operation. - */ -export type QuotaCreateOrUpdateResponse = { - /** - * The parsed response body. - */ - body: any; +/** Contains response data for the getAppliedReservationList operation. */ +export type GetAppliedReservationListResponse = AppliedReservations; - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface ReservationOrderCalculateOptionalParams + extends coreClient.OperationOptions {} - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +/** Contains response data for the calculate operation. */ +export type ReservationOrderCalculateResponse = CalculatePriceResponse; -/** - * Contains response data for the update operation. - */ -export type QuotaUpdateResponse = { - /** - * The parsed response body. - */ - body: any; +/** Optional parameters. */ +export interface ReservationOrderListOptionalParams + extends coreClient.OperationOptions {} - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the list operation. */ +export type ReservationOrderListResponse = ReservationOrderList; - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +/** Optional parameters. */ +export interface ReservationOrderPurchaseOptionalParams + 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 list operation. - */ -export type QuotaListResponse = QuotaLimits & QuotaListHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: QuotaListHeaders; +/** Contains response data for the purchase operation. */ +export type ReservationOrderPurchaseResponse = ReservationOrderResponse; - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface ReservationOrderGetOptionalParams + extends coreClient.OperationOptions { + /** May be used to expand the planInformation. */ + expand?: string; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: QuotaLimits; - }; -}; +/** Contains response data for the get operation. */ +export type ReservationOrderGetResponse = ReservationOrderResponse; -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type QuotaBeginCreateOrUpdateResponse = { - /** - * The parsed response body. - */ - body: any; +/** Optional parameters. */ +export interface ReservationOrderChangeDirectoryOptionalParams + extends coreClient.OperationOptions {} - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the changeDirectory operation. */ +export type ReservationOrderChangeDirectoryResponse = ChangeDirectoryResponse; - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +/** Optional parameters. */ +export interface ReservationOrderListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the beginUpdate operation. - */ -export type QuotaBeginUpdateResponse = { - /** - * The parsed response body. - */ - body: any; +/** Contains response data for the listNext operation. */ +export type ReservationOrderListNextResponse = ReservationOrderList; - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface OperationListOptionalParams + extends coreClient.OperationOptions {} - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +/** Contains response data for the list operation. */ +export type OperationListResponse = OperationList; -/** - * Contains response data for the get operation. - */ -export type QuotaRequestStatusGetResponse = QuotaRequestDetails & { +/** Optional parameters. */ +export interface OperationListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationListNextResponse = OperationList; + +/** Optional parameters. */ +export interface CalculateExchangePostOptionalParams + 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 CalculateExchangePostResponse = CalculateExchangeOperationResultResponse; + +/** Optional parameters. */ +export interface ExchangePostOptionalParams + 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 ExchangePostResponse = ExchangeOperationResultResponse; + +/** Optional parameters. */ +export interface QuotaGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type QuotaGetResponse = QuotaGetHeaders & CurrentQuotaLimitBase; + +/** Optional parameters. */ +export interface QuotaCreateOrUpdateOptionalParams + 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 createOrUpdate operation. */ +export type QuotaCreateOrUpdateResponse = QuotaRequestOneResourceSubmitResponse; + +/** Optional parameters. */ +export interface QuotaUpdateOptionalParams 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 update operation. */ +export type QuotaUpdateResponse = QuotaRequestOneResourceSubmitResponse; + +/** Optional parameters. */ +export interface QuotaListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type QuotaListResponse = QuotaListHeaders & QuotaLimits; + +/** Optional parameters. */ +export interface QuotaListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type QuotaListNextResponse = QuotaListNextHeaders & QuotaLimits; + +/** Optional parameters. */ +export interface QuotaRequestStatusGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type QuotaRequestStatusGetResponse = QuotaRequestDetails; + +/** Optional parameters. */ +export interface QuotaRequestStatusListOptionalParams + extends coreClient.OperationOptions { /** - * The underlying HTTP response. + * | Field | Supported operators + * |---------------------|------------------------ + * + * |requestSubmitTime | ge, le, eq, gt, lt + * */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + 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; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: QuotaRequestDetails; - }; -}; +/** Contains response data for the list operation. */ +export type QuotaRequestStatusListResponse = QuotaRequestDetailsList; -/** - * Contains response data for the list operation. - */ -export type QuotaRequestStatusListResponse = QuotaRequestDetailsList & { +/** Optional parameters. */ +export interface QuotaRequestStatusListNextOptionalParams + extends coreClient.OperationOptions { /** - * The underlying HTTP response. + * | Field | Supported operators + * |---------------------|------------------------ + * + * |requestSubmitTime | ge, le, eq, gt, lt + * */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + 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; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: QuotaRequestDetailsList; - }; -}; +/** Contains response data for the listNext operation. */ +export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList; -/** - * Contains response data for the listNext operation. - */ -export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: QuotaRequestDetailsList; - }; -}; +/** Optional parameters. */ +export interface AzureReservationAPIOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/reservations/arm-reservations/src/models/mappers.ts b/sdk/reservations/arm-reservations/src/models/mappers.ts index 8101745ae011..81339b6fe638 100644 --- a/sdk/reservations/arm-reservations/src/models/mappers.ts +++ b/sdk/reservations/arm-reservations/src/models/mappers.ts @@ -6,14 +6,25 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; +export const AvailableScopeRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AvailableScopeRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "AvailableScopeRequestProperties" + } + } + } + } +}; -export const AvailableScopeRequestProperties: msRest.CompositeMapper = { - serializedName: "AvailableScopeRequestProperties", +export const AvailableScopeRequestProperties: coreClient.CompositeMapper = { type: { name: "Composite", className: "AvailableScopeRequestProperties", @@ -33,118 +44,144 @@ export const AvailableScopeRequestProperties: msRest.CompositeMapper = { } }; -export const AvailableScopeRequest: msRest.CompositeMapper = { - serializedName: "AvailableScopeRequest", +export const AvailableScopeProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AvailableScopeRequest", + className: "AvailableScopeProperties", modelProperties: { properties: { serializedName: "properties", type: { name: "Composite", - className: "AvailableScopeRequestProperties" + className: "SubscriptionScopeProperties" } } } } }; -export const SkuName: msRest.CompositeMapper = { - serializedName: "SkuName", +export const SubscriptionScopeProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SkuName", + className: "SubscriptionScopeProperties", modelProperties: { - name: { - serializedName: "name", + scopes: { + serializedName: "scopes", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ScopeProperties" + } + } } } } } }; -export const PurchaseRequestPropertiesReservedResourceProperties: msRest.CompositeMapper = { - serializedName: "PurchaseRequestProperties_reservedResourceProperties", +export const ScopeProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PurchaseRequestPropertiesReservedResourceProperties", + className: "ScopeProperties", modelProperties: { - instanceFlexibility: { - serializedName: "instanceFlexibility", + scope: { + serializedName: "scope", type: { name: "String" } + }, + valid: { + serializedName: "valid", + type: { + name: "Boolean" + } } } } }; -export const PurchaseRequest: msRest.CompositeMapper = { - serializedName: "PurchaseRequest", +export const ErrorModel: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PurchaseRequest", + className: "ErrorModel", modelProperties: { - sku: { - serializedName: "sku", + error: { + serializedName: "error", type: { name: "Composite", - className: "SkuName" - } - }, - location: { - serializedName: "location", - type: { - name: "String" + className: "ExtendedErrorInfo" } - }, - reservedResourceType: { - serializedName: "properties.reservedResourceType", + } + } + } +}; + +export const ExtendedErrorInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExtendedErrorInfo", + modelProperties: { + code: { + serializedName: "code", type: { name: "String" } }, - billingScopeId: { - serializedName: "properties.billingScopeId", + message: { + serializedName: "message", type: { name: "String" } - }, - term: { - serializedName: "properties.term", + } + } + } +}; + +export const Catalog: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Catalog", + modelProperties: { + resourceType: { + serializedName: "resourceType", + readOnly: true, type: { name: "String" } }, - billingPlan: { - serializedName: "properties.billingPlan", + name: { + serializedName: "name", + readOnly: true, type: { name: "String" } }, - quantity: { - serializedName: "properties.quantity", - type: { - name: "Number" - } - }, - displayName: { - serializedName: "properties.displayName", + billingPlans: { + serializedName: "billingPlans", type: { - name: "String" + name: "Dictionary", + value: { + type: { name: "Sequence", element: { type: { name: "String" } } } + } } }, - appliedScopeType: { - serializedName: "properties.appliedScopeType", + terms: { + serializedName: "terms", + readOnly: true, type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "String" + } + } } }, - appliedScopes: { - serializedName: "properties.appliedScopes", + locations: { + serializedName: "locations", + readOnly: true, type: { name: "Sequence", element: { @@ -154,71 +191,62 @@ export const PurchaseRequest: msRest.CompositeMapper = { } } }, - renew: { - serializedName: "properties.renew", + skuProperties: { + serializedName: "skuProperties", + readOnly: true, type: { - name: "Boolean" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuProperty" + } + } } }, - reservedResourceProperties: { - serializedName: "properties.reservedResourceProperties", + msrp: { + serializedName: "msrp", type: { name: "Composite", - className: "PurchaseRequestPropertiesReservedResourceProperties" - } - } - } - } -}; - -export const ReservationToReturn: msRest.CompositeMapper = { - serializedName: "ReservationToReturn", - type: { - name: "Composite", - className: "ReservationToReturn", - modelProperties: { - reservationId: { - serializedName: "reservationId", - type: { - name: "String" + className: "CatalogMsrp" } }, - quantity: { - serializedName: "quantity", - type: { - name: "Number" - } - } - } - } -}; - -export const CalculateExchangeRequestProperties: msRest.CompositeMapper = { - serializedName: "CalculateExchangeRequestProperties", - type: { - name: "Composite", - className: "CalculateExchangeRequestProperties", - modelProperties: { - reservationsToPurchase: { - serializedName: "reservationsToPurchase", + restrictions: { + serializedName: "restrictions", + readOnly: true, type: { name: "Sequence", element: { type: { name: "Composite", - className: "PurchaseRequest" + className: "SkuRestriction" } } } }, - reservationsToExchange: { - serializedName: "reservationsToExchange", + tier: { + serializedName: "tier", + readOnly: true, + type: { + name: "String" + } + }, + size: { + serializedName: "size", + readOnly: true, + type: { + name: "String" + } + }, + capabilities: { + serializedName: "capabilities", + readOnly: true, type: { name: "Sequence", element: { type: { name: "Composite", - className: "ReservationToReturn" + className: "SkuCapability" } } } @@ -227,31 +255,19 @@ export const CalculateExchangeRequestProperties: msRest.CompositeMapper = { } }; -export const CalculateExchangeRequest: msRest.CompositeMapper = { - serializedName: "CalculateExchangeRequest", +export const SkuProperty: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CalculateExchangeRequest", + className: "SkuProperty", modelProperties: { - properties: { - serializedName: "properties", + name: { + serializedName: "name", type: { - name: "Composite", - className: "CalculateExchangeRequestProperties" + name: "String" } - } - } - } -}; - -export const ExchangeRequestProperties: msRest.CompositeMapper = { - serializedName: "ExchangeRequestProperties", - type: { - name: "Composite", - className: "ExchangeRequestProperties", - modelProperties: { - sessionId: { - serializedName: "sessionId", + }, + value: { + serializedName: "value", type: { name: "String" } @@ -260,25 +276,23 @@ export const ExchangeRequestProperties: msRest.CompositeMapper = { } }; -export const ExchangeRequest: msRest.CompositeMapper = { - serializedName: "ExchangeRequest", +export const CatalogMsrp: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExchangeRequest", + className: "CatalogMsrp", modelProperties: { - properties: { - serializedName: "properties", + p1Y: { + serializedName: "p1Y", type: { name: "Composite", - className: "ExchangeRequestProperties" + className: "Price" } } } } }; -export const Price: msRest.CompositeMapper = { - serializedName: "Price", +export const Price: coreClient.CompositeMapper = { type: { name: "Composite", className: "Price", @@ -299,111 +313,114 @@ export const Price: msRest.CompositeMapper = { } }; -export const ReservationToPurchaseCalculateExchange: msRest.CompositeMapper = { - serializedName: "ReservationToPurchaseCalculateExchange", +export const SkuRestriction: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationToPurchaseCalculateExchange", + className: "SkuRestriction", modelProperties: { - properties: { - serializedName: "properties", + type: { + serializedName: "type", type: { - name: "Composite", - className: "PurchaseRequest" + name: "String" } }, - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", + values: { + serializedName: "values", type: { - name: "Composite", - className: "Price" + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + reasonCode: { + serializedName: "reasonCode", + type: { + name: "String" } } } } }; -export const BillingInformation: msRest.CompositeMapper = { - serializedName: "BillingInformation", +export const SkuCapability: coreClient.CompositeMapper = { type: { name: "Composite", - className: "BillingInformation", + className: "SkuCapability", modelProperties: { - billingCurrencyTotalPaidAmount: { - serializedName: "billingCurrencyTotalPaidAmount", + name: { + serializedName: "name", type: { - name: "Composite", - className: "Price" + name: "String" } }, - billingCurrencyProratedAmount: { - serializedName: "billingCurrencyProratedAmount", - type: { - name: "Composite", - className: "Price" - } - }, - billingCurrencyRemainingCommitmentAmount: { - serializedName: "billingCurrencyRemainingCommitmentAmount", + value: { + serializedName: "value", type: { - name: "Composite", - className: "Price" + name: "String" } } } } }; -export const ReservationToExchange: msRest.CompositeMapper = { - serializedName: "ReservationToExchange", +export const AppliedReservations: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationToExchange", + className: "AppliedReservations", modelProperties: { - reservationId: { - serializedName: "reservationId", + id: { + serializedName: "id", + readOnly: true, type: { name: "String" } }, - quantity: { - serializedName: "quantity", + name: { + serializedName: "name", + readOnly: true, type: { - name: "Number" + name: "String" } }, - billingRefundAmount: { - serializedName: "billingRefundAmount", + type: { + serializedName: "type", + readOnly: true, type: { - name: "Composite", - className: "Price" + name: "String" } }, - billingInformation: { - serializedName: "billingInformation", + reservationOrderIds: { + serializedName: "properties.reservationOrderIds", type: { name: "Composite", - className: "BillingInformation" + className: "AppliedReservationList" } } } } }; -export const ExchangePolicyError: msRest.CompositeMapper = { - serializedName: "ExchangePolicyError", +export const AppliedReservationList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExchangePolicyError", + className: "AppliedReservationList", modelProperties: { - code: { - serializedName: "code", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "String" + } + } } }, - message: { - serializedName: "message", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -412,110 +429,102 @@ export const ExchangePolicyError: msRest.CompositeMapper = { } }; -export const ExchangePolicyErrors: msRest.CompositeMapper = { - serializedName: "ExchangePolicyErrors", +export const PurchaseRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExchangePolicyErrors", + className: "PurchaseRequest", modelProperties: { - policyErrors: { - serializedName: "policyErrors", + sku: { + serializedName: "sku", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExchangePolicyError" - } - } + name: "Composite", + className: "SkuName" } - } - } - } -}; - -export const CalculateExchangeResponseProperties: msRest.CompositeMapper = { - serializedName: "CalculateExchangeResponseProperties", - type: { - name: "Composite", - className: "CalculateExchangeResponseProperties", - modelProperties: { - sessionId: { - serializedName: "sessionId", + }, + location: { + serializedName: "location", type: { name: "String" } }, - netPayable: { - serializedName: "netPayable", + reservedResourceType: { + serializedName: "properties.reservedResourceType", type: { - name: "Composite", - className: "Price" + name: "String" } }, - refundsTotal: { - serializedName: "refundsTotal", + billingScopeId: { + serializedName: "properties.billingScopeId", type: { - name: "Composite", - className: "Price" + name: "String" } }, - purchasesTotal: { - serializedName: "purchasesTotal", + term: { + serializedName: "properties.term", type: { - name: "Composite", - className: "Price" + name: "String" } }, - reservationsToPurchase: { - serializedName: "reservationsToPurchase", + billingPlan: { + serializedName: "properties.billingPlan", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationToPurchaseCalculateExchange" - } - } + name: "String" } }, - reservationsToExchange: { - serializedName: "reservationsToExchange", + quantity: { + serializedName: "properties.quantity", + type: { + name: "Number" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + appliedScopes: { + serializedName: "properties.appliedScopes", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "ReservationToExchange" + name: "String" } } } }, - policyResult: { - serializedName: "policyResult", + renew: { + defaultValue: false, + serializedName: "properties.renew", + type: { + name: "Boolean" + } + }, + reservedResourceProperties: { + serializedName: "properties.reservedResourceProperties", type: { name: "Composite", - className: "ExchangePolicyErrors" + className: "PurchaseRequestPropertiesReservedResourceProperties" } } } } }; -export const OperationResultError: msRest.CompositeMapper = { - serializedName: "OperationResultError", +export const SkuName: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationResultError", + className: "SkuName", modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", + name: { + serializedName: "name", type: { name: "String" } @@ -524,256 +533,229 @@ export const OperationResultError: msRest.CompositeMapper = { } }; -export const CalculateExchangeOperationResultResponse: msRest.CompositeMapper = { - serializedName: "CalculateExchangeOperationResultResponse", +export const PurchaseRequestPropertiesReservedResourceProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CalculateExchangeOperationResultResponse", + className: "PurchaseRequestPropertiesReservedResourceProperties", modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - status: { - serializedName: "status", + instanceFlexibility: { + serializedName: "instanceFlexibility", type: { name: "String" } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "CalculateExchangeResponseProperties" - } - }, - error: { - serializedName: "error", - type: { - name: "Composite", - className: "OperationResultError" - } } } } }; -export const ReservationToPurchaseExchange: msRest.CompositeMapper = { - serializedName: "ReservationToPurchaseExchange", +export const CalculatePriceResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationToPurchaseExchange", + className: "CalculatePriceResponse", modelProperties: { - reservationOrderId: { - serializedName: "reservationOrderId", - type: { - name: "String" - } - }, - reservationId: { - serializedName: "reservationId", - type: { - name: "String" - } - }, properties: { serializedName: "properties", type: { name: "Composite", - className: "PurchaseRequest" - } - }, - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", - type: { - name: "Composite", - className: "Price" - } - }, - status: { - serializedName: "status", - type: { - name: "String" + className: "CalculatePriceResponseProperties" } } } } }; -export const ReservationToReturnForExchange: msRest.CompositeMapper = { - serializedName: "ReservationToReturnForExchange", +export const CalculatePriceResponseProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationToReturnForExchange", + className: "CalculatePriceResponseProperties", modelProperties: { - reservationId: { - serializedName: "reservationId", + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", type: { - name: "String" + name: "Composite", + className: "CalculatePriceResponsePropertiesBillingCurrencyTotal" } }, - quantity: { - serializedName: "quantity", + netTotal: { + serializedName: "netTotal", type: { name: "Number" } }, - billingRefundAmount: { - serializedName: "billingRefundAmount", + taxTotal: { + serializedName: "taxTotal", type: { - name: "Composite", - className: "Price" + name: "Number" } }, - billingInformation: { - serializedName: "billingInformation", + grandTotal: { + serializedName: "grandTotal", type: { - name: "Composite", - className: "BillingInformation" + name: "Number" } }, - status: { - serializedName: "status", + isTaxIncluded: { + serializedName: "isTaxIncluded", type: { - name: "String" + name: "Boolean" } - } - } - } -}; - -export const ExchangeResponseProperties: msRest.CompositeMapper = { - serializedName: "ExchangeResponseProperties", - type: { - name: "Composite", - className: "ExchangeResponseProperties", - modelProperties: { - sessionId: { - serializedName: "sessionId", + }, + isBillingPartnerManaged: { + serializedName: "isBillingPartnerManaged", + type: { + name: "Boolean" + } + }, + reservationOrderId: { + serializedName: "reservationOrderId", type: { name: "String" } }, - netPayable: { - serializedName: "netPayable", + skuTitle: { + serializedName: "skuTitle", type: { - name: "Composite", - className: "Price" + name: "String" } }, - refundsTotal: { - serializedName: "refundsTotal", + skuDescription: { + serializedName: "skuDescription", type: { - name: "Composite", - className: "Price" + name: "String" } }, - purchasesTotal: { - serializedName: "purchasesTotal", + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", type: { name: "Composite", - className: "Price" + className: "CalculatePriceResponsePropertiesPricingCurrencyTotal" } }, - reservationsToPurchase: { - serializedName: "reservationsToPurchase", + paymentSchedule: { + serializedName: "paymentSchedule", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ReservationToPurchaseExchange" + className: "PaymentDetail" } } } - }, - reservationsToExchange: { - serializedName: "reservationsToExchange", + } + } + } +}; + +export const CalculatePriceResponsePropertiesBillingCurrencyTotal: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculatePriceResponsePropertiesBillingCurrencyTotal", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationToReturnForExchange" - } - } + name: "String" } }, - policyResult: { - serializedName: "policyResult", + amount: { + serializedName: "amount", type: { - name: "Composite", - className: "ExchangePolicyErrors" + name: "Number" } } } } }; -export const ExchangeOperationResultResponse: msRest.CompositeMapper = { - serializedName: "ExchangeOperationResultResponse", +export const CalculatePriceResponsePropertiesPricingCurrencyTotal: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExchangeOperationResultResponse", + className: "CalculatePriceResponsePropertiesPricingCurrencyTotal", modelProperties: { - id: { - serializedName: "id", + currencyCode: { + serializedName: "currencyCode", type: { name: "String" } }, - name: { - serializedName: "name", + amount: { + serializedName: "amount", type: { - name: "String" + name: "Number" + } + } + } + } +}; + +export const PaymentDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PaymentDetail", + modelProperties: { + dueDate: { + serializedName: "dueDate", + type: { + name: "Date" } }, - status: { - serializedName: "status", + paymentDate: { + serializedName: "paymentDate", type: { - name: "String" + name: "Date" } }, - properties: { - serializedName: "properties", + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", type: { name: "Composite", - className: "ExchangeResponseProperties" + className: "Price" } }, - error: { - serializedName: "error", + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", type: { name: "Composite", - className: "OperationResultError" + className: "Price" + } + }, + billingAccount: { + serializedName: "billingAccount", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + extendedStatusInfo: { + serializedName: "extendedStatusInfo", + type: { + name: "Composite", + className: "ExtendedStatusInfo" } } } } }; -export const SkuProperty: msRest.CompositeMapper = { - serializedName: "SkuProperty", +export const ExtendedStatusInfo: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SkuProperty", + className: "ExtendedStatusInfo", modelProperties: { - name: { - serializedName: "name", + statusCode: { + serializedName: "statusCode", type: { name: "String" } }, - value: { - serializedName: "value", + message: { + serializedName: "message", type: { name: "String" } @@ -782,31 +764,25 @@ export const SkuProperty: msRest.CompositeMapper = { } }; -export const SkuRestriction: msRest.CompositeMapper = { - serializedName: "SkuRestriction", +export const ReservationOrderList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SkuRestriction", + className: "ReservationOrderList", modelProperties: { - type: { - serializedName: "type", - type: { - name: "String" - } - }, - values: { - serializedName: "values", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { - name: "String" + name: "Composite", + className: "ReservationOrderResponse" } } } }, - reasonCode: { - serializedName: "reasonCode", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -815,175 +791,117 @@ export const SkuRestriction: msRest.CompositeMapper = { } }; -export const Catalog: msRest.CompositeMapper = { - serializedName: "Catalog", +export const ReservationOrderResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Catalog", + className: "ReservationOrderResponse", modelProperties: { - resourceType: { + etag: { + serializedName: "etag", + type: { + name: "Number" + } + }, + id: { + serializedName: "id", readOnly: true, - serializedName: "resourceType", type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, - billingPlans: { - serializedName: "billingPlans", + type: { + serializedName: "type", + readOnly: true, type: { - name: "Dictionary", - value: { - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } + name: "String" } }, - terms: { - readOnly: true, - serializedName: "terms", + systemData: { + serializedName: "systemData", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "Composite", + className: "SystemData" } }, - locations: { - readOnly: true, - serializedName: "locations", + displayName: { + serializedName: "properties.displayName", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "String" } }, - skuProperties: { - readOnly: true, - serializedName: "skuProperties", + requestDateTime: { + serializedName: "properties.requestDateTime", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SkuProperty" - } - } + name: "DateTime" } }, - restrictions: { - readOnly: true, - serializedName: "restrictions", + createdDateTime: { + serializedName: "properties.createdDateTime", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SkuRestriction" - } - } + name: "DateTime" } - } - } - } -}; - -export const ExtendedStatusInfo: msRest.CompositeMapper = { - serializedName: "ExtendedStatusInfo", - type: { - name: "Composite", - className: "ExtendedStatusInfo", - modelProperties: { - statusCode: { - serializedName: "statusCode", + }, + expiryDate: { + serializedName: "properties.expiryDate", type: { - name: "String" + name: "Date" } }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const PaymentDetail: msRest.CompositeMapper = { - serializedName: "PaymentDetail", - type: { - name: "Composite", - className: "PaymentDetail", - modelProperties: { - dueDate: { - serializedName: "dueDate", - type: { - name: "Date" - } - }, - paymentDate: { - serializedName: "paymentDate", + originalQuantity: { + serializedName: "properties.originalQuantity", type: { - name: "Date" + name: "Number" } }, - pricingCurrencyTotal: { - serializedName: "pricingCurrencyTotal", + term: { + serializedName: "properties.term", type: { - name: "Composite", - className: "Price" + name: "String" } }, - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", + provisioningState: { + serializedName: "properties.provisioningState", type: { - name: "Composite", - className: "Price" + name: "String" } }, - billingAccount: { - serializedName: "billingAccount", + billingPlan: { + serializedName: "properties.billingPlan", type: { name: "String" } }, - status: { - serializedName: "status", + planInformation: { + serializedName: "properties.planInformation", type: { - name: "String" + name: "Composite", + className: "ReservationOrderBillingPlanInformation" } }, - extendedStatusInfo: { - serializedName: "extendedStatusInfo", + reservations: { + serializedName: "properties.reservations", type: { - name: "Composite", - className: "ExtendedStatusInfo" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationResponse" + } + } } } } } }; -export const ReservationOrderBillingPlanInformation: msRest.CompositeMapper = { - serializedName: "ReservationOrderBillingPlanInformation", +export const ReservationOrderBillingPlanInformation: coreClient.CompositeMapper = { type: { name: "Composite", className: "ReservationOrderBillingPlanInformation", @@ -1023,140 +941,81 @@ export const ReservationOrderBillingPlanInformation: msRest.CompositeMapper = { } }; -export const ReservationSplitProperties: msRest.CompositeMapper = { - serializedName: "ReservationSplitProperties", +export const ReservationResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationSplitProperties", + className: "ReservationResponse", modelProperties: { - splitDestinations: { - serializedName: "splitDestinations", + location: { + serializedName: "location", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "String" } }, - splitSource: { - serializedName: "splitSource", + etag: { + serializedName: "etag", type: { - name: "String" + name: "Number" } - } - } - } -}; - -export const ReservationMergeProperties: msRest.CompositeMapper = { - serializedName: "ReservationMergeProperties", - type: { - name: "Composite", - className: "ReservationMergeProperties", - modelProperties: { - mergeDestination: { - serializedName: "mergeDestination", + }, + id: { + serializedName: "id", + readOnly: true, type: { name: "String" } }, - mergeSources: { - serializedName: "mergeSources", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const RenewPropertiesResponsePricingCurrencyTotal: msRest.CompositeMapper = { - serializedName: "RenewPropertiesResponse_pricingCurrencyTotal", - type: { - name: "Composite", - className: "RenewPropertiesResponsePricingCurrencyTotal", - modelProperties: { - currencyCode: { - serializedName: "currencyCode", + name: { + serializedName: "name", + readOnly: true, type: { name: "String" } }, - amount: { - serializedName: "amount", - type: { - name: "Number" - } - } - } - } -}; - -export const RenewPropertiesResponseBillingCurrencyTotal: msRest.CompositeMapper = { - serializedName: "RenewPropertiesResponse_billingCurrencyTotal", - type: { - name: "Composite", - className: "RenewPropertiesResponseBillingCurrencyTotal", - modelProperties: { - currencyCode: { - serializedName: "currencyCode", + sku: { + serializedName: "sku", type: { - name: "String" + name: "Composite", + className: "SkuName" } }, - amount: { - serializedName: "amount", + properties: { + serializedName: "properties", type: { - name: "Number" + name: "Composite", + className: "ReservationsProperties" } - } - } - } -}; - -export const RenewPropertiesResponse: msRest.CompositeMapper = { - serializedName: "RenewPropertiesResponse", - type: { - name: "Composite", - className: "RenewPropertiesResponse", - modelProperties: { - purchaseProperties: { - serializedName: "purchaseProperties", + }, + type: { + serializedName: "type", + readOnly: true, type: { - name: "Composite", - className: "PurchaseRequest" + name: "String" } }, - pricingCurrencyTotal: { - serializedName: "pricingCurrencyTotal", + kind: { + defaultValue: "Microsoft.Compute", + isConstant: true, + serializedName: "kind", type: { - name: "Composite", - className: "RenewPropertiesResponsePricingCurrencyTotal" + name: "String" } }, - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", + systemData: { + serializedName: "systemData", type: { name: "Composite", - className: "RenewPropertiesResponseBillingCurrencyTotal" + className: "SystemData" } } } } }; -export const ReservationProperties: msRest.CompositeMapper = { - serializedName: "ReservationProperties", +export const ReservationsProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationProperties", + className: "ReservationsProperties", modelProperties: { reservedResourceType: { serializedName: "reservedResourceType", @@ -1193,6 +1052,18 @@ export const ReservationProperties: msRest.CompositeMapper = { name: "String" } }, + archived: { + serializedName: "archived", + type: { + name: "Boolean" + } + }, + capabilities: { + serializedName: "capabilities", + type: { + name: "String" + } + }, quantity: { serializedName: "quantity", type: { @@ -1212,8 +1083,8 @@ export const ReservationProperties: msRest.CompositeMapper = { } }, lastUpdatedDateTime: { - readOnly: true, serializedName: "lastUpdatedDateTime", + readOnly: true, type: { name: "DateTime" } @@ -1243,6 +1114,26 @@ export const ReservationProperties: msRest.CompositeMapper = { name: "String" } }, + displayProvisioningState: { + serializedName: "displayProvisioningState", + readOnly: true, + type: { + name: "String" + } + }, + provisioningSubState: { + serializedName: "provisioningSubState", + readOnly: true, + type: { + name: "String" + } + }, + purchaseDate: { + serializedName: "purchaseDate", + type: { + name: "Date" + } + }, splitProperties: { serializedName: "splitProperties", type: { @@ -1264,6 +1155,7 @@ export const ReservationProperties: msRest.CompositeMapper = { } }, renew: { + defaultValue: false, serializedName: "renew", type: { name: "Boolean" @@ -1293,61 +1185,50 @@ export const ReservationProperties: msRest.CompositeMapper = { type: { name: "String" } - } - } - } -}; - -export const ReservationResponse: msRest.CompositeMapper = { - serializedName: "ReservationResponse", - type: { - name: "Composite", - className: "ReservationResponse", - modelProperties: { - location: { - readOnly: true, - serializedName: "location", - type: { - name: "String" - } - }, - etag: { - serializedName: "etag", - type: { - name: "Number" - } }, - id: { + userFriendlyAppliedScopeType: { + serializedName: "userFriendlyAppliedScopeType", readOnly: true, - serializedName: "id", type: { name: "String" } }, - name: { + userFriendlyRenewState: { + serializedName: "userFriendlyRenewState", readOnly: true, - serializedName: "name", type: { name: "String" } }, - sku: { - serializedName: "sku", + utilization: { + serializedName: "utilization", type: { name: "Composite", - className: "SkuName" + className: "ReservationsPropertiesUtilization" } - }, - properties: { - serializedName: "properties", + } + } + } +}; + +export const ReservationSplitProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationSplitProperties", + modelProperties: { + splitDestinations: { + serializedName: "splitDestinations", type: { - name: "Composite", - className: "ReservationProperties" + name: "Sequence", + element: { + type: { + name: "String" + } + } } }, - type: { - readOnly: true, - serializedName: "type", + splitSource: { + serializedName: "splitSource", type: { name: "String" } @@ -1356,507 +1237,1131 @@ export const ReservationResponse: msRest.CompositeMapper = { } }; -export const ReservationOrderResponse: msRest.CompositeMapper = { - serializedName: "ReservationOrderResponse", +export const ReservationMergeProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationOrderResponse", + className: "ReservationMergeProperties", modelProperties: { - etag: { - serializedName: "etag", - type: { - name: "Number" - } - }, - id: { - readOnly: true, - serializedName: "id", + mergeDestination: { + serializedName: "mergeDestination", type: { name: "String" } }, - name: { - readOnly: true, - serializedName: "name", + mergeSources: { + serializedName: "mergeSources", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "String" + } + } } - }, - displayName: { - serializedName: "properties.displayName", + } + } + } +}; + +export const RenewPropertiesResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RenewPropertiesResponse", + modelProperties: { + purchaseProperties: { + serializedName: "purchaseProperties", type: { - name: "String" + name: "Composite", + className: "PurchaseRequest" } }, - requestDateTime: { - serializedName: "properties.requestDateTime", + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", type: { - name: "DateTime" + name: "Composite", + className: "RenewPropertiesResponsePricingCurrencyTotal" } }, - createdDateTime: { - serializedName: "properties.createdDateTime", + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", type: { - name: "DateTime" + name: "Composite", + className: "RenewPropertiesResponseBillingCurrencyTotal" } - }, - expiryDate: { - serializedName: "properties.expiryDate", + } + } + } +}; + +export const RenewPropertiesResponsePricingCurrencyTotal: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RenewPropertiesResponsePricingCurrencyTotal", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", type: { - name: "Date" + name: "String" } }, - originalQuantity: { - serializedName: "properties.originalQuantity", + amount: { + serializedName: "amount", type: { name: "Number" } - }, - term: { - serializedName: "properties.term", + } + } + } +}; + +export const RenewPropertiesResponseBillingCurrencyTotal: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RenewPropertiesResponseBillingCurrencyTotal", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", type: { name: "String" } }, - provisioningState: { - serializedName: "properties.provisioningState", + amount: { + serializedName: "amount", type: { - name: "String" + name: "Number" } - }, - billingPlan: { - serializedName: "properties.billingPlan", + } + } + } +}; + +export const ReservationsPropertiesUtilization: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationsPropertiesUtilization", + modelProperties: { + trend: { + serializedName: "trend", + readOnly: true, type: { name: "String" } }, - planInformation: { - serializedName: "properties.planInformation", - type: { - name: "Composite", - className: "ReservationOrderBillingPlanInformation" - } - }, - reservations: { - serializedName: "properties.reservations", + aggregates: { + serializedName: "aggregates", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ReservationResponse" + className: "ReservationUtilizationAggregates" } } } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } } } } }; -export const CalculatePriceResponsePropertiesBillingCurrencyTotal: msRest.CompositeMapper = { - serializedName: "CalculatePriceResponseProperties_billingCurrencyTotal", +export const ReservationUtilizationAggregates: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CalculatePriceResponsePropertiesBillingCurrencyTotal", + className: "ReservationUtilizationAggregates", modelProperties: { - currencyCode: { - serializedName: "currencyCode", - type: { - name: "String" - } - }, - amount: { - serializedName: "amount", + grain: { + serializedName: "grain", + readOnly: true, type: { name: "Number" } - } - } - } -}; - -export const CalculatePriceResponsePropertiesPricingCurrencyTotal: msRest.CompositeMapper = { - serializedName: "CalculatePriceResponseProperties_pricingCurrencyTotal", - type: { - name: "Composite", - className: "CalculatePriceResponsePropertiesPricingCurrencyTotal", - modelProperties: { - currencyCode: { - serializedName: "currencyCode", + }, + grainUnit: { + serializedName: "grainUnit", + readOnly: true, type: { name: "String" } }, - amount: { - serializedName: "amount", + value: { + serializedName: "value", + readOnly: true, type: { name: "Number" } + }, + valueUnit: { + serializedName: "valueUnit", + readOnly: true, + type: { + name: "String" + } } } } }; -export const CalculatePriceResponseProperties: msRest.CompositeMapper = { - serializedName: "CalculatePriceResponseProperties", +export const SystemData: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CalculatePriceResponseProperties", + className: "SystemData", modelProperties: { - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", + createdBy: { + serializedName: "createdBy", type: { - name: "Composite", - className: "CalculatePriceResponsePropertiesBillingCurrencyTotal" + name: "String" } }, - isBillingPartnerManaged: { - serializedName: "isBillingPartnerManaged", + createdByType: { + serializedName: "createdByType", type: { - name: "Boolean" + name: "String" } }, - reservationOrderId: { - serializedName: "reservationOrderId", + createdAt: { + serializedName: "createdAt", type: { - name: "String" + name: "DateTime" } }, - skuTitle: { - serializedName: "skuTitle", + lastModifiedBy: { + serializedName: "lastModifiedBy", type: { name: "String" } }, - skuDescription: { - serializedName: "skuDescription", + lastModifiedByType: { + serializedName: "lastModifiedByType", type: { name: "String" } }, - pricingCurrencyTotal: { - serializedName: "pricingCurrencyTotal", + lastModifiedAt: { + serializedName: "lastModifiedAt", type: { - name: "Composite", - className: "CalculatePriceResponsePropertiesPricingCurrencyTotal" + name: "DateTime" } - }, - paymentSchedule: { - serializedName: "paymentSchedule", + } + } + } +}; + +export const SplitRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SplitRequest", + modelProperties: { + quantities: { + serializedName: "properties.quantities", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "PaymentDetail" + name: "Number" } } } + }, + reservationId: { + serializedName: "properties.reservationId", + type: { + name: "String" + } } } } }; -export const CalculatePriceResponse: msRest.CompositeMapper = { - serializedName: "CalculatePriceResponse", +export const MergeRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CalculatePriceResponse", + className: "MergeRequest", modelProperties: { - properties: { - serializedName: "properties", + sources: { + serializedName: "properties.sources", type: { - name: "Composite", - className: "CalculatePriceResponseProperties" + name: "Sequence", + element: { + type: { + name: "String" + } + } } } } } }; -export const PatchPropertiesRenewProperties: msRest.CompositeMapper = { - serializedName: "PatchProperties_renewProperties", +export const ReservationList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PatchPropertiesRenewProperties", + className: "ReservationList", modelProperties: { - purchaseProperties: { - serializedName: "purchaseProperties", + value: { + serializedName: "value", type: { - name: "Composite", - className: "PurchaseRequest" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" } } } } }; -export const MergeRequest: msRest.CompositeMapper = { - serializedName: "MergeRequest", +export const Patch: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MergeRequest", + className: "Patch", modelProperties: { - sources: { - serializedName: "properties.sources", + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + appliedScopes: { + serializedName: "properties.appliedScopes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + instanceFlexibility: { + serializedName: "properties.instanceFlexibility", + type: { + name: "String" + } + }, + name: { + serializedName: "properties.name", + type: { + name: "String" + } + }, + renew: { + defaultValue: false, + serializedName: "properties.renew", + type: { + name: "Boolean" + } + }, + renewProperties: { + serializedName: "properties.renewProperties", + type: { + name: "Composite", + className: "PatchPropertiesRenewProperties" + } + } + } + } +}; + +export const PatchPropertiesRenewProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PatchPropertiesRenewProperties", + modelProperties: { + purchaseProperties: { + serializedName: "purchaseProperties", + type: { + name: "Composite", + className: "PurchaseRequest" + } + } + } + } +}; + +export const OperationList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OperationResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResponse", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const CalculateExchangeRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculateExchangeRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "CalculateExchangeRequestProperties" + } + } + } + } +}; + +export const CalculateExchangeRequestProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculateExchangeRequestProperties", + modelProperties: { + reservationsToPurchase: { + serializedName: "reservationsToPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PurchaseRequest" + } + } + } + }, + reservationsToExchange: { + serializedName: "reservationsToExchange", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToReturn" + } + } + } + } + } + } +}; + +export const ReservationToReturn: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationToReturn", + modelProperties: { + reservationId: { + serializedName: "reservationId", + type: { + name: "String" + } + }, + quantity: { + serializedName: "quantity", + type: { + name: "Number" + } + } + } + } +}; + +export const CalculateExchangeOperationResultResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculateExchangeOperationResultResponse", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "CalculateExchangeResponseProperties" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "OperationResultError" + } + } + } + } +}; + +export const CalculateExchangeResponseProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculateExchangeResponseProperties", + modelProperties: { + sessionId: { + serializedName: "sessionId", + type: { + name: "String" + } + }, + netPayable: { + serializedName: "netPayable", + type: { + name: "Composite", + className: "Price" + } + }, + refundsTotal: { + serializedName: "refundsTotal", + type: { + name: "Composite", + className: "Price" + } + }, + purchasesTotal: { + serializedName: "purchasesTotal", + type: { + name: "Composite", + className: "Price" + } + }, + reservationsToPurchase: { + serializedName: "reservationsToPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToPurchaseCalculateExchange" + } + } + } + }, + reservationsToExchange: { + serializedName: "reservationsToExchange", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToExchange" + } + } + } + }, + policyResult: { + serializedName: "policyResult", + type: { + name: "Composite", + className: "ExchangePolicyErrors" + } + } + } + } +}; + +export const ReservationToPurchaseCalculateExchange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationToPurchaseCalculateExchange", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "PurchaseRequest" + } + }, + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + } + } + } +}; + +export const ReservationToExchange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationToExchange", + modelProperties: { + reservationId: { + serializedName: "reservationId", + type: { + name: "String" + } + }, + quantity: { + serializedName: "quantity", + type: { + name: "Number" + } + }, + billingRefundAmount: { + serializedName: "billingRefundAmount", + type: { + name: "Composite", + className: "Price" + } + }, + billingInformation: { + serializedName: "billingInformation", + type: { + name: "Composite", + className: "BillingInformation" + } + } + } + } +}; + +export const BillingInformation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BillingInformation", + modelProperties: { + billingCurrencyTotalPaidAmount: { + serializedName: "billingCurrencyTotalPaidAmount", + type: { + name: "Composite", + className: "Price" + } + }, + billingCurrencyProratedAmount: { + serializedName: "billingCurrencyProratedAmount", + type: { + name: "Composite", + className: "Price" + } + }, + billingCurrencyRemainingCommitmentAmount: { + serializedName: "billingCurrencyRemainingCommitmentAmount", + type: { + name: "Composite", + className: "Price" + } + } + } + } +}; + +export const ExchangePolicyErrors: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangePolicyErrors", + modelProperties: { + policyErrors: { + serializedName: "policyErrors", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ExchangePolicyError" + } + } + } + } + } + } +}; + +export const ExchangePolicyError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangePolicyError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const OperationResultError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResultError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ExchangeRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangeRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ExchangeRequestProperties" + } + } + } + } +}; + +export const ExchangeRequestProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangeRequestProperties", + modelProperties: { + sessionId: { + serializedName: "sessionId", + type: { + name: "String" + } + } + } + } +}; + +export const ExchangeOperationResultResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangeOperationResultResponse", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ExchangeResponseProperties" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "OperationResultError" + } + } + } + } +}; + +export const ExchangeResponseProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangeResponseProperties", + modelProperties: { + sessionId: { + serializedName: "sessionId", + type: { + name: "String" + } + }, + netPayable: { + serializedName: "netPayable", + type: { + name: "Composite", + className: "Price" + } + }, + refundsTotal: { + serializedName: "refundsTotal", + type: { + name: "Composite", + className: "Price" + } + }, + purchasesTotal: { + serializedName: "purchasesTotal", + type: { + name: "Composite", + className: "Price" + } + }, + reservationsToPurchase: { + serializedName: "reservationsToPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToPurchaseExchange" + } + } + } + }, + reservationsToExchange: { + serializedName: "reservationsToExchange", type: { name: "Sequence", element: { type: { - name: "String" + name: "Composite", + className: "ReservationToReturnForExchange" } } } + }, + policyResult: { + serializedName: "policyResult", + type: { + name: "Composite", + className: "ExchangePolicyErrors" + } } } } }; -export const Patch: msRest.CompositeMapper = { - serializedName: "Patch", +export const ReservationToPurchaseExchange: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Patch", + className: "ReservationToPurchaseExchange", modelProperties: { - appliedScopeType: { - serializedName: "properties.appliedScopeType", + reservationOrderId: { + serializedName: "reservationOrderId", type: { name: "String" } }, - appliedScopes: { - serializedName: "properties.appliedScopes", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - instanceFlexibility: { - serializedName: "properties.instanceFlexibility", + reservationId: { + serializedName: "reservationId", type: { name: "String" } }, - name: { - serializedName: "properties.name", + properties: { + serializedName: "properties", type: { - name: "String" + name: "Composite", + className: "PurchaseRequest" } }, - renew: { - serializedName: "properties.renew", + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", type: { - name: "Boolean" + name: "Composite", + className: "Price" } }, - renewProperties: { - serializedName: "properties.renewProperties", + status: { + serializedName: "status", type: { - name: "Composite", - className: "PatchPropertiesRenewProperties" + name: "String" } } } } }; -export const SplitRequest: msRest.CompositeMapper = { - serializedName: "SplitRequest", +export const ReservationToReturnForExchange: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SplitRequest", + className: "ReservationToReturnForExchange", modelProperties: { - quantities: { - serializedName: "properties.quantities", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, reservationId: { - serializedName: "properties.reservationId", + serializedName: "reservationId", type: { name: "String" } - } - } - } -}; - -export const ExtendedErrorInfo: msRest.CompositeMapper = { - serializedName: "ExtendedErrorInfo", - type: { - name: "Composite", - className: "ExtendedErrorInfo", - modelProperties: { - code: { - serializedName: "code", + }, + quantity: { + serializedName: "quantity", type: { - name: "String" + name: "Number" } }, - message: { - serializedName: "message", + billingRefundAmount: { + serializedName: "billingRefundAmount", type: { - name: "String" + name: "Composite", + className: "Price" } - } - } - } -}; - -export const ErrorModel: msRest.CompositeMapper = { - serializedName: "Error", - type: { - name: "Composite", - className: "ErrorModel", - modelProperties: { - error: { - serializedName: "error", + }, + billingInformation: { + serializedName: "billingInformation", type: { name: "Composite", - className: "ExtendedErrorInfo" + className: "BillingInformation" + } + }, + status: { + serializedName: "status", + type: { + name: "String" } } } } }; -export const AppliedReservationList: msRest.CompositeMapper = { - serializedName: "AppliedReservationList", +export const ReservationsListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppliedReservationList", + className: "ReservationsListResult", modelProperties: { value: { serializedName: "value", + readOnly: true, type: { name: "Sequence", element: { type: { - name: "String" + name: "Composite", + className: "ReservationResponse" } } } }, nextLink: { serializedName: "nextLink", + readOnly: true, type: { name: "String" } + }, + summary: { + serializedName: "summary", + type: { + name: "Composite", + className: "ReservationSummary" + } } } } }; -export const AppliedReservations: msRest.CompositeMapper = { - serializedName: "AppliedReservations", +export const ReservationSummary: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppliedReservations", + className: "ReservationSummary", modelProperties: { - id: { + succeededCount: { + serializedName: "succeededCount", readOnly: true, - serializedName: "id", type: { - name: "String" + name: "Number" } }, - name: { + failedCount: { + serializedName: "failedCount", readOnly: true, - serializedName: "name", type: { - name: "String" + name: "Number" } }, - type: { + expiringCount: { + serializedName: "expiringCount", readOnly: true, - serializedName: "type", type: { - name: "String" + name: "Number" } }, - reservationOrderIds: { - serializedName: "properties.reservationOrderIds", + expiredCount: { + serializedName: "expiredCount", + readOnly: true, type: { - name: "Composite", - className: "AppliedReservationList" + name: "Number" + } + }, + pendingCount: { + serializedName: "pendingCount", + readOnly: true, + type: { + name: "Number" + } + }, + cancelledCount: { + serializedName: "cancelledCount", + readOnly: true, + type: { + name: "Number" } } } } }; -export const OperationDisplay: msRest.CompositeMapper = { - serializedName: "OperationDisplay", +export const ErrorResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationDisplay", + className: "ErrorResponse", modelProperties: { - provider: { - serializedName: "provider", - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - type: { - name: "String" - } - }, - description: { - serializedName: "description", + error: { + serializedName: "error", type: { - name: "String" + name: "Composite", + className: "ErrorDetails" } } } } }; -export const OperationResponse: msRest.CompositeMapper = { - serializedName: "OperationResponse", +export const ErrorDetails: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationResponse", + className: "ErrorDetails", modelProperties: { - name: { - serializedName: "name", + code: { + serializedName: "code", + readOnly: true, type: { name: "String" } }, - display: { - serializedName: "display", + message: { + serializedName: "message", + readOnly: true, type: { - name: "Composite", - className: "OperationDisplay" + name: "String" } }, - origin: { - serializedName: "origin", + target: { + serializedName: "target", + readOnly: true, type: { name: "String" } @@ -1865,42 +2370,41 @@ export const OperationResponse: msRest.CompositeMapper = { } }; -export const ScopeProperties: msRest.CompositeMapper = { - serializedName: "ScopeProperties", +export const ChangeDirectoryRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ScopeProperties", + className: "ChangeDirectoryRequest", modelProperties: { - scope: { - serializedName: "scope", + destinationTenantId: { + serializedName: "destinationTenantId", type: { name: "String" } - }, - valid: { - serializedName: "valid", - type: { - name: "Boolean" - } } } } }; -export const SubscriptionScopeProperties: msRest.CompositeMapper = { - serializedName: "SubscriptionScopeProperties", +export const ChangeDirectoryResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SubscriptionScopeProperties", + className: "ChangeDirectoryResponse", modelProperties: { - scopes: { - serializedName: "scopes", + reservationOrder: { + serializedName: "reservationOrder", + type: { + name: "Composite", + className: "ChangeDirectoryResult" + } + }, + reservations: { + serializedName: "reservations", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ScopeProperties" + className: "ChangeDirectoryResult" } } } @@ -1909,48 +2413,56 @@ export const SubscriptionScopeProperties: msRest.CompositeMapper = { } }; -export const AvailableScopeProperties: msRest.CompositeMapper = { - serializedName: "AvailableScopeProperties", +export const ChangeDirectoryResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AvailableScopeProperties", + className: "ChangeDirectoryResult", modelProperties: { - properties: { - serializedName: "properties", + id: { + serializedName: "id", type: { - name: "Composite", - className: "SubscriptionScopeProperties" + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isSucceeded: { + serializedName: "isSucceeded", + type: { + name: "Boolean" + } + }, + error: { + serializedName: "error", + type: { + name: "String" } } } } }; -export const ResourceName: msRest.CompositeMapper = { - serializedName: "ResourceName", +export const CurrentQuotaLimitBase: coreClient.CompositeMapper = { type: { - name: "Composite", - className: "ResourceName", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "String" - } - }, - localizedValue: { - readOnly: true, - serializedName: "localizedValue", + name: "Composite", + className: "CurrentQuotaLimitBase", + modelProperties: { + properties: { + serializedName: "properties", type: { - name: "String" + name: "Composite", + className: "QuotaProperties" } } } } }; -export const QuotaProperties: msRest.CompositeMapper = { - serializedName: "QuotaProperties", +export const QuotaProperties: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaProperties", @@ -1962,8 +2474,8 @@ export const QuotaProperties: msRest.CompositeMapper = { } }, currentValue: { - readOnly: true, serializedName: "currentValue", + readOnly: true, type: { name: "Number" } @@ -1984,12 +2496,12 @@ export const QuotaProperties: msRest.CompositeMapper = { resourceType: { serializedName: "resourceType", type: { - name: "Object" + name: "String" } }, quotaPeriod: { - readOnly: true, serializedName: "quotaPeriod", + readOnly: true, type: { name: "String" } @@ -1997,103 +2509,78 @@ export const QuotaProperties: msRest.CompositeMapper = { properties: { serializedName: "properties", type: { - name: "Object" + name: "Dictionary", + value: { type: { name: "any" } } } } } } }; -export const CurrentQuotaLimitBase: msRest.CompositeMapper = { - serializedName: "CurrentQuotaLimitBase", +export const ResourceName: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CurrentQuotaLimitBase", + className: "ResourceName", modelProperties: { - properties: { - serializedName: "properties", + value: { + serializedName: "value", type: { - name: "Composite", - className: "QuotaProperties" + name: "String" + } + }, + localizedValue: { + serializedName: "localizedValue", + readOnly: true, + type: { + name: "String" } } } } }; -export const CurrentQuotaLimit: msRest.CompositeMapper = { - serializedName: "CurrentQuotaLimit", +export const ExceptionResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CurrentQuotaLimit", + className: "ExceptionResponse", modelProperties: { - properties: { - serializedName: "quotaInformation.properties", + error: { + serializedName: "error", type: { name: "Composite", - className: "QuotaProperties" - } - }, - provisioningState: { - readOnly: true, - serializedName: "properties.provisioningState", - type: { - name: "Object" - } - }, - message: { - readOnly: true, - serializedName: "properties.message", - type: { - name: "String" + className: "ServiceError" } } } } }; -export const QuotaLimitsResponse: msRest.CompositeMapper = { - serializedName: "QuotaLimitsResponse", +export const ServiceError: coreClient.CompositeMapper = { type: { name: "Composite", - className: "QuotaLimitsResponse", + className: "ServiceError", modelProperties: { - value: { - serializedName: "value", + code: { + serializedName: "code", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CurrentQuotaLimit" - } - } + name: "String" } }, - nextLink: { - serializedName: "nextLink", + message: { + serializedName: "message", type: { name: "String" } - } - } - } -}; - -export const CreateGenericQuotaRequestParameters: msRest.CompositeMapper = { - serializedName: "CreateGenericQuotaRequestParameters", - type: { - name: "Composite", - className: "CreateGenericQuotaRequestParameters", - modelProperties: { - value: { - serializedName: "value", + }, + details: { + serializedName: "details", + readOnly: true, type: { name: "Sequence", element: { type: { name: "Composite", - className: "CurrentQuotaLimitBase" + className: "ServiceErrorDetail" } } } @@ -2102,55 +2589,21 @@ export const CreateGenericQuotaRequestParameters: msRest.CompositeMapper = { } }; -export const SubRequest: msRest.CompositeMapper = { - serializedName: "SubRequest", +export const ServiceErrorDetail: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SubRequest", + className: "ServiceErrorDetail", modelProperties: { - limit: { - readOnly: true, - serializedName: "limit", - type: { - name: "Number" - } - }, - name: { - serializedName: "name", - type: { - name: "Composite", - className: "ResourceName" - } - }, - resourceType: { + code: { + serializedName: "code", readOnly: true, - serializedName: "resourceType", - type: { - name: "String" - } - }, - unit: { - serializedName: "unit", type: { name: "String" } }, - provisioningState: { - serializedName: "provisioningState", - type: { - name: "Object" - } - }, message: { - readOnly: true, serializedName: "message", - type: { - name: "String" - } - }, - subRequestId: { readOnly: true, - serializedName: "subRequestId", type: { name: "String" } @@ -2159,50 +2612,49 @@ export const SubRequest: msRest.CompositeMapper = { } }; -export const QuotaRequestOneResourceSubmitResponse: msRest.CompositeMapper = { - serializedName: "QuotaRequestOneResourceSubmitResponse", +export const QuotaRequestOneResourceSubmitResponse: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaRequestOneResourceSubmitResponse", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, type: { - readOnly: true, serializedName: "type", + readOnly: true, type: { name: "String" } }, provisioningState: { - readOnly: true, serializedName: "properties.provisioningState", + readOnly: true, type: { - name: "Object" + name: "String" } }, message: { - readOnly: true, serializedName: "properties.message", + readOnly: true, type: { name: "String" } }, requestSubmitTime: { - readOnly: true, serializedName: "properties.requestSubmitTime", + readOnly: true, type: { name: "DateTime" } @@ -2218,32 +2670,55 @@ export const QuotaRequestOneResourceSubmitResponse: msRest.CompositeMapper = { } }; -export const QuotaRequestProperties: msRest.CompositeMapper = { - serializedName: "QuotaRequestProperties", +export const QuotaRequestSubmitResponse201: coreClient.CompositeMapper = { type: { name: "Composite", - className: "QuotaRequestProperties", + className: "QuotaRequestSubmitResponse201", modelProperties: { - provisioningState: { - serializedName: "provisioningState", + id: { + serializedName: "id", + readOnly: true, type: { - name: "Object" + name: "String" } }, - message: { + name: { + serializedName: "name", readOnly: true, - serializedName: "message", type: { name: "String" } }, - requestSubmitTime: { + type: { + serializedName: "type", readOnly: true, - serializedName: "requestSubmitTime", type: { - name: "DateTime" + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" } }, + message: { + serializedName: "properties.message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const QuotaLimits: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaLimits", + modelProperties: { value: { serializedName: "value", type: { @@ -2251,153 +2726,199 @@ export const QuotaRequestProperties: msRest.CompositeMapper = { element: { type: { name: "Composite", - className: "SubRequest" + className: "CurrentQuotaLimitBase" } } } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } } } } }; -export const QuotaRequestSubmitResponse: msRest.CompositeMapper = { - serializedName: "QuotaRequestSubmitResponse", +export const QuotaRequestDetails: coreClient.CompositeMapper = { type: { name: "Composite", - className: "QuotaRequestSubmitResponse", + className: "QuotaRequestDetails", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, - properties: { - serializedName: "properties", + type: { + serializedName: "type", + readOnly: true, type: { - name: "Composite", - className: "QuotaRequestProperties" + name: "String" } }, - type: { + provisioningState: { + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + message: { + serializedName: "properties.message", readOnly: true, - serializedName: "type", type: { name: "String" } + }, + requestSubmitTime: { + serializedName: "properties.requestSubmitTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + value: { + serializedName: "properties.value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubRequest" + } + } + } } } } }; -export const QuotaRequestSubmitResponse201: msRest.CompositeMapper = { - serializedName: "QuotaRequestSubmitResponse201", +export const QuotaRequestProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "QuotaRequestSubmitResponse201", + className: "QuotaRequestProperties", modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", + provisioningState: { + serializedName: "provisioningState", type: { name: "String" } }, - type: { + message: { + serializedName: "message", readOnly: true, - serializedName: "type", type: { name: "String" } }, - provisioningState: { + requestSubmitTime: { + serializedName: "requestSubmitTime", readOnly: true, - serializedName: "properties.provisioningState", type: { - name: "Object" + name: "DateTime" } }, - message: { - readOnly: true, - serializedName: "properties.message", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubRequest" + } + } } } } } }; -export const QuotaRequestDetails: msRest.CompositeMapper = { - serializedName: "QuotaRequestDetails", +export const SubRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "QuotaRequestDetails", + className: "SubRequest", modelProperties: { - id: { + limit: { + serializedName: "limit", readOnly: true, - serializedName: "id", type: { - name: "String" + name: "Number" } }, name: { - readOnly: true, serializedName: "name", + type: { + name: "Composite", + className: "ResourceName" + } + }, + resourceType: { + serializedName: "resourceType", + readOnly: true, + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", type: { name: "String" } }, provisioningState: { - serializedName: "properties.provisioningState", + serializedName: "provisioningState", type: { - name: "Object" + name: "String" } }, message: { + serializedName: "message", readOnly: true, - serializedName: "properties.message", type: { name: "String" } }, - requestSubmitTime: { + subRequestId: { + serializedName: "subRequestId", readOnly: true, - serializedName: "properties.requestSubmitTime", type: { - name: "DateTime" + name: "String" } - }, + } + } + } +}; + +export const QuotaRequestDetailsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaRequestDetailsList", + modelProperties: { value: { - serializedName: "properties.value", + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "SubRequest" + className: "QuotaRequestDetails" } } } }, - type: { - readOnly: true, - serializedName: "type", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -2406,57 +2927,76 @@ export const QuotaRequestDetails: msRest.CompositeMapper = { } }; -export const ServiceErrorDetail: msRest.CompositeMapper = { - serializedName: "ServiceErrorDetail", +export const CurrentQuotaLimit: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ServiceErrorDetail", + className: "CurrentQuotaLimit", modelProperties: { - code: { + provisioningState: { + serializedName: "properties.provisioningState", readOnly: true, - serializedName: "code", type: { name: "String" } }, message: { + serializedName: "properties.message", readOnly: true, - serializedName: "message", type: { name: "String" } + }, + properties: { + serializedName: "quotaInformation.properties", + type: { + name: "Composite", + className: "QuotaProperties" + } } } } }; -export const ServiceError: msRest.CompositeMapper = { - serializedName: "ServiceError", +export const QuotaLimitsResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ServiceError", + className: "QuotaLimitsResponse", modelProperties: { - code: { - serializedName: "code", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CurrentQuotaLimit" + } + } } }, - message: { - serializedName: "message", + nextLink: { + serializedName: "nextLink", type: { name: "String" } - }, - details: { - readOnly: true, - serializedName: "details", + } + } + } +}; + +export const CreateGenericQuotaRequestParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CreateGenericQuotaRequestParameters", + modelProperties: { + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ServiceErrorDetail" + className: "CurrentQuotaLimitBase" } } } @@ -2465,25 +3005,44 @@ export const ServiceError: msRest.CompositeMapper = { } }; -export const ExceptionResponse: msRest.CompositeMapper = { - serializedName: "ExceptionResponse", +export const QuotaRequestSubmitResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ExceptionResponse", + className: "QuotaRequestSubmitResponse", modelProperties: { - error: { - serializedName: "error", + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", type: { name: "Composite", - className: "ServiceError" + className: "QuotaRequestProperties" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" } } } } }; -export const CalculateExchangePostHeaders: msRest.CompositeMapper = { - serializedName: "calculateexchange-post-headers", +export const CalculateExchangePostHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CalculateExchangePostHeaders", @@ -2510,8 +3069,7 @@ export const CalculateExchangePostHeaders: msRest.CompositeMapper = { } }; -export const ExchangePostHeaders: msRest.CompositeMapper = { - serializedName: "exchange-post-headers", +export const ExchangePostHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "ExchangePostHeaders", @@ -2538,8 +3096,7 @@ export const ExchangePostHeaders: msRest.CompositeMapper = { } }; -export const QuotaGetHeaders: msRest.CompositeMapper = { - serializedName: "quota-get-headers", +export const QuotaGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaGetHeaders", @@ -2554,8 +3111,7 @@ export const QuotaGetHeaders: msRest.CompositeMapper = { } }; -export const QuotaListHeaders: msRest.CompositeMapper = { - serializedName: "quota-list-headers", +export const QuotaListHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaListHeaders", @@ -2570,138 +3126,13 @@ export const QuotaListHeaders: msRest.CompositeMapper = { } }; -export const ReservationList: msRest.CompositeMapper = { - serializedName: "ReservationList", - type: { - name: "Composite", - className: "ReservationList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationResponse" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const ReservationOrderList: msRest.CompositeMapper = { - serializedName: "ReservationOrderList", - type: { - name: "Composite", - className: "ReservationOrderList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationOrderResponse" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const OperationList: msRest.CompositeMapper = { - serializedName: "OperationList", - type: { - name: "Composite", - className: "OperationList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationResponse" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const QuotaLimits: msRest.CompositeMapper = { - serializedName: "QuotaLimits", - type: { - name: "Composite", - className: "QuotaLimits", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CurrentQuotaLimitBase" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const QuotaRequestDetailsList: msRest.CompositeMapper = { - serializedName: "QuotaRequestDetailsList", +export const QuotaListNextHeaders: coreClient.CompositeMapper = { type: { name: "Composite", - className: "QuotaRequestDetailsList", + className: "QuotaListNextHeaders", modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "QuotaRequestDetails" - } - } - } - }, - nextLink: { - serializedName: "nextLink", + eTag: { + serializedName: "etag", type: { name: "String" } diff --git a/sdk/reservations/arm-reservations/src/models/parameters.ts b/sdk/reservations/arm-reservations/src/models/parameters.ts index c95aea884f0b..011b341129a9 100644 --- a/sdk/reservations/arm-reservations/src/models/parameters.ts +++ b/sdk/reservations/arm-reservations/src/models/parameters.ts @@ -3,51 +3,113 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + AvailableScopeRequest as AvailableScopeRequestMapper, + SplitRequest as SplitRequestMapper, + MergeRequest as MergeRequestMapper, + Patch as PatchMapper, + PurchaseRequest as PurchaseRequestMapper, + ChangeDirectoryRequest as ChangeDirectoryRequestMapper, + CalculateExchangeRequest as CalculateExchangeRequestMapper, + ExchangeRequest as ExchangeRequestMapper, + CurrentQuotaLimitBase as CurrentQuotaLimitBaseMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const apiVersion0: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const body: OperationParameter = { + parameterPath: "body", + mapper: AvailableScopeRequestMapper +}; + +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - required: true, + defaultValue: "application/json", isConstant: true, - serializedName: "api-version", - defaultValue: '2020-10-01-preview', + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion1: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const reservationOrderId: OperationURLParameter = { + parameterPath: "reservationOrderId", + mapper: { + serializedName: "reservationOrderId", + required: true, + type: { + name: "String" + } + } +}; + +export const reservationId: OperationURLParameter = { + parameterPath: "reservationId", + mapper: { + serializedName: "reservationId", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2021-07-01", isConstant: true, serializedName: "api-version", - defaultValue: '2020-10-25', type: { name: "String" } } }; -export const expand0: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "expand" - ], + +export const body1: OperationParameter = { + parameterPath: "body", + mapper: SplitRequestMapper +}; + +export const body2: OperationParameter = { + parameterPath: "body", + mapper: MergeRequestMapper +}; + +export const expand: OperationQueryParameter = { + parameterPath: ["options", "expand"], mapper: { serializedName: "expand", type: { @@ -55,157 +117,225 @@ export const expand0: msRest.OperationQueryParameter = { } } }; -export const expand1: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "expand" - ], + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: PatchMapper +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], mapper: { - serializedName: "$expand", + serializedName: "$filter", type: { name: "String" } } }; -export const filter: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "filter" - ], + +export const orderby: OperationQueryParameter = { + parameterPath: ["options", "orderby"], mapper: { - serializedName: "$filter", + serializedName: "$orderby", type: { name: "String" } } }; -export const id: msRest.OperationURLParameter = { - parameterPath: "id", + +export const refreshSummary: OperationQueryParameter = { + parameterPath: ["options", "refreshSummary"], mapper: { - required: true, - serializedName: "id", + serializedName: "refreshSummary", type: { name: "String" } } }; -export const location0: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "location" - ], + +export const skiptoken: OperationQueryParameter = { + parameterPath: ["options", "skiptoken"], + mapper: { + serializedName: "$skiptoken", + type: { + name: "Number" + } + } +}; + +export const selectedState: OperationQueryParameter = { + parameterPath: ["options", "selectedState"], mapper: { - serializedName: "location", + serializedName: "selectedState", type: { name: "String" } } }; -export const location1: msRest.OperationURLParameter = { - parameterPath: "location", + +export const take: OperationQueryParameter = { + parameterPath: ["options", "take"], mapper: { - required: true, - serializedName: "location", + serializedName: "take", type: { - name: "String" + name: "Number" } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { - required: true, serializedName: "nextLink", + required: true, type: { name: "String" } }, skipEncoding: true }; -export const providerId: msRest.OperationURLParameter = { - parameterPath: "providerId", + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", mapper: { + serializedName: "subscriptionId", required: true, - serializedName: "providerId", type: { name: "String" } } }; -export const reservationId: msRest.OperationURLParameter = { - parameterPath: "reservationId", + +export const reservedResourceType: OperationQueryParameter = { + parameterPath: ["options", "reservedResourceType"], mapper: { - required: true, - serializedName: "reservationId", + serializedName: "reservedResourceType", type: { name: "String" } } }; -export const reservationOrderId: msRest.OperationURLParameter = { - parameterPath: "reservationOrderId", + +export const location: OperationQueryParameter = { + parameterPath: ["options", "location"], mapper: { - required: true, - serializedName: "reservationOrderId", + serializedName: "location", type: { name: "String" } } }; -export const reservedResourceType: msRest.OperationQueryParameter = { - parameterPath: "reservedResourceType", + +export const body3: OperationParameter = { + parameterPath: "body", + mapper: PurchaseRequestMapper +}; + +export const expand1: OperationQueryParameter = { + parameterPath: ["options", "expand"], mapper: { + serializedName: "$expand", + type: { + name: "String" + } + } +}; + +export const body4: OperationParameter = { + parameterPath: "body", + mapper: ChangeDirectoryRequestMapper +}; + +export const body5: OperationParameter = { + parameterPath: "body", + mapper: CalculateExchangeRequestMapper +}; + +export const body6: OperationParameter = { + parameterPath: "body", + mapper: ExchangeRequestMapper +}; + +export const providerId: OperationURLParameter = { + parameterPath: "providerId", + mapper: { + serializedName: "providerId", required: true, - serializedName: "reservedResourceType", type: { name: "String" } } }; -export const resourceName: msRest.OperationURLParameter = { - parameterPath: "resourceName", + +export const location1: OperationURLParameter = { + parameterPath: "location", mapper: { + serializedName: "location", required: true, - serializedName: "resourceName", type: { name: "String" } } }; -export const skiptoken: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "skiptoken" - ], + +export const apiVersion1: OperationQueryParameter = { + parameterPath: "apiVersion", mapper: { - serializedName: "$skiptoken", + defaultValue: "2020-10-25", + isConstant: true, + serializedName: "api-version", type: { name: "String" } } }; -export const subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", + +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", mapper: { + serializedName: "resourceName", required: true, - serializedName: "subscriptionId", type: { name: "String" } } }; -export const top: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "top" - ], + +export const createQuotaRequest: OperationParameter = { + parameterPath: "createQuotaRequest", + mapper: CurrentQuotaLimitBaseMapper +}; + +export const id: OperationURLParameter = { + parameterPath: "id", + mapper: { + serializedName: "id", + required: true, + type: { + name: "String" + } + } +}; + +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], mapper: { - serializedName: "$top", constraints: { InclusiveMinimum: 1 }, + serializedName: "$top", type: { name: "Number" } } }; + +export const skiptoken1: OperationQueryParameter = { + parameterPath: ["options", "skiptoken"], + mapper: { + serializedName: "$skiptoken", + type: { + name: "String" + } + } +}; diff --git a/sdk/reservations/arm-reservations/src/models/quotaMappers.ts b/sdk/reservations/arm-reservations/src/models/quotaMappers.ts deleted file mode 100644 index af2331a16f9f..000000000000 --- a/sdk/reservations/arm-reservations/src/models/quotaMappers.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 { - BaseResource, - CurrentQuotaLimit, - CurrentQuotaLimitBase, - ExceptionResponse, - ExtendedStatusInfo, - PaymentDetail, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - QuotaGetHeaders, - QuotaLimits, - QuotaListHeaders, - QuotaProperties, - QuotaRequestDetails, - QuotaRequestOneResourceSubmitResponse, - QuotaRequestProperties, - QuotaRequestSubmitResponse, - QuotaRequestSubmitResponse201, - RenewPropertiesResponse, - RenewPropertiesResponseBillingCurrencyTotal, - RenewPropertiesResponsePricingCurrencyTotal, - ReservationMergeProperties, - ReservationOrderBillingPlanInformation, - ReservationOrderResponse, - ReservationProperties, - ReservationResponse, - ReservationSplitProperties, - ResourceName, - ServiceError, - ServiceErrorDetail, - SkuName, - SubRequest -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/quotaRequestStatusMappers.ts b/sdk/reservations/arm-reservations/src/models/quotaRequestStatusMappers.ts deleted file mode 100644 index 4f39a128af24..000000000000 --- a/sdk/reservations/arm-reservations/src/models/quotaRequestStatusMappers.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { - BaseResource, - CurrentQuotaLimit, - CurrentQuotaLimitBase, - ExceptionResponse, - ExtendedStatusInfo, - PaymentDetail, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - QuotaProperties, - QuotaRequestDetails, - QuotaRequestDetailsList, - QuotaRequestOneResourceSubmitResponse, - QuotaRequestProperties, - QuotaRequestSubmitResponse, - RenewPropertiesResponse, - RenewPropertiesResponseBillingCurrencyTotal, - RenewPropertiesResponsePricingCurrencyTotal, - ReservationMergeProperties, - ReservationOrderBillingPlanInformation, - ReservationOrderResponse, - ReservationProperties, - ReservationResponse, - ReservationSplitProperties, - ResourceName, - ServiceError, - ServiceErrorDetail, - SkuName, - SubRequest -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/reservationMappers.ts b/sdk/reservations/arm-reservations/src/models/reservationMappers.ts deleted file mode 100644 index 03dde7363572..000000000000 --- a/sdk/reservations/arm-reservations/src/models/reservationMappers.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 { - AvailableScopeProperties, - AvailableScopeRequest, - AvailableScopeRequestProperties, - BaseResource, - CurrentQuotaLimit, - CurrentQuotaLimitBase, - ErrorModel, - ExtendedErrorInfo, - ExtendedStatusInfo, - MergeRequest, - Patch, - PatchPropertiesRenewProperties, - PaymentDetail, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - QuotaProperties, - QuotaRequestDetails, - QuotaRequestOneResourceSubmitResponse, - QuotaRequestProperties, - QuotaRequestSubmitResponse, - RenewPropertiesResponse, - RenewPropertiesResponseBillingCurrencyTotal, - RenewPropertiesResponsePricingCurrencyTotal, - ReservationList, - ReservationMergeProperties, - ReservationOrderBillingPlanInformation, - ReservationOrderResponse, - ReservationProperties, - ReservationResponse, - ReservationSplitProperties, - ResourceName, - ScopeProperties, - SkuName, - SplitRequest, - SubRequest, - SubscriptionScopeProperties -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts b/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts deleted file mode 100644 index d5c6d9edc8ac..000000000000 --- a/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 { - BaseResource, - CalculatePriceResponse, - CalculatePriceResponseProperties, - CalculatePriceResponsePropertiesBillingCurrencyTotal, - CalculatePriceResponsePropertiesPricingCurrencyTotal, - CurrentQuotaLimit, - CurrentQuotaLimitBase, - ErrorModel, - ExtendedErrorInfo, - ExtendedStatusInfo, - PaymentDetail, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - QuotaProperties, - QuotaRequestDetails, - QuotaRequestOneResourceSubmitResponse, - QuotaRequestProperties, - QuotaRequestSubmitResponse, - RenewPropertiesResponse, - RenewPropertiesResponseBillingCurrencyTotal, - RenewPropertiesResponsePricingCurrencyTotal, - ReservationMergeProperties, - ReservationOrderBillingPlanInformation, - ReservationOrderList, - ReservationOrderResponse, - ReservationProperties, - ReservationResponse, - ReservationSplitProperties, - ResourceName, - SkuName, - SubRequest -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/operations/calculateExchange.ts b/sdk/reservations/arm-reservations/src/operations/calculateExchange.ts index 9a69d3197958..2a7e94952e5a 100644 --- a/sdk/reservations/arm-reservations/src/operations/calculateExchange.ts +++ b/sdk/reservations/arm-reservations/src/operations/calculateExchange.ts @@ -3,89 +3,141 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/calculateExchangeMappers"; +import { CalculateExchange } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + CalculateExchangeRequest, + CalculateExchangePostOptionalParams, + CalculateExchangePostResponse +} from "../models"; -/** Class representing a CalculateExchange. */ -export class CalculateExchange { - private readonly client: AzureReservationAPIContext; +/** Class containing CalculateExchange operations. */ +export class CalculateExchangeImpl implements CalculateExchange { + private readonly client: AzureReservationAPI; /** - * Create a CalculateExchange. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class CalculateExchange class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** * Calculates price for exchanging `Reservations` if there are no policy errors. - * @summary Calculates the refund amounts and price of the new purchases. + * * @param body Request containing purchases and refunds that need to be executed. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - post(body: Models.CalculateExchangeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPost(body,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPost( + body: CalculateExchangeRequest, + options?: CalculateExchangePostOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CalculateExchangePostResponse + > + > { + 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, + { body, options }, + postOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** * Calculates price for exchanging `Reservations` if there are no policy errors. - * @summary Calculates the refund amounts and price of the new purchases. + * * @param body Request containing purchases and refunds that need to be executed. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginPost(body: Models.CalculateExchangeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - body, - options - }, - beginPostOperationSpec, - options); + async beginPostAndWait( + body: CalculateExchangeRequest, + options?: CalculateExchangePostOptionalParams + ): Promise { + const poller = await this.beginPost(body, options); + return poller.pollUntilDone(); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const beginPostOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const postOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/calculateExchange", httpMethod: "POST", - path: "providers/Microsoft.Capacity/calculateExchange", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.CalculateExchangeRequest, - required: true - } - }, responses: { 200: { - bodyMapper: Mappers.CalculateExchangeOperationResultResponse, - headersMapper: Mappers.CalculateExchangePostHeaders + bodyMapper: Mappers.CalculateExchangeOperationResultResponse + }, + 201: { + bodyMapper: Mappers.CalculateExchangeOperationResultResponse }, 202: { - headersMapper: Mappers.CalculateExchangePostHeaders + bodyMapper: Mappers.CalculateExchangeOperationResultResponse + }, + 204: { + bodyMapper: Mappers.CalculateExchangeOperationResultResponse }, default: { - bodyMapper: Mappers.ErrorModel, - headersMapper: Mappers.CalculateExchangePostHeaders + bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body5, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/exchange.ts b/sdk/reservations/arm-reservations/src/operations/exchange.ts index b19ce8e5f865..1ce3fcbb93db 100644 --- a/sdk/reservations/arm-reservations/src/operations/exchange.ts +++ b/sdk/reservations/arm-reservations/src/operations/exchange.ts @@ -3,89 +3,138 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/exchangeMappers"; +import { Exchange } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ExchangeRequest, + ExchangePostOptionalParams, + ExchangePostResponse +} from "../models"; -/** Class representing a Exchange. */ -export class Exchange { - private readonly client: AzureReservationAPIContext; +/** Class containing Exchange operations. */ +export class ExchangeImpl implements Exchange { + private readonly client: AzureReservationAPI; /** - * Create a Exchange. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class Exchange class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** * Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. - * @summary Exchange Reservation(s) + * * @param body Request containing the refunds and purchases that need to be executed. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - post(body: Models.ExchangeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPost(body,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPost( + body: ExchangeRequest, + options?: ExchangePostOptionalParams + ): Promise< + PollerLike, ExchangePostResponse> + > { + 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, + { body, options }, + postOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** * Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. - * @summary Exchange Reservation(s) + * * @param body Request containing the refunds and purchases that need to be executed. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginPost(body: Models.ExchangeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - body, - options - }, - beginPostOperationSpec, - options); + async beginPostAndWait( + body: ExchangeRequest, + options?: ExchangePostOptionalParams + ): Promise { + const poller = await this.beginPost(body, options); + return poller.pollUntilDone(); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const beginPostOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const postOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/exchange", httpMethod: "POST", - path: "providers/Microsoft.Capacity/exchange", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.ExchangeRequest, - required: true - } - }, responses: { 200: { - bodyMapper: Mappers.ExchangeOperationResultResponse, - headersMapper: Mappers.ExchangePostHeaders + bodyMapper: Mappers.ExchangeOperationResultResponse + }, + 201: { + bodyMapper: Mappers.ExchangeOperationResultResponse }, 202: { - headersMapper: Mappers.ExchangePostHeaders + bodyMapper: Mappers.ExchangeOperationResultResponse + }, + 204: { + bodyMapper: Mappers.ExchangeOperationResultResponse }, default: { - bodyMapper: Mappers.ErrorModel, - headersMapper: Mappers.ExchangePostHeaders + bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body6, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/index.ts b/sdk/reservations/arm-reservations/src/operations/index.ts index a04a56e654d4..425138628c9e 100644 --- a/sdk/reservations/arm-reservations/src/operations/index.ts +++ b/sdk/reservations/arm-reservations/src/operations/index.ts @@ -3,8 +3,7 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./reservation"; diff --git a/sdk/reservations/arm-reservations/src/operations/operation.ts b/sdk/reservations/arm-reservations/src/operations/operation.ts index 492c3c69e2aa..ddf54ac4cd9e 100644 --- a/sdk/reservations/arm-reservations/src/operations/operation.ts +++ b/sdk/reservations/arm-reservations/src/operations/operation.ts @@ -3,94 +3,109 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { + OperationResponse, + OperationListNextOptionalParams, + OperationListOptionalParams, + OperationListResponse, + OperationListNextResponse +} from "../models"; -/** Class representing a Operation. */ -export class Operation { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing Operation operations. */ +export class OperationImpl implements Operation { + private readonly client: AzureReservationAPI; /** - * Create a Operation. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class Operation class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** * List all the operations. - * @summary Get operations. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - listOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * List all the operations. - * @summary Get operations. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list( + options?: OperationListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: OperationListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/operations", httpMethod: "GET", - path: "providers/Microsoft.Capacity/operations", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.OperationList @@ -99,22 +114,14 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.OperationList @@ -123,5 +130,8 @@ const listNextOperationSpec: msRest.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 9dd20c907d92..fd7cf412c2f9 100644 --- a/sdk/reservations/arm-reservations/src/operations/quota.ts +++ b/sdk/reservations/arm-reservations/src/operations/quota.ts @@ -3,181 +3,345 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/quotaMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Quota } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + CurrentQuotaLimitBase, + QuotaListNextOptionalParams, + QuotaListOptionalParams, + QuotaGetOptionalParams, + QuotaGetResponse, + QuotaCreateOrUpdateOptionalParams, + QuotaCreateOrUpdateResponse, + QuotaUpdateOptionalParams, + QuotaUpdateResponse, + QuotaListResponse, + QuotaListNextResponse +} from "../models"; -/** Class representing a Quota. */ -export class Quota { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing Quota operations. */ +export class QuotaImpl implements Quota { + private readonly client: AzureReservationAPI; /** - * Create a Quota. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class Quota class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** - * 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. + * 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. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. - * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(subscriptionId: string, providerId: string, location: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; + public list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + subscriptionId, + providerId, + location, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage( + subscriptionId, + providerId, + location, + options + ); + } + }; + } + + private async *listPagingPage( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): AsyncIterableIterator { + let result = await this._list( + subscriptionId, + providerId, + location, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + subscriptionId, + providerId, + location, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + subscriptionId, + providerId, + location, + options + )) { + yield* page; + } + } + /** + * 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. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param callback The callback + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param options The options parameters. */ - get(subscriptionId: string, providerId: string, location: string, resourceName: string, callback: msRest.ServiceCallback): void; + get( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + options?: QuotaGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { subscriptionId, providerId, location, resourceName, options }, + getOperationSpec + ); + } + /** + * 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. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param options The optional parameters - * @param callback The callback + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Quota requests payload. + * @param options The options parameters. */ - get(subscriptionId: string, providerId: string, location: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(subscriptionId: string, providerId: string, location: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( + async beginCreateOrUpdate( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + QuotaCreateOrUpdateResponse + > + > { + 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, { subscriptionId, providerId, location, resourceName, + createQuotaRequest, options }, - getOperationSpec, - callback) as Promise; + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); } /** * 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 + * 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. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices * @param createQuotaRequest Quota requests payload. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - createOrUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdate(subscriptionId, providerId, location, resourceName, createQuotaRequest, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginCreateOrUpdateAndWait( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest, + options + ); + return poller.pollUntilDone(); } /** * 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 + * + • 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. + * • To update the quota. use the PATCH operation. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices * @param createQuotaRequest Payload for the quota request. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { - return this.beginUpdate(subscriptionId, providerId, location, resourceName, createQuotaRequest, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * 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. - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param [options] The optional parameters - * @returns Promise - */ - list(subscriptionId: string, providerId: string, location: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param callback The callback - */ - list(subscriptionId: string, providerId: string, location: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param options The optional parameters - * @param callback The callback - */ - list(subscriptionId: string, providerId: string, location: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(subscriptionId: string, providerId: string, location: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - subscriptionId, - providerId, - location, - options - }, - listOperationSpec, - callback) as Promise; - } + async beginUpdate( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaUpdateOptionalParams + ): Promise< + PollerLike, QuotaUpdateResponse> + > { + 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() + } + }; + }; - /** - * 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. - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param createQuotaRequest Quota requests payload. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + const lro = new LroImpl( + sendOperation, { subscriptionId, providerId, @@ -186,224 +350,231 @@ export class Quota { createQuotaRequest, options }, - beginCreateOrUpdateOperationSpec, - options); + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); } /** * 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 + * + • 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. + * • To update the quota. use the PATCH operation. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices * @param createQuotaRequest Payload for the quota request. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - subscriptionId, - providerId, - location, - resourceName, - createQuotaRequest, - options - }, - beginUpdateOperationSpec, - options); + async beginUpdateAndWait( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest, + options + ); + return poller.pollUntilDone(); } /** - * 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. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { subscriptionId, providerId, location, options }, + listOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + subscriptionId: string, + providerId: string, + location: string, + nextLink: string, + options?: QuotaListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { subscriptionId, providerId, location, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.providerId, - Parameters.location1, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.CurrentQuotaLimitBase, headersMapper: Mappers.QuotaGetHeaders }, default: { - bodyMapper: Mappers.ExceptionResponse, - headersMapper: Mappers.QuotaGetHeaders + bodyMapper: Mappers.ExceptionResponse } }, - serializer -}; - -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits", + queryParameters: [Parameters.apiVersion1], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.providerId, - Parameters.location1 - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.location1, + Parameters.resourceName ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", + httpMethod: "PUT", responses: { 200: { - bodyMapper: Mappers.QuotaLimits, - headersMapper: Mappers.QuotaListHeaders + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 201: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 202: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 204: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse }, default: { - bodyMapper: Mappers.ExceptionResponse, - headersMapper: Mappers.QuotaListHeaders + bodyMapper: Mappers.ExceptionResponse } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", + requestBody: Parameters.createQuotaRequest, + queryParameters: [Parameters.apiVersion1], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.providerId, Parameters.location1, Parameters.resourceName ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "createQuotaRequest", - mapper: { - ...Mappers.CurrentQuotaLimitBase, - required: true - } - }, + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", + httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse }, 201: { - bodyMapper: Mappers.QuotaRequestSubmitResponse201 + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 202: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 204: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse }, default: { bodyMapper: Mappers.ExceptionResponse } }, - serializer -}; - -const beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", + requestBody: Parameters.createQuotaRequest, + queryParameters: [Parameters.apiVersion1], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.providerId, Parameters.location1, Parameters.resourceName ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "createQuotaRequest", - mapper: { - ...Mappers.CurrentQuotaLimitBase, - required: true - } - }, + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits", + httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse - }, - 201: { - bodyMapper: Mappers.QuotaRequestSubmitResponse201 + bodyMapper: Mappers.QuotaLimits, + headersMapper: Mappers.QuotaListHeaders }, default: { bodyMapper: Mappers.ExceptionResponse } }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1 + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.QuotaLimits, - headersMapper: Mappers.QuotaListHeaders + headersMapper: Mappers.QuotaListNextHeaders }, default: { - bodyMapper: Mappers.ExceptionResponse, - headersMapper: Mappers.QuotaListHeaders + bodyMapper: Mappers.ExceptionResponse } }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1 + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts b/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts index e16dee92ad3d..24ed7688d736 100644 --- a/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts +++ b/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts @@ -3,156 +3,190 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/quotaRequestStatusMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { QuotaRequestStatus } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { + QuotaRequestDetails, + QuotaRequestStatusListNextOptionalParams, + QuotaRequestStatusListOptionalParams, + QuotaRequestStatusGetOptionalParams, + QuotaRequestStatusGetResponse, + QuotaRequestStatusListResponse, + QuotaRequestStatusListNextResponse +} from "../models"; -/** Class representing a QuotaRequestStatus. */ -export class QuotaRequestStatus { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing QuotaRequestStatus operations. */ +export class QuotaRequestStatusImpl implements QuotaRequestStatus { + private readonly client: AzureReservationAPI; /** - * Create a QuotaRequestStatus. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class QuotaRequestStatus class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** - * 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. + * 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. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. - * @param id Quota Request ID. - * @param [options] The optional parameters - * @returns Promise - */ - get(subscriptionId: string, providerId: string, location: string, id: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param id Quota Request ID. - * @param callback The callback - */ - get(subscriptionId: string, providerId: string, location: string, id: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param id Quota Request ID. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(subscriptionId: string, providerId: string, location: string, id: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(subscriptionId: string, providerId: string, location: string, id: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + subscriptionId, + providerId, + location, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage( + subscriptionId, + providerId, + location, + options + ); + } + }; + } + + private async *listPagingPage( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): AsyncIterableIterator { + let result = await this._list( + subscriptionId, + providerId, + location, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( subscriptionId, providerId, location, - id, + continuationToken, options - }, - getOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + subscriptionId, + providerId, + location, + options + )) { + yield* page; + } } /** - * 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. - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param [options] The optional parameters - * @returns Promise - */ - list(subscriptionId: string, providerId: string, location: string, options?: Models.QuotaRequestStatusListOptionalParams): Promise; - /** + * 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. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. - * @param callback The callback + * @param id Quota Request ID. + * @param options The options parameters. */ - list(subscriptionId: string, providerId: string, location: string, callback: msRest.ServiceCallback): void; + get( + subscriptionId: string, + providerId: string, + location: string, + id: string, + options?: QuotaRequestStatusGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { subscriptionId, providerId, location, id, options }, + getOperationSpec + ); + } + /** + * 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. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - list(subscriptionId: string, providerId: string, location: string, options: Models.QuotaRequestStatusListOptionalParams, callback: msRest.ServiceCallback): void; - list(subscriptionId: string, providerId: string, location: string, options?: Models.QuotaRequestStatusListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - subscriptionId, - providerId, - location, - options - }, - listOperationSpec, - callback) as Promise; + { subscriptionId, providerId, location, options }, + listOperationSpec + ); } /** - * 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. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: Models.QuotaRequestStatusListNextOptionalParams): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: Models.QuotaRequestStatusListNextOptionalParams, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: Models.QuotaRequestStatusListNextOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + subscriptionId: string, + providerId: string, + location: string, + nextLink: string, + options?: QuotaRequestStatusListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { subscriptionId, providerId, location, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.providerId, - Parameters.location1, - Parameters.id - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.QuotaRequestDetails @@ -161,26 +195,21 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - serializer -}; - -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests", + queryParameters: [Parameters.apiVersion1], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.providerId, - Parameters.location1 - ], - queryParameters: [ - Parameters.apiVersion1, - Parameters.filter, - Parameters.top, - Parameters.skiptoken - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.location1, + Parameters.id ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.QuotaRequestDetailsList @@ -189,25 +218,24 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - serializer -}; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], queryParameters: [ - Parameters.apiVersion1, Parameters.filter, + Parameters.apiVersion1, Parameters.top, - Parameters.skiptoken + Parameters.skiptoken1 ], - headerParameters: [ - Parameters.acceptLanguage + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1 ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.QuotaRequestDetailsList @@ -216,5 +244,19 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, + queryParameters: [ + Parameters.filter, + Parameters.apiVersion1, + Parameters.top, + Parameters.skiptoken1 + ], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1 + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/reservation.ts b/sdk/reservations/arm-reservations/src/operations/reservation.ts index 6dde501a1860..431cc065169f 100644 --- a/sdk/reservations/arm-reservations/src/operations/reservation.ts +++ b/sdk/reservations/arm-reservations/src/operations/reservation.ts @@ -3,382 +3,834 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/reservationMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Reservation } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ReservationResponse, + ReservationListNextOptionalParams, + ReservationListOptionalParams, + ReservationListRevisionsNextOptionalParams, + ReservationListRevisionsOptionalParams, + ReservationListAllNextOptionalParams, + ReservationListAllOptionalParams, + AvailableScopeRequest, + ReservationAvailableScopesOptionalParams, + ReservationAvailableScopesResponse, + SplitRequest, + ReservationSplitOptionalParams, + ReservationSplitResponse, + MergeRequest, + ReservationMergeOptionalParams, + ReservationMergeResponse, + ReservationListResponse, + ReservationGetOptionalParams, + ReservationGetResponse, + Patch, + ReservationUpdateOptionalParams, + ReservationUpdateResponse, + ReservationListRevisionsResponse, + ReservationListAllResponse, + ReservationListNextResponse, + ReservationListRevisionsNextResponse, + ReservationListAllNextResponse +} from "../models"; -/** Class representing a Reservation. */ -export class Reservation { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing Reservation operations. */ +export class ReservationImpl implements Reservation { + private readonly client: AzureReservationAPI; /** - * Create a Reservation. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class Reservation class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** - * Get Available Scopes for `Reservation`. - * @summary Get Available Scopes for `Reservation`. + * List `Reservation`s within a single `ReservationOrder`. * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item - * @param body - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - availableScopes(reservationOrderId: string, reservationId: string, body: Models.AvailableScopeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginAvailableScopes(reservationOrderId, reservationId, body, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + public list( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(reservationOrderId, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(reservationOrderId, options); + } + }; } - /** - * Split a `Reservation` into two `Reservation`s with specified quantity distribution. - * @summary Split the `Reservation`. - * @param reservationOrderId Order Id of the reservation - * @param body Information needed to Split a reservation item - * @param [options] The optional parameters - * @returns Promise - */ - split(reservationOrderId: string, body: Models.SplitRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginSplit(reservationOrderId, body, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + private async *listPagingPage( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(reservationOrderId, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + reservationOrderId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } } - /** - * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged - * must have same properties. - * @summary Merges two `Reservation`s. - * @param reservationOrderId Order Id of the reservation - * @param body Information needed for commercial request for a reservation - * @param [options] The optional parameters - * @returns Promise - */ - merge(reservationOrderId: string, body: Models.MergeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginMerge(reservationOrderId, body, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + private async *listPagingAll( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(reservationOrderId, options)) { + yield* page; + } } /** - * List `Reservation`s within a single `ReservationOrder`. - * @summary Get `Reservation`s in a given reservation Order - * @param reservationOrderId Order Id of the reservation - * @param [options] The optional parameters - * @returns Promise - */ - list(reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param reservationOrderId Order Id of the reservation - * @param callback The callback - */ - list(reservationOrderId: string, callback: msRest.ServiceCallback): void; - /** + * List of all the revisions for the `Reservation`. + * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - list(reservationOrderId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(reservationOrderId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public listRevisions( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listRevisionsPagingAll( + reservationId, + reservationOrderId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listRevisionsPagingPage( + reservationId, + reservationOrderId, + options + ); + } + }; + } + + private async *listRevisionsPagingPage( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): AsyncIterableIterator { + let result = await this._listRevisions( + reservationId, + reservationOrderId, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listRevisionsNext( + reservationId, reservationOrderId, + continuationToken, options - }, - listOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listRevisionsPagingAll( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listRevisionsPagingPage( + reservationId, + reservationOrderId, + options + )) { + yield* page; + } } /** - * Get specific `Reservation` details. - * @summary Get `Reservation` details. - * @param reservationId Id of the Reservation Item - * @param reservationOrderId Order Id of the reservation - * @param [options] The optional parameters - * @returns Promise + * List the reservations and the roll up counts of reservations group by provisioning states that the + * user has access to in the current tenant. + * @param options The options parameters. */ - get(reservationId: string, reservationOrderId: string, options?: Models.ReservationGetOptionalParams): Promise; + public listAll( + options?: ReservationListAllOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAllPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listAllPagingPage(options); + } + }; + } + + private async *listAllPagingPage( + options?: ReservationListAllOptionalParams + ): AsyncIterableIterator { + let result = await this._listAll(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listAllNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listAllPagingAll( + options?: ReservationListAllOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAllPagingPage(options)) { + yield* page; + } + } + /** - * @param reservationId Id of the Reservation Item + * Get Available Scopes for `Reservation`. + * * @param reservationOrderId Order Id of the reservation - * @param callback The callback - */ - get(reservationId: string, reservationOrderId: string, callback: msRest.ServiceCallback): void; - /** * @param reservationId Id of the Reservation Item - * @param reservationOrderId Order Id of the reservation - * @param options The optional parameters - * @param callback The callback + * @param body Available scope + * @param options The options parameters. */ - get(reservationId: string, reservationOrderId: string, options: Models.ReservationGetOptionalParams, callback: msRest.ServiceCallback): void; - get(reservationId: string, reservationOrderId: string, options?: Models.ReservationGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - reservationId, - reservationOrderId, - options - }, - getOperationSpec, - callback) as Promise; + async beginAvailableScopes( + reservationOrderId: string, + reservationId: string, + body: AvailableScopeRequest, + options?: ReservationAvailableScopesOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationAvailableScopesResponse + > + > { + 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, reservationId, body, options }, + availableScopesOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Updates the applied scopes of the `Reservation`. - * @summary Updates a `Reservation`. + * Get Available Scopes for `Reservation`. + * * @param reservationOrderId Order Id of the reservation * @param reservationId Id of the Reservation Item - * @param parameters Information needed to patch a reservation item - * @param [options] The optional parameters - * @returns Promise + * @param body Available scope + * @param options The options parameters. */ - update(reservationOrderId: string, reservationId: string, parameters: Models.Patch, options?: msRest.RequestOptionsBase): Promise { - return this.beginUpdate(reservationOrderId, reservationId, parameters, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginAvailableScopesAndWait( + reservationOrderId: string, + reservationId: string, + body: AvailableScopeRequest, + options?: ReservationAvailableScopesOptionalParams + ): Promise { + const poller = await this.beginAvailableScopes( + reservationOrderId, + reservationId, + body, + options + ); + return poller.pollUntilDone(); } /** - * List of all the revisions for the `Reservation`. - * @summary Get `Reservation` revisions. - * @param reservationId Id of the Reservation Item + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. * @param reservationOrderId Order Id of the reservation - * @param [options] The optional parameters - * @returns Promise + * @param body Information needed to Split a reservation item + * @param options The options parameters. */ - listRevisions(reservationId: string, reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; + async beginSplit( + reservationOrderId: string, + body: SplitRequest, + options?: ReservationSplitOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationSplitResponse + > + > { + 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 }, + splitOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + } + /** - * @param reservationId Id of the Reservation Item + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. * @param reservationOrderId Order Id of the reservation - * @param callback The callback + * @param body Information needed to Split a reservation item + * @param options The options parameters. */ - listRevisions(reservationId: string, reservationOrderId: string, callback: msRest.ServiceCallback): void; + async beginSplitAndWait( + reservationOrderId: string, + body: SplitRequest, + options?: ReservationSplitOptionalParams + ): Promise { + const poller = await this.beginSplit(reservationOrderId, body, options); + return poller.pollUntilDone(); + } + /** - * @param reservationId Id of the Reservation Item + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. * @param reservationOrderId Order Id of the reservation - * @param options The optional parameters - * @param callback The callback + * @param body Information needed for commercial request for a reservation + * @param options The options parameters. */ - listRevisions(reservationId: string, reservationOrderId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listRevisions(reservationId: string, reservationOrderId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - reservationId, - reservationOrderId, - options - }, - listRevisionsOperationSpec, - callback) as Promise; + async beginMerge( + reservationOrderId: string, + body: MergeRequest, + options?: ReservationMergeOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationMergeResponse + > + > { + 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 }, + mergeOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); } /** - * Get Available Scopes for `Reservation`. - * @summary Get Available Scopes for `Reservation`. + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item - * @param body - * @param [options] The optional parameters - * @returns Promise + * @param body Information needed for commercial request for a reservation + * @param options The options parameters. */ - beginAvailableScopes(reservationOrderId: string, reservationId: string, body: Models.AvailableScopeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - reservationId, - body, - options - }, - beginAvailableScopesOperationSpec, - options); + async beginMergeAndWait( + reservationOrderId: string, + body: MergeRequest, + options?: ReservationMergeOptionalParams + ): Promise { + const poller = await this.beginMerge(reservationOrderId, body, options); + return poller.pollUntilDone(); } /** - * Split a `Reservation` into two `Reservation`s with specified quantity distribution. - * @summary Split the `Reservation`. + * List `Reservation`s within a single `ReservationOrder`. * @param reservationOrderId Order Id of the reservation - * @param body Information needed to Split a reservation item - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginSplit(reservationOrderId: string, body: Models.SplitRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - body, - options - }, - beginSplitOperationSpec, - options); + private _list( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationOrderId, options }, + listOperationSpec + ); } /** - * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged - * must have same properties. - * @summary Merges two `Reservation`s. + * Get specific `Reservation` details. + * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation - * @param body Information needed for commercial request for a reservation - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginMerge(reservationOrderId: string, body: Models.MergeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - body, - options - }, - beginMergeOperationSpec, - options); + get( + reservationId: string, + reservationOrderId: string, + options?: ReservationGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationId, reservationOrderId, options }, + getOperationSpec + ); } /** * Updates the applied scopes of the `Reservation`. - * @summary Updates a `Reservation`. * @param reservationOrderId Order Id of the reservation * @param reservationId Id of the Reservation Item * @param parameters Information needed to patch a reservation item - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginUpdate(reservationOrderId: string, reservationId: string, parameters: Models.Patch, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - reservationId, - parameters, - options - }, - beginUpdateOperationSpec, - options); + async beginUpdate( + reservationOrderId: string, + reservationId: string, + parameters: Patch, + options?: ReservationUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationUpdateResponse + > + > { + 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, reservationId, parameters, options }, + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * List `Reservation`s within a single `ReservationOrder`. - * @summary Get `Reservation`s in a given reservation Order - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * Updates the applied scopes of the `Reservation`. + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param parameters Information needed to patch a reservation item + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + async beginUpdateAndWait( + reservationOrderId: string, + reservationId: string, + parameters: Patch, + options?: ReservationUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + reservationOrderId, + reservationId, + parameters, + options + ); + return poller.pollUntilDone(); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * List of all the revisions for the `Reservation`. + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _listRevisions( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationId, reservationOrderId, options }, + listRevisionsOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * List the reservations and the roll up counts of reservations group by provisioning states that the + * user has access to in the current tenant. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + private _listAll( + options?: ReservationListAllOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listAllOperationSpec); } /** - * List of all the revisions for the `Reservation`. - * @summary Get `Reservation` revisions. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListNext + * @param reservationOrderId Order Id of the reservation + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listRevisionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + private _listNext( + reservationOrderId: string, + nextLink: string, + options?: ReservationListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationOrderId, nextLink, options }, + listNextOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListRevisionsNext + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param nextLink The nextLink from the previous successful call to the ListRevisions method. + * @param options The options parameters. */ - listRevisionsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _listRevisionsNext( + reservationId: string, + reservationOrderId: string, + nextLink: string, + options?: ReservationListRevisionsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationId, reservationOrderId, nextLink, options }, + listRevisionsNextOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListAllNext + * @param nextLink The nextLink from the previous successful call to the ListAll method. + * @param options The options parameters. */ - listRevisionsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listRevisionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listAllNext( + nextLink: string, + options?: ReservationListAllNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listRevisionsNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listAllNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations", +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const availableScopesOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AvailableScopeProperties + }, + 201: { + bodyMapper: Mappers.AvailableScopeProperties + }, + 202: { + bodyMapper: Mappers.AvailableScopeProperties + }, + 204: { + bodyMapper: Mappers.AvailableScopeProperties + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.reservationOrderId, + Parameters.reservationId ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const splitOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split", + httpMethod: "POST", responses: { 200: { - bodyMapper: Mappers.ReservationList + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 201: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 202: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 204: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } }, default: { bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body1, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", - urlParameters: [ - Parameters.reservationId, - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0, - Parameters.expand0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], +const mergeOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge", + httpMethod: "POST", responses: { 200: { - bodyMapper: Mappers.ReservationResponse + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 201: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 202: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 204: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } }, default: { bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body2, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listRevisionsOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations", httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions", - urlParameters: [ - Parameters.reservationId, - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ReservationList @@ -387,169 +839,132 @@ const listRevisionsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.accept], serializer }; - -const beginAvailableScopesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes", - urlParameters: [ - Parameters.reservationOrderId, - Parameters.reservationId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.AvailableScopeRequest, - required: true - } - }, +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", + httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.AvailableScopeProperties + bodyMapper: Mappers.ReservationResponse }, default: { bodyMapper: Mappers.ErrorModel } }, - serializer -}; - -const beginSplitOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split", + queryParameters: [Parameters.apiVersion, Parameters.expand], urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.reservationOrderId, + Parameters.reservationId ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.SplitRequest, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", + httpMethod: "PATCH", responses: { 200: { - bodyMapper: { - serializedName: "parsedResponse", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationResponse" - } - } - } - } + bodyMapper: Mappers.ReservationResponse + }, + 201: { + bodyMapper: Mappers.ReservationResponse + }, + 202: { + bodyMapper: Mappers.ReservationResponse + }, + 204: { + bodyMapper: Mappers.ReservationResponse }, - 202: {}, default: { bodyMapper: Mappers.ErrorModel } }, - serializer -}; - -const beginMergeOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge", + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.reservationOrderId, + Parameters.reservationId ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.MergeRequest, - required: true - } - }, + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const listRevisionsOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions", + httpMethod: "GET", responses: { 200: { - bodyMapper: { - serializedName: "parsedResponse", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationResponse" - } - } - } - } + bodyMapper: Mappers.ReservationList }, - 202: {}, default: { bodyMapper: Mappers.ErrorModel } }, - serializer -}; - -const beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.reservationOrderId, Parameters.reservationId ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.Patch, - required: true + headerParameters: [Parameters.accept], + serializer +}; +const listAllOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/reservations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ReservationsListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.orderby, + Parameters.refreshSummary, + Parameters.skiptoken, + Parameters.selectedState, + Parameters.take + ], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ReservationResponse + bodyMapper: Mappers.ReservationList }, - 202: {}, default: { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.reservationOrderId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listRevisionsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ReservationList @@ -558,29 +973,37 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.reservationOrderId, + Parameters.reservationId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listRevisionsNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listAllNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ReservationList + bodyMapper: Mappers.ReservationsListResult }, default: { - bodyMapper: Mappers.ErrorModel + 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 78d274728c65..81ab9fa30ca4 100644 --- a/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts +++ b/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts @@ -3,192 +3,251 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/reservationOrderMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ReservationOrder } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ReservationOrderResponse, + ReservationOrderListNextOptionalParams, + ReservationOrderListOptionalParams, + PurchaseRequest, + ReservationOrderCalculateOptionalParams, + ReservationOrderCalculateResponse, + ReservationOrderListResponse, + ReservationOrderPurchaseOptionalParams, + ReservationOrderPurchaseResponse, + ReservationOrderGetOptionalParams, + ReservationOrderGetResponse, + ChangeDirectoryRequest, + ReservationOrderChangeDirectoryOptionalParams, + ReservationOrderChangeDirectoryResponse, + ReservationOrderListNextResponse +} from "../models"; -/** Class representing a ReservationOrder. */ -export class ReservationOrder { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing ReservationOrder operations. */ +export class ReservationOrderImpl implements ReservationOrder { + private readonly client: AzureReservationAPI; /** - * Create a ReservationOrder. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class ReservationOrder class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** - * Calculate price for placing a `ReservationOrder`. - * @summary Calculate price for a `ReservationOrder`. - * @param body Information needed for calculate or purchase reservation - * @param [options] The optional parameters - * @returns Promise - */ - calculate(body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise; - /** - * @param body Information needed for calculate or purchase reservation - * @param callback The callback + * List of all the `ReservationOrder`s that the user has access to in the current tenant. + * @param options The options parameters. */ - calculate(body: Models.PurchaseRequest, callback: msRest.ServiceCallback): void; + public list( + options?: ReservationOrderListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: ReservationOrderListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: ReservationOrderListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + /** + * Calculate price for placing a `ReservationOrder`. * @param body Information needed for calculate or purchase reservation - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - calculate(body: Models.PurchaseRequest, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - calculate(body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + calculate( + body: PurchaseRequest, + options?: ReservationOrderCalculateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - body, - options - }, - calculateOperationSpec, - callback) as Promise; + { body, options }, + calculateOperationSpec + ); } /** * List of all the `ReservationOrder`s that the user has access to in the current tenant. - * @summary Get all `ReservationOrder`s. - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback + * @param options The options parameters. */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; + private _list( + options?: ReservationOrderListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Purchase `ReservationOrder` and create resource under the specified URI. - * @summary Purchase `ReservationOrder` * @param reservationOrderId Order Id of the reservation * @param body Information needed for calculate or purchase reservation - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - purchase(reservationOrderId: string, body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPurchase(reservationOrderId, body, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPurchase( + reservationOrderId: string, + body: PurchaseRequest, + options?: ReservationOrderPurchaseOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationOrderPurchaseResponse + > + > { + 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 }, + purchaseOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); } /** - * Get the details of the `ReservationOrder`. - * @summary Get a specific `ReservationOrder`. - * @param reservationOrderId Order Id of the reservation - * @param [options] The optional parameters - * @returns Promise - */ - get(reservationOrderId: string, options?: Models.ReservationOrderGetOptionalParams): Promise; - /** + * Purchase `ReservationOrder` and create resource under the specified URI. * @param reservationOrderId Order Id of the reservation - * @param callback The callback + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. */ - get(reservationOrderId: string, callback: msRest.ServiceCallback): void; + async beginPurchaseAndWait( + reservationOrderId: string, + body: PurchaseRequest, + options?: ReservationOrderPurchaseOptionalParams + ): Promise { + const poller = await this.beginPurchase(reservationOrderId, body, options); + return poller.pollUntilDone(); + } + /** + * Get the details of the `ReservationOrder`. * @param reservationOrderId Order Id of the reservation - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(reservationOrderId: string, options: Models.ReservationOrderGetOptionalParams, callback: msRest.ServiceCallback): void; - get(reservationOrderId: string, options?: Models.ReservationOrderGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + reservationOrderId: string, + options?: ReservationOrderGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - reservationOrderId, - options - }, - getOperationSpec, - callback) as Promise; + { reservationOrderId, options }, + getOperationSpec + ); } /** - * Purchase `ReservationOrder` and create resource under the specified URI. - * @summary Purchase `ReservationOrder` + * Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant + * id * @param reservationOrderId Order Id of the reservation - * @param body Information needed for calculate or purchase reservation - * @param [options] The optional parameters - * @returns Promise + * @param body Information needed to change directory of reservation order + * @param options The options parameters. */ - beginPurchase(reservationOrderId: string, body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - body, - options - }, - beginPurchaseOperationSpec, - options); + changeDirectory( + reservationOrderId: string, + body: ChangeDirectoryRequest, + options?: ReservationOrderChangeDirectoryOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationOrderId, body, options }, + changeDirectoryOperationSpec + ); } /** - * List of all the `ReservationOrder`s that the user has access to in the current tenant. - * @summary Get all `ReservationOrder`s. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: ReservationOrderListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const calculateOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const calculateOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/calculatePrice", httpMethod: "POST", - path: "providers/Microsoft.Capacity/calculatePrice", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.PurchaseRequest, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.CalculatePriceResponse @@ -197,18 +256,16 @@ const calculateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body3, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/reservationOrders", httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ReservationOrderList @@ -217,79 +274,76 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", - urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0, - Parameters.expand1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], +const purchaseOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.ReservationOrderResponse }, + 201: { + bodyMapper: Mappers.ReservationOrderResponse + }, + 202: { + bodyMapper: Mappers.ReservationOrderResponse + }, + 204: { + bodyMapper: Mappers.ReservationOrderResponse + }, default: { bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body3, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const beginPurchaseOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", - urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.PurchaseRequest, - required: true - } - }, +const getOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ReservationOrderResponse }, - 202: { - bodyMapper: Mappers.ReservationOrderResponse + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion, Parameters.expand1], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.accept], + serializer +}; +const changeDirectoryOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ChangeDirectoryResponse }, default: { bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body4, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ReservationOrderList @@ -298,5 +352,8 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/calculateExchange.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/calculateExchange.ts new file mode 100644 index 000000000000..444dbafe32d6 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/calculateExchange.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + CalculateExchangeRequest, + CalculateExchangePostOptionalParams, + CalculateExchangePostResponse +} from "../models"; + +/** Interface representing a CalculateExchange. */ +export interface CalculateExchange { + /** + * Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param options The options parameters. + */ + beginPost( + body: CalculateExchangeRequest, + options?: CalculateExchangePostOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CalculateExchangePostResponse + > + >; + /** + * Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param options The options parameters. + */ + beginPostAndWait( + body: CalculateExchangeRequest, + options?: CalculateExchangePostOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/exchange.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/exchange.ts new file mode 100644 index 000000000000..28f455d10a84 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/exchange.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ExchangeRequest, + ExchangePostOptionalParams, + ExchangePostResponse +} from "../models"; + +/** Interface representing a Exchange. */ +export interface Exchange { + /** + * Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param options The options parameters. + */ + beginPost( + body: ExchangeRequest, + options?: ExchangePostOptionalParams + ): Promise< + PollerLike, ExchangePostResponse> + >; + /** + * Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param options The options parameters. + */ + beginPostAndWait( + body: ExchangeRequest, + options?: ExchangePostOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/index.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..425138628c9e --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/index.ts @@ -0,0 +1,15 @@ +/* + * 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 * from "./reservation"; +export * from "./reservationOrder"; +export * from "./operation"; +export * from "./calculateExchange"; +export * from "./exchange"; +export * from "./quota"; +export * from "./quotaRequestStatus"; diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/operation.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/operation.ts new file mode 100644 index 000000000000..e22ef838b2e3 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/operation.ts @@ -0,0 +1,22 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { OperationResponse, OperationListOptionalParams } from "../models"; + +/// +/** Interface representing a Operation. */ +export interface Operation { + /** + * List all the operations. + * @param options The options parameters. + */ + list( + options?: OperationListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/quota.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/quota.ts new file mode 100644 index 000000000000..350994eb4e36 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/quota.ts @@ -0,0 +1,169 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + CurrentQuotaLimitBase, + QuotaListOptionalParams, + QuotaGetOptionalParams, + QuotaGetResponse, + QuotaCreateOrUpdateOptionalParams, + QuotaCreateOrUpdateResponse, + QuotaUpdateOptionalParams, + QuotaUpdateResponse +} from "../models"; + +/// +/** Interface representing a Quota. */ +export interface Quota { + /** + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param options The options parameters. + */ + list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): PagedAsyncIterableIterator; + /** + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param options The options parameters. + */ + get( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + options?: QuotaGetOptionalParams + ): Promise; + /** + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + beginCreateOrUpdate( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + QuotaCreateOrUpdateResponse + > + >; + /** + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaCreateOrUpdateOptionalParams + ): Promise; + /** + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Payload for the quota request. + * @param options The options parameters. + */ + beginUpdate( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaUpdateOptionalParams + ): Promise< + PollerLike, QuotaUpdateResponse> + >; + /** + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Payload for the quota request. + * @param options The options parameters. + */ + beginUpdateAndWait( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaUpdateOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/quotaRequestStatus.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/quotaRequestStatus.ts new file mode 100644 index 000000000000..26590a2a71f7 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/quotaRequestStatus.ts @@ -0,0 +1,51 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + QuotaRequestDetails, + QuotaRequestStatusListOptionalParams, + QuotaRequestStatusGetOptionalParams, + QuotaRequestStatusGetResponse +} from "../models"; + +/// +/** Interface representing a QuotaRequestStatus. */ +export interface QuotaRequestStatus { + /** + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param options The options parameters. + */ + list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): PagedAsyncIterableIterator; + /** + * 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. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @param options The options parameters. + */ + get( + subscriptionId: string, + providerId: string, + location: string, + id: string, + options?: QuotaRequestStatusGetOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts new file mode 100644 index 000000000000..a483bc74afa1 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts @@ -0,0 +1,194 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ReservationResponse, + ReservationListOptionalParams, + ReservationListRevisionsOptionalParams, + ReservationListAllOptionalParams, + AvailableScopeRequest, + ReservationAvailableScopesOptionalParams, + ReservationAvailableScopesResponse, + SplitRequest, + ReservationSplitOptionalParams, + ReservationSplitResponse, + MergeRequest, + ReservationMergeOptionalParams, + ReservationMergeResponse, + ReservationGetOptionalParams, + ReservationGetResponse, + Patch, + ReservationUpdateOptionalParams, + ReservationUpdateResponse +} from "../models"; + +/// +/** Interface representing a Reservation. */ +export interface Reservation { + /** + * List `Reservation`s within a single `ReservationOrder`. + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + list( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): PagedAsyncIterableIterator; + /** + * List of all the revisions for the `Reservation`. + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + listRevisions( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): PagedAsyncIterableIterator; + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the + * user has access to in the current tenant. + * @param options The options parameters. + */ + listAll( + options?: ReservationListAllOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param body Available scope + * @param options The options parameters. + */ + beginAvailableScopes( + reservationOrderId: string, + reservationId: string, + body: AvailableScopeRequest, + options?: ReservationAvailableScopesOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationAvailableScopesResponse + > + >; + /** + * Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param body Available scope + * @param options The options parameters. + */ + beginAvailableScopesAndWait( + reservationOrderId: string, + reservationId: string, + body: AvailableScopeRequest, + options?: ReservationAvailableScopesOptionalParams + ): Promise; + /** + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to Split a reservation item + * @param options The options parameters. + */ + beginSplit( + reservationOrderId: string, + body: SplitRequest, + options?: ReservationSplitOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationSplitResponse + > + >; + /** + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to Split a reservation item + * @param options The options parameters. + */ + beginSplitAndWait( + reservationOrderId: string, + body: SplitRequest, + options?: ReservationSplitOptionalParams + ): Promise; + /** + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for commercial request for a reservation + * @param options The options parameters. + */ + beginMerge( + reservationOrderId: string, + body: MergeRequest, + options?: ReservationMergeOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationMergeResponse + > + >; + /** + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for commercial request for a reservation + * @param options The options parameters. + */ + beginMergeAndWait( + reservationOrderId: string, + body: MergeRequest, + options?: ReservationMergeOptionalParams + ): Promise; + /** + * Get specific `Reservation` details. + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + get( + reservationId: string, + reservationOrderId: 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 parameters Information needed to patch a reservation item + * @param options The options parameters. + */ + beginUpdate( + reservationOrderId: string, + reservationId: string, + parameters: Patch, + options?: ReservationUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationUpdateResponse + > + >; + /** + * Updates the applied scopes of the `Reservation`. + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param parameters Information needed to patch a reservation item + * @param options The options parameters. + */ + beginUpdateAndWait( + reservationOrderId: string, + reservationId: string, + parameters: Patch, + options?: ReservationUpdateOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/reservationOrder.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservationOrder.ts new file mode 100644 index 000000000000..bfab0025fe09 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservationOrder.ts @@ -0,0 +1,93 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ReservationOrderResponse, + ReservationOrderListOptionalParams, + PurchaseRequest, + ReservationOrderCalculateOptionalParams, + ReservationOrderCalculateResponse, + ReservationOrderPurchaseOptionalParams, + ReservationOrderPurchaseResponse, + ReservationOrderGetOptionalParams, + ReservationOrderGetResponse, + ChangeDirectoryRequest, + ReservationOrderChangeDirectoryOptionalParams, + ReservationOrderChangeDirectoryResponse +} from "../models"; + +/// +/** Interface representing a ReservationOrder. */ +export interface ReservationOrder { + /** + * List of all the `ReservationOrder`s that the user has access to in the current tenant. + * @param options The options parameters. + */ + list( + options?: ReservationOrderListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Calculate price for placing a `ReservationOrder`. + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. + */ + calculate( + body: PurchaseRequest, + options?: ReservationOrderCalculateOptionalParams + ): Promise; + /** + * Purchase `ReservationOrder` and create resource under the specified URI. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. + */ + beginPurchase( + reservationOrderId: string, + body: PurchaseRequest, + options?: ReservationOrderPurchaseOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationOrderPurchaseResponse + > + >; + /** + * Purchase `ReservationOrder` and create resource under the specified URI. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. + */ + beginPurchaseAndWait( + reservationOrderId: string, + body: PurchaseRequest, + options?: ReservationOrderPurchaseOptionalParams + ): Promise; + /** + * Get the details of the `ReservationOrder`. + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + get( + reservationOrderId: string, + options?: ReservationOrderGetOptionalParams + ): Promise; + /** + * Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant + * id + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to change directory of reservation order + * @param options The options parameters. + */ + changeDirectory( + reservationOrderId: string, + body: ChangeDirectoryRequest, + options?: ReservationOrderChangeDirectoryOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/test/sampleTest.ts b/sdk/reservations/arm-reservations/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/reservations/arm-reservations/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/reservations/arm-reservations/tsconfig.json b/sdk/reservations/arm-reservations/tsconfig.json index 422b584abd5e..6e3251194117 100644 --- a/sdk/reservations/arm-reservations/tsconfig.json +++ b/sdk/reservations/arm-reservations/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,9 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", + "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/reservations/ci.yml b/sdk/reservations/ci.yml new file mode 100644 index 000000000000..126e5f98a686 --- /dev/null +++ b/sdk/reservations/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/reservations/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/reservations/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: reservations + Artifacts: + - name: azure-arm-reservations + safeName: azurearmreservations + \ No newline at end of file