From 62cff18f7755d6f4c35c38d830c0690d5fcf56b0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 14 Nov 2022 06:16:49 +0000 Subject: [PATCH] CodeGen from PR 21340 in Azure/azure-rest-api-specs [Microsoft.BillingBenefits] Adding 2022-11-01 stable version (#21340) * New Swagger Spec File * New Swagger Example Spec File * New Readme Config File * New Azure AZ Readme Config File * New Azure CLI Readme Config File * New Go Language Readme Config File * New Python Language Readme Config File * New Typescript Language Readme Config File * New C# Language Readme Config File * base * Savings plan order get/list and savings plan item get * List SavingsPlan API * CalculateMigrationCost * Fixing list api summary property * Update * elevate * Fixing * ReservationOrderAlias * Validate swagger and example * Fix style * update * Remove audit api * Comments * comments and remove migration api * Fixing pipeline * Update elevate api response * Update SavingsPlanOrderElevate.json * update * Update billingbenefits.json * Update patch api * Addressed comments * Update ReservationOrderAliasCreate.json * Update readme.md * Update readme.md * Update readme.md * 200 in order alias put * Update billingbenefits.json * Update readme.md --- common/config/rush/pnpm-lock.yaml | 38 +- rush.json | 9 +- .../arm-billingbenefits/CHANGELOG.md | 5 + .../arm-billingbenefits/LICENSE | 21 + .../arm-billingbenefits/README.md | 109 + .../arm-billingbenefits/_meta.json | 8 + .../arm-billingbenefits/api-extractor.json | 31 + .../arm-billingbenefits/package.json | 113 ++ .../review/arm-billingbenefits.api.md | 778 ++++++++ .../arm-billingbenefits/rollup.config.js | 122 ++ .../arm-billingbenefits/sample.env | 4 + .../src/billingBenefitsRP.ts | 170 ++ .../arm-billingbenefits/src/index.ts | 12 + .../arm-billingbenefits/src/lroImpl.ts | 34 + .../arm-billingbenefits/src/models/index.ts | 1220 ++++++++++++ .../arm-billingbenefits/src/models/mappers.ts | 1763 +++++++++++++++++ .../src/models/parameters.ts | 225 +++ .../src/operations/index.ts | 17 + .../src/operations/operations.ts | 137 ++ .../src/operations/reservationOrderAlias.ts | 186 ++ .../src/operations/savingsPlan.ts | 122 ++ .../src/operations/savingsPlanOrder.ts | 205 ++ .../src/operations/savingsPlanOrderAlias.ts | 186 ++ .../src/operations/savingsPlanPurchase.ts | 67 + .../src/operations/savingsPlanUpdate.ts | 76 + .../src/operations/savingsPlans.ts | 153 ++ .../src/operations/savingsPlansInOrder.ts | 157 ++ .../src/operationsInterfaces/index.ts | 17 + .../src/operationsInterfaces/operations.ts | 22 + .../reservationOrderAlias.ts | 56 + .../src/operationsInterfaces/savingsPlan.ts | 43 + .../operationsInterfaces/savingsPlanOrder.ts | 47 + .../savingsPlanOrderAlias.ts | 56 + .../savingsPlanPurchase.ts | 26 + .../operationsInterfaces/savingsPlanUpdate.ts | 30 + .../src/operationsInterfaces/savingsPlans.ts | 22 + .../savingsPlansInOrder.ts | 27 + .../arm-billingbenefits/test/sampleTest.ts | 43 + .../arm-billingbenefits/tsconfig.json | 27 + sdk/billingbenefits/ci.mgmt.yml | 38 + 40 files changed, 6416 insertions(+), 6 deletions(-) create mode 100644 sdk/billingbenefits/arm-billingbenefits/CHANGELOG.md create mode 100644 sdk/billingbenefits/arm-billingbenefits/LICENSE create mode 100644 sdk/billingbenefits/arm-billingbenefits/README.md create mode 100644 sdk/billingbenefits/arm-billingbenefits/_meta.json create mode 100644 sdk/billingbenefits/arm-billingbenefits/api-extractor.json create mode 100644 sdk/billingbenefits/arm-billingbenefits/package.json create mode 100644 sdk/billingbenefits/arm-billingbenefits/review/arm-billingbenefits.api.md create mode 100644 sdk/billingbenefits/arm-billingbenefits/rollup.config.js create mode 100644 sdk/billingbenefits/arm-billingbenefits/sample.env create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/billingBenefitsRP.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/index.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/lroImpl.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/models/index.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/models/mappers.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/models/parameters.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/index.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/operations.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/reservationOrderAlias.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlan.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanOrder.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanOrderAlias.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanPurchase.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanUpdate.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlans.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlansInOrder.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/index.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/operations.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/reservationOrderAlias.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlan.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanOrder.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanOrderAlias.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanPurchase.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanUpdate.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlans.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlansInOrder.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/test/sampleTest.ts create mode 100644 sdk/billingbenefits/arm-billingbenefits/tsconfig.json create mode 100644 sdk/billingbenefits/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 7cfbf65d0143..89d7c3eed457 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -39,6 +39,7 @@ specifiers: '@rush-temp/arm-azurestackhci': file:./projects/arm-azurestackhci.tgz '@rush-temp/arm-batch': file:./projects/arm-batch.tgz '@rush-temp/arm-billing': file:./projects/arm-billing.tgz + '@rush-temp/arm-billingbenefits': file:./projects/arm-billingbenefits.tgz '@rush-temp/arm-botservice': file:./projects/arm-botservice.tgz '@rush-temp/arm-cdn': file:./projects/arm-cdn.tgz '@rush-temp/arm-changeanalysis': file:./projects/arm-changeanalysis.tgz @@ -364,6 +365,7 @@ dependencies: '@rush-temp/arm-azurestackhci': file:projects/arm-azurestackhci.tgz '@rush-temp/arm-batch': file:projects/arm-batch.tgz '@rush-temp/arm-billing': file:projects/arm-billing.tgz + '@rush-temp/arm-billingbenefits': file:projects/arm-billingbenefits.tgz '@rush-temp/arm-botservice': file:projects/arm-botservice.tgz '@rush-temp/arm-cdn': file:projects/arm-cdn.tgz '@rush-temp/arm-changeanalysis': file:projects/arm-changeanalysis.tgz @@ -1727,6 +1729,7 @@ packages: /@opentelemetry/api-metrics/0.33.0: resolution: {integrity: sha512-78evfPRRRnJA6uZ3xuBuS3VZlXTO/LRs+Ff1iv3O/7DgibCtq9k27T6Zlj8yRdJDFmcjcbQrvC0/CpDpWHaZYA==} engines: {node: '>=14'} + deprecated: Please use @opentelemetry/api >= 1.3.0 dependencies: '@opentelemetry/api': 1.2.0 dev: false @@ -3890,7 +3893,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.0.0-dev.20221110 + typescript: 5.0.0-dev.20221113 dev: false /downlevel-dts/0.8.0: @@ -8838,8 +8841,8 @@ packages: hasBin: true dev: false - /typescript/5.0.0-dev.20221110: - resolution: {integrity: sha512-2ErQCfMJ/il4ipW6NRIqJdQvJ84k8nafDIXGCpjaedCdnF/ejRmtHAhPuS5m54AKhRz/uc31LxzKpcSOxVuJHQ==} + /typescript/5.0.0-dev.20221113: + resolution: {integrity: sha512-iNVo0p5OwpkxLl3hzf7zLw5fjcQnrFIgHwPh2BZgZOofcaFNxj42SOhR/OoZMYSbqkkRFrOi1gzVcsgw6ehDFg==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -10639,7 +10642,7 @@ packages: dev: false file:projects/arm-batch.tgz: - resolution: {integrity: sha512-BtovOUqCBkiF8Hb+3XtHYg8u9iVDRUcFlyU5GM2JidX8OD2mdSiNm0I3csgcCxNAvOGbvYL8EEDFvsi1afsEyA==, tarball: file:projects/arm-batch.tgz} + resolution: {integrity: sha512-itk/e/Xa/k+K6/Y1RHs4eFBE4U1YJCZqd8RrgFJv1kfS28gCbbC85CMt7+JP5gXsSokL2R8HfrHy/Pu6OhDYeA==, tarball: file:projects/arm-batch.tgz} name: '@rush-temp/arm-batch' version: 0.0.0 dependencies: @@ -10693,6 +10696,33 @@ packages: - supports-color dev: false + file:projects/arm-billingbenefits.tgz: + resolution: {integrity: sha512-55Za+/Pqp7nKGwFPsvirqpRAl1JDhHo5lrd2wQ2D8wy6MiTFeWKxr39MQjSzo+cN7m1RKx9TRZkMQPtJlR7chA==, tarball: file:projects/arm-billingbenefits.tgz} + name: '@rush-temp/arm-billingbenefits' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.33.5 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 + '@rollup/plugin-json': 4.1.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.3 + chai: 4.3.6 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + tslib: 2.4.1 + typescript: 4.6.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - '@types/node' + - supports-color + dev: false + file:projects/arm-botservice.tgz: resolution: {integrity: sha512-kUwgAnz2AwtpbdSmBf+i8lZelOhdimkAPuqflxlRf/ZlTChXpj9nVvL80JeHcA15kxe9ETOdbYCRl7hXh5fGbQ==, tarball: file:projects/arm-botservice.tgz} name: '@rush-temp/arm-botservice' diff --git a/rush.json b/rush.json index 157b80a59d66..b4b2af8bd45b 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -1935,6 +1935,11 @@ "packageName": "@azure/arm-hybridcontainerservice", "projectFolder": "sdk/hybridcontainerservice/arm-hybridcontainerservice", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-billingbenefits", + "projectFolder": "sdk/billingbenefits/arm-billingbenefits", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/billingbenefits/arm-billingbenefits/CHANGELOG.md b/sdk/billingbenefits/arm-billingbenefits/CHANGELOG.md new file mode 100644 index 000000000000..040515efc165 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2022-11-14) + +The package of @azure/arm-billingbenefits is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/billingbenefits/arm-billingbenefits/LICENSE b/sdk/billingbenefits/arm-billingbenefits/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/billingbenefits/arm-billingbenefits/README.md b/sdk/billingbenefits/arm-billingbenefits/README.md new file mode 100644 index 000000000000..27e9d90fbe1e --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/README.md @@ -0,0 +1,109 @@ +# Azure BillingBenefitsRp client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure BillingBenefitsRp client. + +Azure Benefits RP let users create and manage benefits like savings plan. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/billingbenefits/arm-billingbenefits) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-billingbenefits) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-billingbenefits) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-billingbenefits` package + +Install the Azure BillingBenefitsRp client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-billingbenefits +``` + +### Create and authenticate a `BillingBenefitsRP` + +To create a client object to access the Azure BillingBenefitsRp API, you will need the `endpoint` of your Azure BillingBenefitsRp resource and a `credential`. The Azure BillingBenefitsRp client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure BillingBenefitsRp resource in the [Azure Portal][azure_portal]. + +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: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure BillingBenefitsRp** 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 { BillingBenefitsRP } = require("@azure/arm-billingbenefits"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new BillingBenefitsRP(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new BillingBenefitsRP(credential, subscriptionId); +``` + + +### 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). + +## Key concepts + +### BillingBenefitsRP + +`BillingBenefitsRP` is the primary interface for developers using the Azure BillingBenefitsRp client library. Explore the methods on this client object to understand the different features of the Azure BillingBenefitsRp 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) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fbillingbenefits%2Farm-billingbenefits%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/billingbenefits/arm-billingbenefits/_meta.json b/sdk/billingbenefits/arm-billingbenefits/_meta.json new file mode 100644 index 000000000000..b701810732a2 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "33bc4231fd737bb6199096f70446161eeaf75221", + "readme": "specification/billingbenefits/resource-manager/readme.md", + "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/billingbenefits/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.2", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.5.1", + "use": "@autorest/typescript@6.0.0-rc.2" +} \ No newline at end of file diff --git a/sdk/billingbenefits/arm-billingbenefits/api-extractor.json b/sdk/billingbenefits/arm-billingbenefits/api-extractor.json new file mode 100644 index 000000000000..0f9c6234f53f --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-billingbenefits.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/billingbenefits/arm-billingbenefits/package.json b/sdk/billingbenefits/arm-billingbenefits/package.json new file mode 100644 index 000000000000..2b86e09c5448 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/package.json @@ -0,0 +1,113 @@ +{ + "name": "@azure/arm-billingbenefits", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for BillingBenefitsRP.", + "version": "1.0.0", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.5.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-billingbenefits.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^1.0.4", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.6.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/billingbenefits/arm-billingbenefits", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.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", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "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": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/billingBenefitsRP.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/billingbenefits/arm-billingbenefits/review/arm-billingbenefits.api.md b/sdk/billingbenefits/arm-billingbenefits/review/arm-billingbenefits.api.md new file mode 100644 index 000000000000..46d3b4107cb4 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/review/arm-billingbenefits.api.md @@ -0,0 +1,778 @@ +## API Report File for "@azure/arm-billingbenefits" + +> 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 +export type ActionType = string; + +// @public +export interface AppliedScopeProperties { + displayName?: string; + managementGroupId?: string; + resourceGroupId?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export type AppliedScopeType = string; + +// @public (undocumented) +export class BillingBenefitsRP extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, options?: BillingBenefitsRPOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + expand?: string; + // (undocumented) + operations: Operations; + // (undocumented) + reservationOrderAlias: ReservationOrderAlias; + // (undocumented) + savingsPlan: SavingsPlan; + // (undocumented) + savingsPlanOrder: SavingsPlanOrder; + // (undocumented) + savingsPlanOrderAlias: SavingsPlanOrderAlias; + // (undocumented) + savingsPlanPurchase: SavingsPlanPurchase; + // (undocumented) + savingsPlans: SavingsPlans; + // (undocumented) + savingsPlansInOrder: SavingsPlansInOrder; + // (undocumented) + savingsPlanUpdate: SavingsPlanUpdate; +} + +// @public +export interface BillingBenefitsRPOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; + expand?: string; +} + +// @public +export interface BillingInformation { + // (undocumented) + billingCurrencyProratedAmount?: Price; + // (undocumented) + billingCurrencyRemainingCommitmentAmount?: Price; + // (undocumented) + billingCurrencyTotalPaidAmount?: Price; +} + +// @public +export type BillingPlan = string; + +// @public +export interface BillingPlanInformation { + nextPaymentDueDate?: Date; + pricingCurrencyTotal?: Price; + startDate?: Date; + // (undocumented) + transactions?: PaymentDetail[]; +} + +// @public +export interface Commitment extends Price { + grain?: CommitmentGrain; +} + +// @public +export type CommitmentGrain = string; + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public (undocumented) +export interface ExtendedStatusInfo { + message?: string; + statusCode?: string; +} + +// @public +export type InstanceFlexibility = string; + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownAppliedScopeType { + ManagementGroup = "ManagementGroup", + Shared = "Shared", + Single = "Single" +} + +// @public +export enum KnownBillingPlan { + P1M = "P1M" +} + +// @public +export enum KnownCommitmentGrain { + Hourly = "Hourly" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownInstanceFlexibility { + Off = "Off", + On = "On" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownPaymentStatus { + Cancelled = "Cancelled", + Failed = "Failed", + Scheduled = "Scheduled", + Succeeded = "Succeeded" +} + +// @public +export enum KnownPricingCurrencyDuration { + P1M = "P1M", + P1Y = "P1Y", + P3Y = "P3Y" +} + +// @public +export enum KnownProvisioningState { + Cancelled = "Cancelled", + ConfirmedBilling = "ConfirmedBilling", + Created = "Created", + Creating = "Creating", + Expired = "Expired", + Failed = "Failed", + PendingBilling = "PendingBilling", + Succeeded = "Succeeded" +} + +// @public +export enum KnownReservedResourceType { + AppService = "AppService", + AVS = "AVS", + AzureDataExplorer = "AzureDataExplorer", + AzureFiles = "AzureFiles", + BlockBlob = "BlockBlob", + ComputeSavingsPlan = "ComputeSavingsPlan", + CosmosDb = "CosmosDb", + Databricks = "Databricks", + DataFactory = "DataFactory", + DedicatedHost = "DedicatedHost", + ManagedDisk = "ManagedDisk", + MariaDb = "MariaDb", + MySql = "MySql", + NetAppStorage = "NetAppStorage", + PostgreSql = "PostgreSql", + RedHat = "RedHat", + RedHatOsa = "RedHatOsa", + RedisCache = "RedisCache", + SapHana = "SapHana", + SqlAzureHybridBenefit = "SqlAzureHybridBenefit", + SqlDatabases = "SqlDatabases", + SqlDataWarehouse = "SqlDataWarehouse", + SqlEdge = "SqlEdge", + SuseLinux = "SuseLinux", + VirtualMachines = "VirtualMachines", + VirtualMachineSoftware = "VirtualMachineSoftware", + VMwareCloudSimple = "VMwareCloudSimple" +} + +// @public +export enum KnownSavingsPlanTerm { + P1Y = "P1Y", + P3Y = "P3Y" +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationListResult { + readonly nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface OperationResultError { + code?: string; + message?: string; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export type Origin = string; + +// @public +export interface PaymentDetail { + billingAccount?: string; + billingCurrencyTotal?: Price; + dueDate?: Date; + readonly 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 PricingCurrencyDuration = string; + +// @public (undocumented) +export interface PricingCurrencyTotal extends Price { + duration?: PricingCurrencyDuration; +} + +// @public +export type ProvisioningState = string; + +// @public (undocumented) +export interface PurchaseRequest { + appliedScopeProperties?: AppliedScopeProperties; + appliedScopeType?: AppliedScopeType; + billingPlan?: BillingPlan; + billingScopeId?: string; + commitment?: Commitment; + displayName?: string; + readonly effectiveDateTime?: Date; + renew?: boolean; + sku?: Sku; + term?: SavingsPlanTerm; +} + +// @public (undocumented) +export interface RenewProperties { + // (undocumented) + purchaseProperties?: PurchaseRequest; +} + +// @public +export interface ReservationOrderAlias { + beginCreate(reservationOrderAliasName: string, body: ReservationOrderAliasRequest, options?: ReservationOrderAliasCreateOptionalParams): Promise, ReservationOrderAliasCreateResponse>>; + beginCreateAndWait(reservationOrderAliasName: string, body: ReservationOrderAliasRequest, options?: ReservationOrderAliasCreateOptionalParams): Promise; + get(reservationOrderAliasName: string, options?: ReservationOrderAliasGetOptionalParams): Promise; +} + +// @public +export interface ReservationOrderAliasCreateHeaders { + azureAsyncOperation?: string; + retryAfter?: number; +} + +// @public +export interface ReservationOrderAliasCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ReservationOrderAliasCreateResponse = ReservationOrderAliasResponse; + +// @public +export interface ReservationOrderAliasGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderAliasGetResponse = ReservationOrderAliasResponse; + +// @public +export interface ReservationOrderAliasRequest extends Resource { + appliedScopeProperties?: AppliedScopeProperties; + appliedScopeType?: AppliedScopeType; + billingPlan?: BillingPlan; + billingScopeId?: string; + displayName?: string; + location?: string; + quantity?: number; + renew?: boolean; + reservedResourceProperties?: ReservationOrderAliasRequestPropertiesReservedResourceProperties; + reservedResourceType?: ReservedResourceType; + reviewDateTime?: Date; + sku: Sku; + term?: SavingsPlanTerm; +} + +// @public +export interface ReservationOrderAliasRequestPropertiesReservedResourceProperties { + instanceFlexibility?: InstanceFlexibility; +} + +// @public +export interface ReservationOrderAliasResponse extends Resource { + appliedScopeProperties?: AppliedScopeProperties; + appliedScopeType?: AppliedScopeType; + billingPlan?: BillingPlan; + billingScopeId?: string; + displayName?: string; + location?: string; + readonly provisioningState?: ProvisioningState; + quantity?: number; + renew?: boolean; + readonly reservationOrderId?: string; + reservedResourceProperties?: ReservationOrderAliasResponsePropertiesReservedResourceProperties; + reservedResourceType?: ReservedResourceType; + reviewDateTime?: Date; + sku: Sku; + term?: SavingsPlanTerm; +} + +// @public +export interface ReservationOrderAliasResponsePropertiesReservedResourceProperties { + instanceFlexibility?: InstanceFlexibility; +} + +// @public +export type ReservedResourceType = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface RoleAssignmentEntity { + id?: string; + name?: string; + principalId?: string; + roleDefinitionId?: string; + scope?: string; +} + +// @public +export interface SavingsPlan { + get(savingsPlanOrderId: string, savingsPlanId: string, options?: SavingsPlanGetOptionalParams): Promise; + update(savingsPlanOrderId: string, savingsPlanId: string, body: SavingsPlanUpdateRequest, options?: SavingsPlanUpdateOptionalParams): Promise; +} + +// @public +export interface SavingsPlanGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SavingsPlanGetResponse = SavingsPlanModel; + +// @public +export interface SavingsPlanModel extends Resource { + appliedScopeProperties?: AppliedScopeProperties; + appliedScopeType?: AppliedScopeType; + benefitStartTime?: Date; + readonly billingAccountId?: string; + billingPlan?: BillingPlan; + readonly billingProfileId?: string; + billingScopeId?: string; + commitment?: Commitment; + readonly customerId?: string; + displayName?: string; + readonly displayProvisioningState?: string; + readonly effectiveDateTime?: Date; + readonly expiryDateTime?: Date; + readonly extendedStatusInfo?: ExtendedStatusInfo; + readonly provisioningState?: ProvisioningState; + readonly purchaseDateTime?: Date; + renew?: boolean; + // (undocumented) + renewProperties?: SavingsPlanModelPropertiesRenewProperties; + sku: Sku; + term?: SavingsPlanTerm; + readonly userFriendlyAppliedScopeType?: string; + readonly utilization?: Utilization; +} + +// @public (undocumented) +export interface SavingsPlanModelList { + nextLink?: string; + // (undocumented) + value?: SavingsPlanModel[]; +} + +// @public (undocumented) +export interface SavingsPlanModelListResult { + readonly additionalProperties?: SavingsPlanSummary[]; + readonly nextLink?: string; + readonly value?: SavingsPlanModel[]; +} + +// @public (undocumented) +export interface SavingsPlanModelPropertiesRenewProperties { + // (undocumented) + purchaseProperties?: PurchaseRequest; +} + +// @public +export interface SavingsPlanOrder { + elevate(savingsPlanOrderId: string, options?: SavingsPlanOrderElevateOptionalParams): Promise; + get(savingsPlanOrderId: string, options?: SavingsPlanOrderGetOptionalParams): Promise; + list(options?: SavingsPlanOrderListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SavingsPlanOrderAlias { + beginCreate(savingsPlanOrderAliasName: string, body: SavingsPlanOrderAliasModel, options?: SavingsPlanOrderAliasCreateOptionalParams): Promise, SavingsPlanOrderAliasCreateResponse>>; + beginCreateAndWait(savingsPlanOrderAliasName: string, body: SavingsPlanOrderAliasModel, options?: SavingsPlanOrderAliasCreateOptionalParams): Promise; + get(savingsPlanOrderAliasName: string, options?: SavingsPlanOrderAliasGetOptionalParams): Promise; +} + +// @public +export interface SavingsPlanOrderAliasCreateHeaders { + azureAsyncOperation?: string; + retryAfter?: number; +} + +// @public +export interface SavingsPlanOrderAliasCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SavingsPlanOrderAliasCreateResponse = SavingsPlanOrderAliasModel; + +// @public +export interface SavingsPlanOrderAliasGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SavingsPlanOrderAliasGetResponse = SavingsPlanOrderAliasModel; + +// @public +export interface SavingsPlanOrderAliasModel extends Resource { + appliedScopeProperties?: AppliedScopeProperties; + appliedScopeType?: AppliedScopeType; + billingPlan?: BillingPlan; + billingScopeId?: string; + commitment?: Commitment; + displayName?: string; + kind?: string; + readonly provisioningState?: ProvisioningState; + readonly savingsPlanOrderId?: string; + sku: Sku; + term?: SavingsPlanTerm; +} + +// @public +export interface SavingsPlanOrderElevateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SavingsPlanOrderElevateResponse = RoleAssignmentEntity; + +// @public +export interface SavingsPlanOrderGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SavingsPlanOrderGetResponse = SavingsPlanOrderModel; + +// @public +export interface SavingsPlanOrderListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SavingsPlanOrderListNextResponse = SavingsPlanOrderModelList; + +// @public +export interface SavingsPlanOrderListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SavingsPlanOrderListResponse = SavingsPlanOrderModelList; + +// @public +export interface SavingsPlanOrderModel extends Resource { + benefitStartTime?: Date; + readonly billingAccountId?: string; + billingPlan?: BillingPlan; + readonly billingProfileId?: string; + billingScopeId?: string; + readonly customerId?: string; + displayName?: string; + readonly expiryDateTime?: Date; + readonly extendedStatusInfo?: ExtendedStatusInfo; + planInformation?: BillingPlanInformation; + readonly provisioningState?: ProvisioningState; + // (undocumented) + savingsPlans?: string[]; + sku: Sku; + term?: SavingsPlanTerm; +} + +// @public (undocumented) +export interface SavingsPlanOrderModelList { + nextLink?: string; + // (undocumented) + value?: SavingsPlanOrderModel[]; +} + +// @public +export interface SavingsPlanPurchase { + validate(body: SavingsPlanPurchaseValidateRequest, options?: SavingsPlanPurchaseValidateOptionalParams): Promise; +} + +// @public +export interface SavingsPlanPurchaseValidateOptionalParams extends coreClient.OperationOptions { +} + +// @public (undocumented) +export interface SavingsPlanPurchaseValidateRequest { + // (undocumented) + benefits?: SavingsPlanOrderAliasModel[]; +} + +// @public +export type SavingsPlanPurchaseValidateResponse = SavingsPlanValidateResponse; + +// @public +export interface SavingsPlans { + list(options?: SavingsPlansListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SavingsPlansInOrder { + list(savingsPlanOrderId: string, options?: SavingsPlansInOrderListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SavingsPlansInOrderListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SavingsPlansInOrderListNextResponse = SavingsPlanModelList; + +// @public +export interface SavingsPlansInOrderListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SavingsPlansInOrderListResponse = SavingsPlanModelList; + +// @public +export interface SavingsPlansListNextOptionalParams extends coreClient.OperationOptions { + filter?: string; + orderby?: string; + refreshSummary?: string; + selectedState?: string; + skiptoken?: number; + take?: number; +} + +// @public +export type SavingsPlansListNextResponse = SavingsPlanModelListResult; + +// @public +export interface SavingsPlansListOptionalParams extends coreClient.OperationOptions { + filter?: string; + orderby?: string; + refreshSummary?: string; + selectedState?: string; + skiptoken?: number; + take?: number; +} + +// @public +export type SavingsPlansListResponse = SavingsPlanModelListResult; + +// @public +export interface SavingsPlanSummary { + readonly name?: string; + value?: SavingsPlanSummaryCount; +} + +// @public +export interface SavingsPlanSummaryCount { + readonly cancelledCount?: number; + readonly expiredCount?: number; + readonly expiringCount?: number; + readonly failedCount?: number; + readonly noBenefitCount?: number; + readonly pendingCount?: number; + readonly processingCount?: number; + readonly succeededCount?: number; + readonly warningCount?: number; +} + +// @public +export type SavingsPlanTerm = string; + +// @public +export interface SavingsPlanUpdate { + validate(savingsPlanOrderId: string, savingsPlanId: string, body: SavingsPlanUpdateValidateRequest, options?: SavingsPlanUpdateValidateOptionalParams): Promise; +} + +// @public +export interface SavingsPlanUpdateHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface SavingsPlanUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface SavingsPlanUpdateRequest { + properties?: SavingsPlanUpdateRequestProperties; +} + +// @public +export interface SavingsPlanUpdateRequestProperties { + appliedScopeProperties?: AppliedScopeProperties; + appliedScopeType?: AppliedScopeType; + displayName?: string; + renew?: boolean; + // (undocumented) + renewProperties?: RenewProperties; +} + +// @public +export type SavingsPlanUpdateResponse = SavingsPlanModel; + +// @public +export interface SavingsPlanUpdateValidateOptionalParams extends coreClient.OperationOptions { +} + +// @public (undocumented) +export interface SavingsPlanUpdateValidateRequest { + // (undocumented) + benefits?: SavingsPlanUpdateRequestProperties[]; +} + +// @public +export type SavingsPlanUpdateValidateResponse = SavingsPlanValidateResponse; + +// @public (undocumented) +export interface SavingsPlanValidateResponse { + // (undocumented) + benefits?: SavingsPlanValidResponseProperty[]; + nextLink?: string; +} + +// @public +export interface SavingsPlanValidResponseProperty { + reason?: string; + reasonCode?: string; + valid?: boolean; +} + +// @public +export interface Sku { + name?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface Utilization { + aggregates?: UtilizationAggregates[]; + readonly trend?: string; +} + +// @public +export interface UtilizationAggregates { + readonly grain?: number; + readonly grainUnit?: string; + readonly value?: number; + readonly valueUnit?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/billingbenefits/arm-billingbenefits/rollup.config.js b/sdk/billingbenefits/arm-billingbenefits/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/rollup.config.js @@ -0,0 +1,122 @@ +/* + * 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 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"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * 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(), + 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 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()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/billingbenefits/arm-billingbenefits/sample.env b/sdk/billingbenefits/arm-billingbenefits/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/billingbenefits/arm-billingbenefits/src/billingBenefitsRP.ts b/sdk/billingbenefits/arm-billingbenefits/src/billingBenefitsRP.ts new file mode 100644 index 000000000000..4a6440fc42de --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/billingBenefitsRP.ts @@ -0,0 +1,170 @@ +/* + * 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 coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { + OperationsImpl, + SavingsPlanOrderAliasImpl, + SavingsPlanOrderImpl, + SavingsPlansInOrderImpl, + SavingsPlansImpl, + SavingsPlanImpl, + SavingsPlanUpdateImpl, + SavingsPlanPurchaseImpl, + ReservationOrderAliasImpl +} from "./operations"; +import { + Operations, + SavingsPlanOrderAlias, + SavingsPlanOrder, + SavingsPlansInOrder, + SavingsPlans, + SavingsPlan, + SavingsPlanUpdate, + SavingsPlanPurchase, + ReservationOrderAlias +} from "./operationsInterfaces"; +import { BillingBenefitsRPOptionalParams } from "./models"; + +export class BillingBenefitsRP extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + expand?: string; + + /** + * Initializes a new instance of the BillingBenefitsRP class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + options?: BillingBenefitsRPOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: BillingBenefitsRPOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-billingbenefits/1.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 ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: `${optionsWithDefaults.credentialScopes}`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-11-01"; + this.operations = new OperationsImpl(this); + this.savingsPlanOrderAlias = new SavingsPlanOrderAliasImpl(this); + this.savingsPlanOrder = new SavingsPlanOrderImpl(this); + this.savingsPlansInOrder = new SavingsPlansInOrderImpl(this); + this.savingsPlans = new SavingsPlansImpl(this); + this.savingsPlan = new SavingsPlanImpl(this); + this.savingsPlanUpdate = new SavingsPlanUpdateImpl(this); + this.savingsPlanPurchase = new SavingsPlanPurchaseImpl(this); + this.reservationOrderAlias = new ReservationOrderAliasImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + savingsPlanOrderAlias: SavingsPlanOrderAlias; + savingsPlanOrder: SavingsPlanOrder; + savingsPlansInOrder: SavingsPlansInOrder; + savingsPlans: SavingsPlans; + savingsPlan: SavingsPlan; + savingsPlanUpdate: SavingsPlanUpdate; + savingsPlanPurchase: SavingsPlanPurchase; + reservationOrderAlias: ReservationOrderAlias; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/index.ts b/sdk/billingbenefits/arm-billingbenefits/src/index.ts new file mode 100644 index 000000000000..c31e62466bf9 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/index.ts @@ -0,0 +1,12 @@ +/* + * 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 "./models"; +export { BillingBenefitsRP } from "./billingBenefitsRP"; +export * from "./operationsInterfaces"; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/lroImpl.ts b/sdk/billingbenefits/arm-billingbenefits/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/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/billingbenefits/arm-billingbenefits/src/models/index.ts b/sdk/billingbenefits/arm-billingbenefits/src/models/index.ts new file mode 100644 index 000000000000..4abe09d52eb5 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/models/index.ts @@ -0,0 +1,1220 @@ +/* + * 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 coreClient from "@azure/core-client"; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** + * List of operations supported by the resource provider + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Operation[]; + /** + * URL to get the next set of operation list results (if there are any). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: Origin; + /** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionType?: ActionType; +} + +/** Localized display information for this particular operation. */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * 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; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** The SKU to be applied for this resource */ +export interface Sku { + /** Name of the SKU to be applied */ + name?: string; +} + +/** Properties specific to applied scope type. Not required if not applicable. */ +export interface AppliedScopeProperties { + /** Tenant ID where the savings plan should apply benefit. */ + tenantId?: string; + /** Fully-qualified identifier of the management group where the benefit must be applied. */ + managementGroupId?: string; + /** Fully-qualified identifier of the subscription. */ + subscriptionId?: string; + /** Fully-qualified identifier of the resource group. */ + resourceGroupId?: string; + /** Display name */ + displayName?: string; +} + +export interface Price { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + 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 describing the type of billing plan for this savings plan. */ +export interface BillingPlanInformation { + /** 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[]; +} + +/** Information about payment related to a savings plan 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; + /** Describes whether the payment is completed, failed, cancelled or scheduled in the future. */ + status?: PaymentStatus; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly extendedStatusInfo?: ExtendedStatusInfo; + /** Billing account */ + billingAccount?: string; +} + +export interface ExtendedStatusInfo { + /** Status code providing additional information. */ + statusCode?: string; + /** The message giving detailed information about the status code. */ + message?: string; +} + +/** Role assignment entity */ +export interface RoleAssignmentEntity { + /** Role assignment entity id */ + id?: string; + /** Role assignment entity name */ + name?: string; + /** Principal Id */ + principalId?: string; + /** Role definition id */ + roleDefinitionId?: string; + /** Scope of the role assignment entity */ + scope?: string; +} + +export interface SavingsPlanOrderModelList { + value?: SavingsPlanOrderModel[]; + /** Url to get the next page. */ + nextLink?: string; +} + +export interface SavingsPlanModelList { + value?: SavingsPlanModel[]; + /** Url to get the next page. */ + nextLink?: string; +} + +/** Savings plan utilization */ +export interface Utilization { + /** + * The number of days trend for a savings plan + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly trend?: string; + /** The array of aggregates of a savings plan's utilization */ + aggregates?: UtilizationAggregates[]; +} + +/** The aggregate values of savings plan utilization */ +export interface UtilizationAggregates { + /** + * The grain of the aggregate + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly grain?: number; + /** + * The grain unit of the aggregate + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly grainUnit?: string; + /** + * The aggregate value + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: number; + /** + * The aggregate value unit + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly valueUnit?: string; +} + +export interface SavingsPlanModelPropertiesRenewProperties { + purchaseProperties?: PurchaseRequest; +} + +export interface PurchaseRequest { + /** The SKU to be applied for this resource */ + sku?: Sku; + /** Friendly name of the savings plan */ + displayName?: string; + /** Subscription that will be charged for purchasing SavingsPlan */ + billingScopeId?: string; + /** Represent SavingsPlan term in ISO 8601 format. */ + term?: SavingsPlanTerm; + /** Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. */ + billingPlan?: BillingPlan; + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** Commitment towards the benefit. */ + commitment?: Commitment; + /** + * DateTime of the savings plan starts providing benefit from. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly effectiveDateTime?: Date; + /** Setting this to true will automatically purchase a new savings plan on the expiration date time. */ + renew?: boolean; + /** Properties specific to applied scope type. Not required if not applicable. */ + appliedScopeProperties?: AppliedScopeProperties; +} + +export interface SavingsPlanModelListResult { + /** + * The list of savings plans. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: SavingsPlanModel[]; + /** + * Url to get the next page. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; + /** + * The roll out count summary of the savings plans + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalProperties?: SavingsPlanSummary[]; +} + +/** Savings plans list summary */ +export interface SavingsPlanSummary { + /** + * This property has value 'summary' + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** The roll up count summary of savings plans in each state */ + value?: SavingsPlanSummaryCount; +} + +/** The roll up count summary of savings plans in each state */ +export interface SavingsPlanSummaryCount { + /** + * The number of savings plans in Succeeded state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly succeededCount?: number; + /** + * The number of savings plans in Failed state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly failedCount?: number; + /** + * The number of savings plans in Expiring state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiringCount?: number; + /** + * The number of savings plans in Expired state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiredCount?: number; + /** + * The number of savings plans in Pending state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly pendingCount?: number; + /** + * The number of savings plans in Cancelled state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cancelledCount?: number; + /** + * The number of savings plans in Processing state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly processingCount?: number; + /** + * The number of savings plans in No Benefit state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly noBenefitCount?: number; + /** + * The number of savings plans in Warning state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly warningCount?: number; +} + +/** Savings plan patch request */ +export interface SavingsPlanUpdateRequest { + /** Savings plan patch request */ + properties?: SavingsPlanUpdateRequestProperties; +} + +/** Savings plan patch request */ +export interface SavingsPlanUpdateRequestProperties { + /** Display name */ + displayName?: string; + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** Properties specific to applied scope type. Not required if not applicable. */ + appliedScopeProperties?: AppliedScopeProperties; + /** Setting this to true will automatically purchase a new savings plan on the expiration date time. */ + renew?: boolean; + renewProperties?: RenewProperties; +} + +export interface RenewProperties { + purchaseProperties?: PurchaseRequest; +} + +export interface SavingsPlanUpdateValidateRequest { + benefits?: SavingsPlanUpdateRequestProperties[]; +} + +export interface SavingsPlanValidateResponse { + benefits?: SavingsPlanValidResponseProperty[]; + /** Url to get the next page. */ + nextLink?: string; +} + +/** Benefit scope response property */ +export interface SavingsPlanValidResponseProperty { + /** Indicates if the provided input was valid */ + valid?: boolean; + /** Failure reason code if the provided input was invalid */ + reasonCode?: string; + /** Failure reason if the provided input was invalid */ + reason?: string; +} + +export interface SavingsPlanPurchaseValidateRequest { + benefits?: SavingsPlanOrderAliasModel[]; +} + +/** Properties specific to each reserved resource type. Not required if not applicable. */ +export interface ReservationOrderAliasRequestPropertiesReservedResourceProperties { + /** 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; +} + +/** Properties specific to each reserved resource type. Not required if not applicable. */ +export interface ReservationOrderAliasResponsePropertiesReservedResourceProperties { + /** 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; +} + +/** 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; +} + +/** billing information */ +export interface BillingInformation { + billingCurrencyTotalPaidAmount?: Price; + billingCurrencyProratedAmount?: Price; + billingCurrencyRemainingCommitmentAmount?: Price; +} + +/** Commitment towards the benefit. */ +export interface Commitment extends Price { + /** Commitment grain. */ + grain?: CommitmentGrain; +} + +export interface PricingCurrencyTotal extends Price { + /** Represents either billing plan or savings plan term in ISO 8601 format. */ + duration?: PricingCurrencyDuration; +} + +/** Savings plan order alias */ +export interface SavingsPlanOrderAliasModel extends Resource { + /** Savings plan SKU */ + sku: Sku; + /** Resource provider kind */ + kind?: string; + /** Display name */ + displayName?: string; + /** + * Identifier of the savings plan created + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly savingsPlanOrderId?: string; + /** + * Provisioning state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Subscription that will be charged for purchasing SavingsPlan */ + billingScopeId?: string; + /** Represent SavingsPlan term in ISO 8601 format. */ + term?: SavingsPlanTerm; + /** Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. */ + billingPlan?: BillingPlan; + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** Properties specific to applied scope type. Not required if not applicable. */ + appliedScopeProperties?: AppliedScopeProperties; + /** Commitment towards the benefit. */ + commitment?: Commitment; +} + +/** Savings plan order */ +export interface SavingsPlanOrderModel extends Resource { + /** Savings plan SKU */ + sku: Sku; + /** Display name */ + displayName?: string; + /** + * Provisioning state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Subscription that will be charged for purchasing SavingsPlan */ + billingScopeId?: string; + /** + * Fully-qualified identifier of the billing profile where the savings plan is applied. Present only for Field-led or Customer-led customers. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly billingProfileId?: string; + /** + * Fully-qualified identifier of the customer where the savings plan is applied. Present only for Partner-led customers. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly customerId?: string; + /** + * Fully-qualified identifier of the billing account where the savings plan is applied. Present only for Enterprise Agreement customers. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly billingAccountId?: string; + /** Represent SavingsPlan term in ISO 8601 format. */ + term?: SavingsPlanTerm; + /** Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. */ + billingPlan?: BillingPlan; + /** + * Expiry date time + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiryDateTime?: Date; + /** This is the DateTime when the savings plan benefit started. */ + benefitStartTime?: Date; + /** Information describing the type of billing plan for this savings plan. */ + planInformation?: BillingPlanInformation; + savingsPlans?: string[]; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly extendedStatusInfo?: ExtendedStatusInfo; +} + +/** Savings plan */ +export interface SavingsPlanModel extends Resource { + /** Savings plan SKU */ + sku: Sku; + /** Display name */ + displayName?: string; + /** + * Provisioning state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * The provisioning state of the savings plan for display, e.g. Succeeded + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly displayProvisioningState?: string; + /** Subscription that will be charged for purchasing SavingsPlan */ + billingScopeId?: string; + /** + * Fully-qualified identifier of the billing profile where the savings plan is applied. Present only for Field-led or Customer-led customers. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly billingProfileId?: string; + /** + * Fully-qualified identifier of the customer where the savings plan is applied. Present only for Partner-led customers. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly customerId?: string; + /** + * Fully-qualified identifier of the billing account where the savings plan is applied. Present only for Enterprise Agreement customers. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly billingAccountId?: string; + /** Represent SavingsPlan term in ISO 8601 format. */ + term?: SavingsPlanTerm; + /** Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. */ + billingPlan?: BillingPlan; + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** + * The applied scope type of the savings plan for display, e.g. Shared + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly userFriendlyAppliedScopeType?: string; + /** Properties specific to applied scope type. Not required if not applicable. */ + appliedScopeProperties?: AppliedScopeProperties; + /** Commitment towards the benefit. */ + commitment?: Commitment; + /** + * DateTime of the savings plan starts providing benefit from. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly effectiveDateTime?: Date; + /** + * Expiry date time + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiryDateTime?: Date; + /** + * Date time when the savings plan was purchased + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly purchaseDateTime?: Date; + /** This is the DateTime when the savings plan benefit started. */ + benefitStartTime?: Date; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly extendedStatusInfo?: ExtendedStatusInfo; + /** Setting this to true will automatically purchase a new savings plan on the expiration date time. */ + renew?: boolean; + /** + * Savings plan utilization + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly utilization?: Utilization; + renewProperties?: SavingsPlanModelPropertiesRenewProperties; +} + +/** Reservation order alias */ +export interface ReservationOrderAliasRequest extends Resource { + /** Reservation order SKU */ + sku: Sku; + /** The Azure Region where the reservation benefits are applied to. */ + location?: string; + /** Display name */ + displayName?: string; + /** Subscription that will be charged for purchasing SavingsPlan */ + billingScopeId?: string; + /** Represent SavingsPlan term in ISO 8601 format. */ + term?: SavingsPlanTerm; + /** Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. */ + billingPlan?: BillingPlan; + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** Properties specific to applied scope type. Not required if not applicable. */ + appliedScopeProperties?: AppliedScopeProperties; + /** Total Quantity of the SKUs purchased in the Reservation. */ + quantity?: number; + /** Setting this to true will automatically purchase a new savings plan on the expiration date time. */ + renew?: boolean; + /** The type of the resource that is being reserved. */ + reservedResourceType?: ReservedResourceType; + /** This is the date-time when the Azure Hybrid Benefit needs to be reviewed. */ + reviewDateTime?: Date; + /** Properties specific to each reserved resource type. Not required if not applicable. */ + reservedResourceProperties?: ReservationOrderAliasRequestPropertiesReservedResourceProperties; +} + +/** Reservation order alias */ +export interface ReservationOrderAliasResponse extends Resource { + /** Reservation order SKU */ + sku: Sku; + /** The Azure Region where the reserved resource lives. */ + location?: string; + /** Display name */ + displayName?: string; + /** + * Identifier of the reservation order created + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly reservationOrderId?: string; + /** + * Provisioning state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Subscription that will be charged for purchasing SavingsPlan */ + billingScopeId?: string; + /** Represent SavingsPlan term in ISO 8601 format. */ + term?: SavingsPlanTerm; + /** Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. */ + billingPlan?: BillingPlan; + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** Properties specific to applied scope type. Not required if not applicable. */ + appliedScopeProperties?: AppliedScopeProperties; + /** Total Quantity of the SKUs purchased in the Reservation. */ + quantity?: number; + /** Setting this to true will automatically purchase a new savings plan on the expiration date time. */ + renew?: boolean; + /** The type of the resource that is being reserved. */ + reservedResourceType?: ReservedResourceType; + /** This is the date-time when the Reservation needs to be reviewed. */ + reviewDateTime?: Date; + /** Properties specific to each reserved resource type. Not required if not applicable. */ + reservedResourceProperties?: ReservationOrderAliasResponsePropertiesReservedResourceProperties; +} + +/** Defines headers for SavingsPlanOrderAlias_create operation. */ +export interface SavingsPlanOrderAliasCreateHeaders { + /** URL for checking the ongoing status of the operation. */ + azureAsyncOperation?: string; + /** Clients should wait for the Retry-After interval before polling again */ + retryAfter?: number; +} + +/** Defines headers for SavingsPlan_update operation. */ +export interface SavingsPlanUpdateHeaders { + location?: string; +} + +/** Defines headers for ReservationOrderAlias_create operation. */ +export interface ReservationOrderAliasCreateHeaders { + /** URL for checking the ongoing status of the operation. */ + azureAsyncOperation?: string; + /** Clients should wait for the Retry-After interval before polling again */ + retryAfter?: number; +} + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** User */ + User = "user", + /** System */ + System = "system", + /** UserSystem */ + UserSystem = "user,system" +} + +/** + * Defines values for Origin. \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user** \ + * **system** \ + * **user,system** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + /** Internal */ + Internal = "Internal" +} + +/** + * Defines values for ActionType. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal** + */ +export type ActionType = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** Creating */ + Creating = "Creating", + /** PendingBilling */ + PendingBilling = "PendingBilling", + /** ConfirmedBilling */ + ConfirmedBilling = "ConfirmedBilling", + /** Created */ + Created = "Created", + /** Succeeded */ + Succeeded = "Succeeded", + /** Cancelled */ + Cancelled = "Cancelled", + /** Expired */ + Expired = "Expired", + /** Failed */ + Failed = "Failed" +} + +/** + * 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** \ + * **PendingBilling** \ + * **ConfirmedBilling** \ + * **Created** \ + * **Succeeded** \ + * **Cancelled** \ + * **Expired** \ + * **Failed** + */ +export type ProvisioningState = string; + +/** Known values of {@link SavingsPlanTerm} that the service accepts. */ +export enum KnownSavingsPlanTerm { + /** P1Y */ + P1Y = "P1Y", + /** P3Y */ + P3Y = "P3Y" +} + +/** + * Defines values for SavingsPlanTerm. \ + * {@link KnownSavingsPlanTerm} can be used interchangeably with SavingsPlanTerm, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1Y** \ + * **P3Y** + */ +export type SavingsPlanTerm = string; + +/** Known values of {@link BillingPlan} that the service accepts. */ +export enum KnownBillingPlan { + /** P1M */ + P1M = "P1M" +} + +/** + * Defines values for BillingPlan. \ + * {@link KnownBillingPlan} can be used interchangeably with BillingPlan, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1M** + */ +export type BillingPlan = string; + +/** Known values of {@link AppliedScopeType} that the service accepts. */ +export enum KnownAppliedScopeType { + /** Single */ + Single = "Single", + /** Shared */ + Shared = "Shared", + /** ManagementGroup */ + ManagementGroup = "ManagementGroup" +} + +/** + * 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** \ + * **ManagementGroup** + */ +export type AppliedScopeType = string; + +/** Known values of {@link CommitmentGrain} that the service accepts. */ +export enum KnownCommitmentGrain { + /** Hourly */ + Hourly = "Hourly" +} + +/** + * Defines values for CommitmentGrain. \ + * {@link KnownCommitmentGrain} can be used interchangeably with CommitmentGrain, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Hourly** + */ +export type CommitmentGrain = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + 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 PaymentStatus} that the service accepts. */ +export enum KnownPaymentStatus { + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Scheduled */ + Scheduled = "Scheduled", + /** Cancelled */ + 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 ReservedResourceType} that the service accepts. */ +export enum KnownReservedResourceType { + /** ComputeSavingsPlan */ + ComputeSavingsPlan = "ComputeSavingsPlan", + /** VirtualMachines */ + VirtualMachines = "VirtualMachines", + /** SqlDatabases */ + SqlDatabases = "SqlDatabases", + /** SuseLinux */ + SuseLinux = "SuseLinux", + /** CosmosDb */ + CosmosDb = "CosmosDb", + /** RedHat */ + RedHat = "RedHat", + /** SqlDataWarehouse */ + SqlDataWarehouse = "SqlDataWarehouse", + /** VMwareCloudSimple */ + VMwareCloudSimple = "VMwareCloudSimple", + /** RedHatOsa */ + RedHatOsa = "RedHatOsa", + /** Databricks */ + Databricks = "Databricks", + /** AppService */ + AppService = "AppService", + /** ManagedDisk */ + ManagedDisk = "ManagedDisk", + /** BlockBlob */ + BlockBlob = "BlockBlob", + /** RedisCache */ + RedisCache = "RedisCache", + /** AzureDataExplorer */ + AzureDataExplorer = "AzureDataExplorer", + /** MySql */ + MySql = "MySql", + /** MariaDb */ + MariaDb = "MariaDb", + /** PostgreSql */ + PostgreSql = "PostgreSql", + /** DedicatedHost */ + DedicatedHost = "DedicatedHost", + /** SapHana */ + SapHana = "SapHana", + /** SqlAzureHybridBenefit */ + SqlAzureHybridBenefit = "SqlAzureHybridBenefit", + /** AVS */ + AVS = "AVS", + /** DataFactory */ + DataFactory = "DataFactory", + /** NetAppStorage */ + NetAppStorage = "NetAppStorage", + /** AzureFiles */ + AzureFiles = "AzureFiles", + /** SqlEdge */ + SqlEdge = "SqlEdge", + /** VirtualMachineSoftware */ + VirtualMachineSoftware = "VirtualMachineSoftware" +} + +/** + * 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 + * **ComputeSavingsPlan** \ + * **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** \ + * **VirtualMachineSoftware** + */ +export type ReservedResourceType = string; + +/** Known values of {@link InstanceFlexibility} that the service accepts. */ +export enum KnownInstanceFlexibility { + /** On */ + On = "On", + /** Off */ + 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 PricingCurrencyDuration} that the service accepts. */ +export enum KnownPricingCurrencyDuration { + /** P1M */ + P1M = "P1M", + /** P1Y */ + P1Y = "P1Y", + /** P3Y */ + P3Y = "P3Y" +} + +/** + * Defines values for PricingCurrencyDuration. \ + * {@link KnownPricingCurrencyDuration} can be used interchangeably with PricingCurrencyDuration, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1M** \ + * **P1Y** \ + * **P3Y** + */ +export type PricingCurrencyDuration = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface SavingsPlanOrderAliasCreateOptionalParams + 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 create operation. */ +export type SavingsPlanOrderAliasCreateResponse = SavingsPlanOrderAliasModel; + +/** Optional parameters. */ +export interface SavingsPlanOrderAliasGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SavingsPlanOrderAliasGetResponse = SavingsPlanOrderAliasModel; + +/** Optional parameters. */ +export interface SavingsPlanOrderGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SavingsPlanOrderGetResponse = SavingsPlanOrderModel; + +/** Optional parameters. */ +export interface SavingsPlanOrderElevateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the elevate operation. */ +export type SavingsPlanOrderElevateResponse = RoleAssignmentEntity; + +/** Optional parameters. */ +export interface SavingsPlanOrderListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type SavingsPlanOrderListResponse = SavingsPlanOrderModelList; + +/** Optional parameters. */ +export interface SavingsPlanOrderListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type SavingsPlanOrderListNextResponse = SavingsPlanOrderModelList; + +/** Optional parameters. */ +export interface SavingsPlansInOrderListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type SavingsPlansInOrderListResponse = SavingsPlanModelList; + +/** Optional parameters. */ +export interface SavingsPlansInOrderListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type SavingsPlansInOrderListNextResponse = SavingsPlanModelList; + +/** Optional parameters. */ +export interface SavingsPlansListOptionalParams + 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 savings plans group by provisioning states */ + refreshSummary?: string; + /** The number of savings plans to skip from the list before returning results */ + skiptoken?: number; + /** The selected provisioning state */ + selectedState?: string; + /** To number of savings plans to return */ + take?: number; +} + +/** Contains response data for the list operation. */ +export type SavingsPlansListResponse = SavingsPlanModelListResult; + +/** Optional parameters. */ +export interface SavingsPlansListNextOptionalParams + 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 savings plans group by provisioning states */ + refreshSummary?: string; + /** The number of savings plans to skip from the list before returning results */ + skiptoken?: number; + /** The selected provisioning state */ + selectedState?: string; + /** To number of savings plans to return */ + take?: number; +} + +/** Contains response data for the listNext operation. */ +export type SavingsPlansListNextResponse = SavingsPlanModelListResult; + +/** Optional parameters. */ +export interface SavingsPlanGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SavingsPlanGetResponse = SavingsPlanModel; + +/** Optional parameters. */ +export interface SavingsPlanUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type SavingsPlanUpdateResponse = SavingsPlanModel; + +/** Optional parameters. */ +export interface SavingsPlanUpdateValidateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the validate operation. */ +export type SavingsPlanUpdateValidateResponse = SavingsPlanValidateResponse; + +/** Optional parameters. */ +export interface SavingsPlanPurchaseValidateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the validate operation. */ +export type SavingsPlanPurchaseValidateResponse = SavingsPlanValidateResponse; + +/** Optional parameters. */ +export interface ReservationOrderAliasCreateOptionalParams + 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 create operation. */ +export type ReservationOrderAliasCreateResponse = ReservationOrderAliasResponse; + +/** Optional parameters. */ +export interface ReservationOrderAliasGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ReservationOrderAliasGetResponse = ReservationOrderAliasResponse; + +/** Optional parameters. */ +export interface BillingBenefitsRPOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** May be used to expand the detail information of some properties. */ + expand?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/models/mappers.ts b/sdk/billingbenefits/arm-billingbenefits/src/models/mappers.ts new file mode 100644 index 000000000000..323f80dcc2ec --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/models/mappers.ts @@ -0,0 +1,1763 @@ +/* + * 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 coreClient from "@azure/core-client"; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String" + } + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const Sku: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Sku", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const AppliedScopeProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppliedScopeProperties", + modelProperties: { + tenantId: { + serializedName: "tenantId", + type: { + name: "String" + } + }, + managementGroupId: { + serializedName: "managementGroupId", + type: { + name: "String" + } + }, + subscriptionId: { + serializedName: "subscriptionId", + type: { + name: "String" + } + }, + resourceGroupId: { + serializedName: "resourceGroupId", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + } + } + } +}; + +export const Price: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Price", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", + type: { + name: "String" + } + }, + amount: { + serializedName: "amount", + type: { + name: "Number" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const BillingPlanInformation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BillingPlanInformation", + modelProperties: { + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + }, + startDate: { + serializedName: "startDate", + type: { + name: "Date" + } + }, + nextPaymentDueDate: { + serializedName: "nextPaymentDueDate", + type: { + name: "Date" + } + }, + transactions: { + serializedName: "transactions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PaymentDetail" + } + } + } + } + } + } +}; + +export const PaymentDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PaymentDetail", + modelProperties: { + dueDate: { + serializedName: "dueDate", + type: { + name: "Date" + } + }, + paymentDate: { + serializedName: "paymentDate", + type: { + name: "Date" + } + }, + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + }, + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + extendedStatusInfo: { + serializedName: "extendedStatusInfo", + type: { + name: "Composite", + className: "ExtendedStatusInfo" + } + }, + billingAccount: { + serializedName: "billingAccount", + type: { + name: "String" + } + } + } + } +}; + +export const ExtendedStatusInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExtendedStatusInfo", + modelProperties: { + statusCode: { + serializedName: "statusCode", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const RoleAssignmentEntity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RoleAssignmentEntity", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + principalId: { + serializedName: "properties.principalId", + type: { + name: "String" + } + }, + roleDefinitionId: { + serializedName: "properties.roleDefinitionId", + type: { + name: "String" + } + }, + scope: { + serializedName: "properties.scope", + type: { + name: "String" + } + } + } + } +}; + +export const SavingsPlanOrderModelList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanOrderModelList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanOrderModel" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const SavingsPlanModelList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanModelList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanModel" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Utilization: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Utilization", + modelProperties: { + trend: { + serializedName: "trend", + readOnly: true, + type: { + name: "String" + } + }, + aggregates: { + serializedName: "aggregates", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UtilizationAggregates" + } + } + } + } + } + } +}; + +export const UtilizationAggregates: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UtilizationAggregates", + modelProperties: { + grain: { + serializedName: "grain", + readOnly: true, + type: { + name: "Number" + } + }, + grainUnit: { + serializedName: "grainUnit", + readOnly: true, + type: { + name: "String" + } + }, + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Number" + } + }, + valueUnit: { + serializedName: "valueUnit", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SavingsPlanModelPropertiesRenewProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanModelPropertiesRenewProperties", + modelProperties: { + purchaseProperties: { + serializedName: "purchaseProperties", + type: { + name: "Composite", + className: "PurchaseRequest" + } + } + } + } +}; + +export const PurchaseRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PurchaseRequest", + modelProperties: { + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + billingScopeId: { + serializedName: "properties.billingScopeId", + type: { + name: "String" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + commitment: { + serializedName: "properties.commitment", + type: { + name: "Composite", + className: "Commitment" + } + }, + effectiveDateTime: { + serializedName: "properties.effectiveDateTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + renew: { + defaultValue: false, + serializedName: "properties.renew", + type: { + name: "Boolean" + } + }, + appliedScopeProperties: { + serializedName: "properties.appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + } + } + } +}; + +export const SavingsPlanModelListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanModelListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanModel" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + }, + additionalProperties: { + serializedName: "additionalProperties", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanSummary" + } + } + } + } + } + } +}; + +export const SavingsPlanSummary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanSummary", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Composite", + className: "SavingsPlanSummaryCount" + } + } + } + } +}; + +export const SavingsPlanSummaryCount: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanSummaryCount", + modelProperties: { + succeededCount: { + serializedName: "succeededCount", + readOnly: true, + type: { + name: "Number" + } + }, + failedCount: { + serializedName: "failedCount", + readOnly: true, + type: { + name: "Number" + } + }, + expiringCount: { + serializedName: "expiringCount", + readOnly: true, + type: { + name: "Number" + } + }, + expiredCount: { + serializedName: "expiredCount", + readOnly: true, + type: { + name: "Number" + } + }, + pendingCount: { + serializedName: "pendingCount", + readOnly: true, + type: { + name: "Number" + } + }, + cancelledCount: { + serializedName: "cancelledCount", + readOnly: true, + type: { + name: "Number" + } + }, + processingCount: { + serializedName: "processingCount", + readOnly: true, + type: { + name: "Number" + } + }, + noBenefitCount: { + serializedName: "noBenefitCount", + readOnly: true, + type: { + name: "Number" + } + }, + warningCount: { + serializedName: "warningCount", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const SavingsPlanUpdateRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanUpdateRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "SavingsPlanUpdateRequestProperties" + } + } + } + } +}; + +export const SavingsPlanUpdateRequestProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanUpdateRequestProperties", + modelProperties: { + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "appliedScopeType", + type: { + name: "String" + } + }, + appliedScopeProperties: { + serializedName: "appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, + renew: { + defaultValue: false, + serializedName: "renew", + type: { + name: "Boolean" + } + }, + renewProperties: { + serializedName: "renewProperties", + type: { + name: "Composite", + className: "RenewProperties" + } + } + } + } +}; + +export const RenewProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RenewProperties", + modelProperties: { + purchaseProperties: { + serializedName: "purchaseProperties", + type: { + name: "Composite", + className: "PurchaseRequest" + } + } + } + } +}; + +export const SavingsPlanUpdateValidateRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanUpdateValidateRequest", + modelProperties: { + benefits: { + serializedName: "benefits", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanUpdateRequestProperties" + } + } + } + } + } + } +}; + +export const SavingsPlanValidateResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanValidateResponse", + modelProperties: { + benefits: { + serializedName: "benefits", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanValidResponseProperty" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const SavingsPlanValidResponseProperty: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanValidResponseProperty", + modelProperties: { + valid: { + serializedName: "valid", + type: { + name: "Boolean" + } + }, + reasonCode: { + serializedName: "reasonCode", + type: { + name: "String" + } + }, + reason: { + serializedName: "reason", + type: { + name: "String" + } + } + } + } +}; + +export const SavingsPlanPurchaseValidateRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanPurchaseValidateRequest", + modelProperties: { + benefits: { + serializedName: "benefits", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SavingsPlanOrderAliasModel" + } + } + } + } + } + } +}; + +export const ReservationOrderAliasRequestPropertiesReservedResourceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: + "ReservationOrderAliasRequestPropertiesReservedResourceProperties", + modelProperties: { + instanceFlexibility: { + serializedName: "instanceFlexibility", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationOrderAliasResponsePropertiesReservedResourceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: + "ReservationOrderAliasResponsePropertiesReservedResourceProperties", + modelProperties: { + instanceFlexibility: { + serializedName: "instanceFlexibility", + 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 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 Commitment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Commitment", + modelProperties: { + ...Price.type.modelProperties, + grain: { + serializedName: "grain", + type: { + name: "String" + } + } + } + } +}; + +export const PricingCurrencyTotal: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PricingCurrencyTotal", + modelProperties: { + ...Price.type.modelProperties, + duration: { + serializedName: "duration", + type: { + name: "String" + } + } + } + } +}; + +export const SavingsPlanOrderAliasModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanOrderAliasModel", + modelProperties: { + ...Resource.type.modelProperties, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + kind: { + serializedName: "kind", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + savingsPlanOrderId: { + serializedName: "properties.savingsPlanOrderId", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + billingScopeId: { + serializedName: "properties.billingScopeId", + type: { + name: "String" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + appliedScopeProperties: { + serializedName: "properties.appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, + commitment: { + serializedName: "properties.commitment", + type: { + name: "Composite", + className: "Commitment" + } + } + } + } +}; + +export const SavingsPlanOrderModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanOrderModel", + modelProperties: { + ...Resource.type.modelProperties, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + billingScopeId: { + serializedName: "properties.billingScopeId", + type: { + name: "String" + } + }, + billingProfileId: { + serializedName: "properties.billingProfileId", + readOnly: true, + type: { + name: "String" + } + }, + customerId: { + serializedName: "properties.customerId", + readOnly: true, + type: { + name: "String" + } + }, + billingAccountId: { + serializedName: "properties.billingAccountId", + readOnly: true, + type: { + name: "String" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, + expiryDateTime: { + serializedName: "properties.expiryDateTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + benefitStartTime: { + serializedName: "properties.benefitStartTime", + type: { + name: "DateTime" + } + }, + planInformation: { + serializedName: "properties.planInformation", + type: { + name: "Composite", + className: "BillingPlanInformation" + } + }, + savingsPlans: { + serializedName: "properties.savingsPlans", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + extendedStatusInfo: { + serializedName: "properties.extendedStatusInfo", + type: { + name: "Composite", + className: "ExtendedStatusInfo" + } + } + } + } +}; + +export const SavingsPlanModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanModel", + modelProperties: { + ...Resource.type.modelProperties, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + displayProvisioningState: { + serializedName: "properties.displayProvisioningState", + readOnly: true, + type: { + name: "String" + } + }, + billingScopeId: { + serializedName: "properties.billingScopeId", + type: { + name: "String" + } + }, + billingProfileId: { + serializedName: "properties.billingProfileId", + readOnly: true, + type: { + name: "String" + } + }, + customerId: { + serializedName: "properties.customerId", + readOnly: true, + type: { + name: "String" + } + }, + billingAccountId: { + serializedName: "properties.billingAccountId", + readOnly: true, + type: { + name: "String" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + userFriendlyAppliedScopeType: { + serializedName: "properties.userFriendlyAppliedScopeType", + readOnly: true, + type: { + name: "String" + } + }, + appliedScopeProperties: { + serializedName: "properties.appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, + commitment: { + serializedName: "properties.commitment", + type: { + name: "Composite", + className: "Commitment" + } + }, + effectiveDateTime: { + serializedName: "properties.effectiveDateTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + expiryDateTime: { + serializedName: "properties.expiryDateTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + purchaseDateTime: { + serializedName: "properties.purchaseDateTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + benefitStartTime: { + serializedName: "properties.benefitStartTime", + type: { + name: "DateTime" + } + }, + extendedStatusInfo: { + serializedName: "properties.extendedStatusInfo", + type: { + name: "Composite", + className: "ExtendedStatusInfo" + } + }, + renew: { + defaultValue: false, + serializedName: "properties.renew", + type: { + name: "Boolean" + } + }, + utilization: { + serializedName: "properties.utilization", + type: { + name: "Composite", + className: "Utilization" + } + }, + renewProperties: { + serializedName: "properties.renewProperties", + type: { + name: "Composite", + className: "SavingsPlanModelPropertiesRenewProperties" + } + } + } + } +}; + +export const ReservationOrderAliasRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationOrderAliasRequest", + modelProperties: { + ...Resource.type.modelProperties, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + billingScopeId: { + serializedName: "properties.billingScopeId", + type: { + name: "String" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + appliedScopeProperties: { + serializedName: "properties.appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, + quantity: { + constraints: { + InclusiveMinimum: 1 + }, + serializedName: "properties.quantity", + type: { + name: "Number" + } + }, + renew: { + defaultValue: false, + serializedName: "properties.renew", + type: { + name: "Boolean" + } + }, + reservedResourceType: { + serializedName: "properties.reservedResourceType", + type: { + name: "String" + } + }, + reviewDateTime: { + serializedName: "properties.reviewDateTime", + type: { + name: "DateTime" + } + }, + reservedResourceProperties: { + serializedName: "properties.reservedResourceProperties", + type: { + name: "Composite", + className: + "ReservationOrderAliasRequestPropertiesReservedResourceProperties" + } + } + } + } +}; + +export const ReservationOrderAliasResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationOrderAliasResponse", + modelProperties: { + ...Resource.type.modelProperties, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + reservationOrderId: { + serializedName: "properties.reservationOrderId", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + billingScopeId: { + serializedName: "properties.billingScopeId", + type: { + name: "String" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + appliedScopeProperties: { + serializedName: "properties.appliedScopeProperties", + type: { + name: "Composite", + className: "AppliedScopeProperties" + } + }, + quantity: { + serializedName: "properties.quantity", + type: { + name: "Number" + } + }, + renew: { + defaultValue: false, + serializedName: "properties.renew", + type: { + name: "Boolean" + } + }, + reservedResourceType: { + serializedName: "properties.reservedResourceType", + type: { + name: "String" + } + }, + reviewDateTime: { + serializedName: "properties.reviewDateTime", + type: { + name: "DateTime" + } + }, + reservedResourceProperties: { + serializedName: "properties.reservedResourceProperties", + type: { + name: "Composite", + className: + "ReservationOrderAliasResponsePropertiesReservedResourceProperties" + } + } + } + } +}; + +export const SavingsPlanOrderAliasCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanOrderAliasCreateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const SavingsPlanUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SavingsPlanUpdateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationOrderAliasCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationOrderAliasCreateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/models/parameters.ts b/sdk/billingbenefits/arm-billingbenefits/src/models/parameters.ts new file mode 100644 index 000000000000..6cdaef33217a --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/models/parameters.ts @@ -0,0 +1,225 @@ +/* + * 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 { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + SavingsPlanOrderAliasModel as SavingsPlanOrderAliasModelMapper, + SavingsPlanUpdateRequest as SavingsPlanUpdateRequestMapper, + SavingsPlanUpdateValidateRequest as SavingsPlanUpdateValidateRequestMapper, + SavingsPlanPurchaseValidateRequest as SavingsPlanPurchaseValidateRequestMapper, + ReservationOrderAliasRequest as ReservationOrderAliasRequestMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-11-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const body: OperationParameter = { + parameterPath: "body", + mapper: SavingsPlanOrderAliasModelMapper +}; + +export const savingsPlanOrderAliasName: OperationURLParameter = { + parameterPath: "savingsPlanOrderAliasName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$") + }, + serializedName: "savingsPlanOrderAliasName", + required: true, + type: { + name: "String" + } + } +}; + +export const savingsPlanOrderId: OperationURLParameter = { + parameterPath: "savingsPlanOrderId", + mapper: { + serializedName: "savingsPlanOrderId", + required: true, + type: { + name: "String" + } + } +}; + +export const expand: OperationQueryParameter = { + parameterPath: "expand", + mapper: { + serializedName: "$expand", + type: { + name: "String" + } + } +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +export const orderby: OperationQueryParameter = { + parameterPath: ["options", "orderby"], + mapper: { + serializedName: "$orderby", + type: { + name: "String" + } + } +}; + +export const refreshSummary: OperationQueryParameter = { + parameterPath: ["options", "refreshSummary"], + mapper: { + serializedName: "refreshSummary", + type: { + name: "String" + } + } +}; + +export const skiptoken: OperationQueryParameter = { + parameterPath: ["options", "skiptoken"], + mapper: { + serializedName: "$skiptoken", + type: { + name: "Number" + } + } +}; + +export const selectedState: OperationQueryParameter = { + parameterPath: ["options", "selectedState"], + mapper: { + serializedName: "selectedState", + type: { + name: "String" + } + } +}; + +export const take: OperationQueryParameter = { + parameterPath: ["options", "take"], + mapper: { + serializedName: "take", + type: { + name: "Number" + } + } +}; + +export const savingsPlanId: OperationURLParameter = { + parameterPath: "savingsPlanId", + mapper: { + serializedName: "savingsPlanId", + required: true, + type: { + name: "String" + } + } +}; + +export const body1: OperationParameter = { + parameterPath: "body", + mapper: SavingsPlanUpdateRequestMapper +}; + +export const body2: OperationParameter = { + parameterPath: "body", + mapper: SavingsPlanUpdateValidateRequestMapper +}; + +export const body3: OperationParameter = { + parameterPath: "body", + mapper: SavingsPlanPurchaseValidateRequestMapper +}; + +export const body4: OperationParameter = { + parameterPath: "body", + mapper: ReservationOrderAliasRequestMapper +}; + +export const reservationOrderAliasName: OperationURLParameter = { + parameterPath: "reservationOrderAliasName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9_\\-\\.]+$") + }, + serializedName: "reservationOrderAliasName", + required: true, + type: { + name: "String" + } + } +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/index.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/index.ts new file mode 100644 index 000000000000..80546f2c3a55 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/index.ts @@ -0,0 +1,17 @@ +/* + * 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 "./operations"; +export * from "./savingsPlanOrderAlias"; +export * from "./savingsPlanOrder"; +export * from "./savingsPlansInOrder"; +export * from "./savingsPlans"; +export * from "./savingsPlan"; +export * from "./savingsPlanUpdate"; +export * from "./savingsPlanPurchase"; +export * from "./reservationOrderAlias"; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/operations.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/operations.ts new file mode 100644 index 000000000000..89f2e30dfd82 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/operations.ts @@ -0,0 +1,137 @@ +/* + * 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 { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * List all the operations. + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): 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?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List all the operations. + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.BillingBenefits/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/reservationOrderAlias.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/reservationOrderAlias.ts new file mode 100644 index 000000000000..0f5d5e487347 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/reservationOrderAlias.ts @@ -0,0 +1,186 @@ +/* + * 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 { ReservationOrderAlias } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ReservationOrderAliasRequest, + ReservationOrderAliasCreateOptionalParams, + ReservationOrderAliasCreateResponse, + ReservationOrderAliasGetOptionalParams, + ReservationOrderAliasGetResponse +} from "../models"; + +/** Class containing ReservationOrderAlias operations. */ +export class ReservationOrderAliasImpl implements ReservationOrderAlias { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class ReservationOrderAlias class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * Create a reservation order alias. + * @param reservationOrderAliasName Name of the reservation order alias + * @param body Request body for creating a reservation order alias + * @param options The options parameters. + */ + async beginCreate( + reservationOrderAliasName: string, + body: ReservationOrderAliasRequest, + options?: ReservationOrderAliasCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationOrderAliasCreateResponse + > + > { + 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, + { reservationOrderAliasName, body, options }, + createOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a reservation order alias. + * @param reservationOrderAliasName Name of the reservation order alias + * @param body Request body for creating a reservation order alias + * @param options The options parameters. + */ + async beginCreateAndWait( + reservationOrderAliasName: string, + body: ReservationOrderAliasRequest, + options?: ReservationOrderAliasCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + reservationOrderAliasName, + body, + options + ); + return poller.pollUntilDone(); + } + + /** + * Get a reservation order alias. + * @param reservationOrderAliasName Name of the reservation order alias + * @param options The options parameters. + */ + get( + reservationOrderAliasName: string, + options?: ReservationOrderAliasGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationOrderAliasName, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/reservationOrderAliases/{reservationOrderAliasName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ReservationOrderAliasResponse + }, + 201: { + bodyMapper: Mappers.ReservationOrderAliasResponse + }, + 202: { + bodyMapper: Mappers.ReservationOrderAliasResponse + }, + 204: { + bodyMapper: Mappers.ReservationOrderAliasResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.body4, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderAliasName], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/reservationOrderAliases/{reservationOrderAliasName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ReservationOrderAliasResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderAliasName], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlan.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlan.ts new file mode 100644 index 000000000000..9edef6922a01 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlan.ts @@ -0,0 +1,122 @@ +/* + * 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 { SavingsPlan } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { + SavingsPlanGetOptionalParams, + SavingsPlanGetResponse, + SavingsPlanUpdateRequest, + SavingsPlanUpdateOptionalParams, + SavingsPlanUpdateResponse +} from "../models"; + +/** Class containing SavingsPlan operations. */ +export class SavingsPlanImpl implements SavingsPlan { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class SavingsPlan class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * Get savings plan. + * @param savingsPlanOrderId Order ID of the savings plan + * @param savingsPlanId ID of the savings plan + * @param options The options parameters. + */ + get( + savingsPlanOrderId: string, + savingsPlanId: string, + options?: SavingsPlanGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { savingsPlanOrderId, savingsPlanId, options }, + getOperationSpec + ); + } + + /** + * Update savings plan. + * @param savingsPlanOrderId Order ID of the savings plan + * @param savingsPlanId ID of the savings plan + * @param body Request body for patching a savings plan order alias + * @param options The options parameters. + */ + update( + savingsPlanOrderId: string, + savingsPlanId: string, + body: SavingsPlanUpdateRequest, + options?: SavingsPlanUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { savingsPlanOrderId, savingsPlanId, body, options }, + updateOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanModel + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.expand], + urlParameters: [ + Parameters.$host, + Parameters.savingsPlanOrderId, + Parameters.savingsPlanId + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanModel + }, + 202: { + headersMapper: Mappers.SavingsPlanUpdateHeaders + }, + 404: { + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.body1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.savingsPlanOrderId, + Parameters.savingsPlanId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanOrder.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanOrder.ts new file mode 100644 index 000000000000..6d810af047b7 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanOrder.ts @@ -0,0 +1,205 @@ +/* + * 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 { SavingsPlanOrder } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { + SavingsPlanOrderModel, + SavingsPlanOrderListNextOptionalParams, + SavingsPlanOrderListOptionalParams, + SavingsPlanOrderGetOptionalParams, + SavingsPlanOrderGetResponse, + SavingsPlanOrderElevateOptionalParams, + SavingsPlanOrderElevateResponse, + SavingsPlanOrderListResponse, + SavingsPlanOrderListNextResponse +} from "../models"; + +/// +/** Class containing SavingsPlanOrder operations. */ +export class SavingsPlanOrderImpl implements SavingsPlanOrder { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class SavingsPlanOrder class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * List all Savings plan orders. + * @param options The options parameters. + */ + public list( + options?: SavingsPlanOrderListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: SavingsPlanOrderListOptionalParams + ): 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?: SavingsPlanOrderListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Get a savings plan order. + * @param savingsPlanOrderId Order ID of the savings plan + * @param options The options parameters. + */ + get( + savingsPlanOrderId: string, + options?: SavingsPlanOrderGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { savingsPlanOrderId, options }, + getOperationSpec + ); + } + + /** + * Elevate as owner on savings plan order based on billing permissions. + * @param savingsPlanOrderId Order ID of the savings plan + * @param options The options parameters. + */ + elevate( + savingsPlanOrderId: string, + options?: SavingsPlanOrderElevateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { savingsPlanOrderId, options }, + elevateOperationSpec + ); + } + + /** + * List all Savings plan orders. + * @param options The options parameters. + */ + private _list( + options?: SavingsPlanOrderListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: SavingsPlanOrderListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanOrderModel + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.expand], + urlParameters: [Parameters.$host, Parameters.savingsPlanOrderId], + headerParameters: [Parameters.accept], + serializer +}; +const elevateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/elevate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.RoleAssignmentEntity + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.savingsPlanOrderId], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.BillingBenefits/savingsPlanOrders", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanOrderModelList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanOrderModelList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanOrderAlias.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanOrderAlias.ts new file mode 100644 index 000000000000..4051f7505988 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanOrderAlias.ts @@ -0,0 +1,186 @@ +/* + * 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 { SavingsPlanOrderAlias } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + SavingsPlanOrderAliasModel, + SavingsPlanOrderAliasCreateOptionalParams, + SavingsPlanOrderAliasCreateResponse, + SavingsPlanOrderAliasGetOptionalParams, + SavingsPlanOrderAliasGetResponse +} from "../models"; + +/** Class containing SavingsPlanOrderAlias operations. */ +export class SavingsPlanOrderAliasImpl implements SavingsPlanOrderAlias { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class SavingsPlanOrderAlias class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * Create a savings plan. + * @param savingsPlanOrderAliasName Name of the savings plan order alias + * @param body Request body for creating a savings plan order alias + * @param options The options parameters. + */ + async beginCreate( + savingsPlanOrderAliasName: string, + body: SavingsPlanOrderAliasModel, + options?: SavingsPlanOrderAliasCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SavingsPlanOrderAliasCreateResponse + > + > { + 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, + { savingsPlanOrderAliasName, body, options }, + createOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a savings plan. + * @param savingsPlanOrderAliasName Name of the savings plan order alias + * @param body Request body for creating a savings plan order alias + * @param options The options parameters. + */ + async beginCreateAndWait( + savingsPlanOrderAliasName: string, + body: SavingsPlanOrderAliasModel, + options?: SavingsPlanOrderAliasCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + savingsPlanOrderAliasName, + body, + options + ); + return poller.pollUntilDone(); + } + + /** + * Get a savings plan. + * @param savingsPlanOrderAliasName Name of the savings plan order alias + * @param options The options parameters. + */ + get( + savingsPlanOrderAliasName: string, + options?: SavingsPlanOrderAliasGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { savingsPlanOrderAliasName, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/savingsPlanOrderAliases/{savingsPlanOrderAliasName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanOrderAliasModel + }, + 201: { + bodyMapper: Mappers.SavingsPlanOrderAliasModel + }, + 202: { + bodyMapper: Mappers.SavingsPlanOrderAliasModel + }, + 204: { + bodyMapper: Mappers.SavingsPlanOrderAliasModel + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.savingsPlanOrderAliasName], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/savingsPlanOrderAliases/{savingsPlanOrderAliasName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanOrderAliasModel + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.savingsPlanOrderAliasName], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanPurchase.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanPurchase.ts new file mode 100644 index 000000000000..7fd57cee2625 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanPurchase.ts @@ -0,0 +1,67 @@ +/* + * 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 { SavingsPlanPurchase } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { + SavingsPlanPurchaseValidateRequest, + SavingsPlanPurchaseValidateOptionalParams, + SavingsPlanPurchaseValidateResponse +} from "../models"; + +/** Class containing SavingsPlanPurchase operations. */ +export class SavingsPlanPurchaseImpl implements SavingsPlanPurchase { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class SavingsPlanPurchase class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * Validate savings plan purchase. + * @param body Request body for validating the purchase of a savings plan + * @param options The options parameters. + */ + validate( + body: SavingsPlanPurchaseValidateRequest, + options?: SavingsPlanPurchaseValidateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { body, options }, + validateOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const validateOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.BillingBenefits/validate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanValidateResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.body3, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanUpdate.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanUpdate.ts new file mode 100644 index 000000000000..04be6adf784a --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlanUpdate.ts @@ -0,0 +1,76 @@ +/* + * 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 { SavingsPlanUpdate } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { + SavingsPlanUpdateValidateRequest, + SavingsPlanUpdateValidateOptionalParams, + SavingsPlanUpdateValidateResponse +} from "../models"; + +/** Class containing SavingsPlanUpdate operations. */ +export class SavingsPlanUpdateImpl implements SavingsPlanUpdate { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class SavingsPlanUpdate class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * Validate savings plan patch. + * @param savingsPlanOrderId Order ID of the savings plan + * @param savingsPlanId ID of the savings plan + * @param body Request body for validating a savings plan patch request + * @param options The options parameters. + */ + validate( + savingsPlanOrderId: string, + savingsPlanId: string, + body: SavingsPlanUpdateValidateRequest, + options?: SavingsPlanUpdateValidateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { savingsPlanOrderId, savingsPlanId, body, options }, + validateOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const validateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/validate", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanValidateResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.body2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.savingsPlanOrderId, + Parameters.savingsPlanId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlans.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlans.ts new file mode 100644 index 000000000000..789db2bc226b --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlans.ts @@ -0,0 +1,153 @@ +/* + * 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 { SavingsPlans } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { + SavingsPlanModel, + SavingsPlansListNextOptionalParams, + SavingsPlansListOptionalParams, + SavingsPlansListResponse, + SavingsPlansListNextResponse +} from "../models"; + +/// +/** Class containing SavingsPlans operations. */ +export class SavingsPlansImpl implements SavingsPlans { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class SavingsPlans class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * List savings plans. + * @param options The options parameters. + */ + public list( + options?: SavingsPlansListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: SavingsPlansListOptionalParams + ): 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?: SavingsPlansListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List savings plans. + * @param options The options parameters. + */ + private _list( + options?: SavingsPlansListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: SavingsPlansListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.BillingBenefits/savingsPlans", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanModelListResult + }, + 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.SavingsPlanModelListResult + }, + default: { + 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/billingbenefits/arm-billingbenefits/src/operations/savingsPlansInOrder.ts b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlansInOrder.ts new file mode 100644 index 000000000000..19b7d7afdada --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operations/savingsPlansInOrder.ts @@ -0,0 +1,157 @@ +/* + * 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 { SavingsPlansInOrder } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { BillingBenefitsRP } from "../billingBenefitsRP"; +import { + SavingsPlanModel, + SavingsPlansInOrderListNextOptionalParams, + SavingsPlansInOrderListOptionalParams, + SavingsPlansInOrderListResponse, + SavingsPlansInOrderListNextResponse +} from "../models"; + +/// +/** Class containing SavingsPlansInOrder operations. */ +export class SavingsPlansInOrderImpl implements SavingsPlansInOrder { + private readonly client: BillingBenefitsRP; + + /** + * Initialize a new instance of the class SavingsPlansInOrder class. + * @param client Reference to the service client + */ + constructor(client: BillingBenefitsRP) { + this.client = client; + } + + /** + * List savings plans in an order. + * @param savingsPlanOrderId Order ID of the savings plan + * @param options The options parameters. + */ + public list( + savingsPlanOrderId: string, + options?: SavingsPlansInOrderListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(savingsPlanOrderId, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(savingsPlanOrderId, options); + } + }; + } + + private async *listPagingPage( + savingsPlanOrderId: string, + options?: SavingsPlansInOrderListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(savingsPlanOrderId, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + savingsPlanOrderId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + savingsPlanOrderId: string, + options?: SavingsPlansInOrderListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(savingsPlanOrderId, options)) { + yield* page; + } + } + + /** + * List savings plans in an order. + * @param savingsPlanOrderId Order ID of the savings plan + * @param options The options parameters. + */ + private _list( + savingsPlanOrderId: string, + options?: SavingsPlansInOrderListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { savingsPlanOrderId, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param savingsPlanOrderId Order ID of the savings plan + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + savingsPlanOrderId: string, + nextLink: string, + options?: SavingsPlansInOrderListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { savingsPlanOrderId, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanModelList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.savingsPlanOrderId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SavingsPlanModelList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.savingsPlanOrderId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/index.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..80546f2c3a55 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/index.ts @@ -0,0 +1,17 @@ +/* + * 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 "./operations"; +export * from "./savingsPlanOrderAlias"; +export * from "./savingsPlanOrder"; +export * from "./savingsPlansInOrder"; +export * from "./savingsPlans"; +export * from "./savingsPlan"; +export * from "./savingsPlanUpdate"; +export * from "./savingsPlanPurchase"; +export * from "./reservationOrderAlias"; diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/operations.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..05ec11883c07 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/operations.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 { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List all the operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/reservationOrderAlias.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/reservationOrderAlias.ts new file mode 100644 index 000000000000..239daa5f98f5 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/reservationOrderAlias.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ReservationOrderAliasRequest, + ReservationOrderAliasCreateOptionalParams, + ReservationOrderAliasCreateResponse, + ReservationOrderAliasGetOptionalParams, + ReservationOrderAliasGetResponse +} from "../models"; + +/** Interface representing a ReservationOrderAlias. */ +export interface ReservationOrderAlias { + /** + * Create a reservation order alias. + * @param reservationOrderAliasName Name of the reservation order alias + * @param body Request body for creating a reservation order alias + * @param options The options parameters. + */ + beginCreate( + reservationOrderAliasName: string, + body: ReservationOrderAliasRequest, + options?: ReservationOrderAliasCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationOrderAliasCreateResponse + > + >; + /** + * Create a reservation order alias. + * @param reservationOrderAliasName Name of the reservation order alias + * @param body Request body for creating a reservation order alias + * @param options The options parameters. + */ + beginCreateAndWait( + reservationOrderAliasName: string, + body: ReservationOrderAliasRequest, + options?: ReservationOrderAliasCreateOptionalParams + ): Promise; + /** + * Get a reservation order alias. + * @param reservationOrderAliasName Name of the reservation order alias + * @param options The options parameters. + */ + get( + reservationOrderAliasName: string, + options?: ReservationOrderAliasGetOptionalParams + ): Promise; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlan.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlan.ts new file mode 100644 index 000000000000..bef1136b464c --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlan.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 { + SavingsPlanGetOptionalParams, + SavingsPlanGetResponse, + SavingsPlanUpdateRequest, + SavingsPlanUpdateOptionalParams, + SavingsPlanUpdateResponse +} from "../models"; + +/** Interface representing a SavingsPlan. */ +export interface SavingsPlan { + /** + * Get savings plan. + * @param savingsPlanOrderId Order ID of the savings plan + * @param savingsPlanId ID of the savings plan + * @param options The options parameters. + */ + get( + savingsPlanOrderId: string, + savingsPlanId: string, + options?: SavingsPlanGetOptionalParams + ): Promise; + /** + * Update savings plan. + * @param savingsPlanOrderId Order ID of the savings plan + * @param savingsPlanId ID of the savings plan + * @param body Request body for patching a savings plan order alias + * @param options The options parameters. + */ + update( + savingsPlanOrderId: string, + savingsPlanId: string, + body: SavingsPlanUpdateRequest, + options?: SavingsPlanUpdateOptionalParams + ): Promise; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanOrder.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanOrder.ts new file mode 100644 index 000000000000..6962062467b2 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanOrder.ts @@ -0,0 +1,47 @@ +/* + * 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 { + SavingsPlanOrderModel, + SavingsPlanOrderListOptionalParams, + SavingsPlanOrderGetOptionalParams, + SavingsPlanOrderGetResponse, + SavingsPlanOrderElevateOptionalParams, + SavingsPlanOrderElevateResponse +} from "../models"; + +/// +/** Interface representing a SavingsPlanOrder. */ +export interface SavingsPlanOrder { + /** + * List all Savings plan orders. + * @param options The options parameters. + */ + list( + options?: SavingsPlanOrderListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a savings plan order. + * @param savingsPlanOrderId Order ID of the savings plan + * @param options The options parameters. + */ + get( + savingsPlanOrderId: string, + options?: SavingsPlanOrderGetOptionalParams + ): Promise; + /** + * Elevate as owner on savings plan order based on billing permissions. + * @param savingsPlanOrderId Order ID of the savings plan + * @param options The options parameters. + */ + elevate( + savingsPlanOrderId: string, + options?: SavingsPlanOrderElevateOptionalParams + ): Promise; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanOrderAlias.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanOrderAlias.ts new file mode 100644 index 000000000000..562b5f30262b --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanOrderAlias.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + SavingsPlanOrderAliasModel, + SavingsPlanOrderAliasCreateOptionalParams, + SavingsPlanOrderAliasCreateResponse, + SavingsPlanOrderAliasGetOptionalParams, + SavingsPlanOrderAliasGetResponse +} from "../models"; + +/** Interface representing a SavingsPlanOrderAlias. */ +export interface SavingsPlanOrderAlias { + /** + * Create a savings plan. + * @param savingsPlanOrderAliasName Name of the savings plan order alias + * @param body Request body for creating a savings plan order alias + * @param options The options parameters. + */ + beginCreate( + savingsPlanOrderAliasName: string, + body: SavingsPlanOrderAliasModel, + options?: SavingsPlanOrderAliasCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SavingsPlanOrderAliasCreateResponse + > + >; + /** + * Create a savings plan. + * @param savingsPlanOrderAliasName Name of the savings plan order alias + * @param body Request body for creating a savings plan order alias + * @param options The options parameters. + */ + beginCreateAndWait( + savingsPlanOrderAliasName: string, + body: SavingsPlanOrderAliasModel, + options?: SavingsPlanOrderAliasCreateOptionalParams + ): Promise; + /** + * Get a savings plan. + * @param savingsPlanOrderAliasName Name of the savings plan order alias + * @param options The options parameters. + */ + get( + savingsPlanOrderAliasName: string, + options?: SavingsPlanOrderAliasGetOptionalParams + ): Promise; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanPurchase.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanPurchase.ts new file mode 100644 index 000000000000..c42b765f8d6e --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanPurchase.ts @@ -0,0 +1,26 @@ +/* + * 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 { + SavingsPlanPurchaseValidateRequest, + SavingsPlanPurchaseValidateOptionalParams, + SavingsPlanPurchaseValidateResponse +} from "../models"; + +/** Interface representing a SavingsPlanPurchase. */ +export interface SavingsPlanPurchase { + /** + * Validate savings plan purchase. + * @param body Request body for validating the purchase of a savings plan + * @param options The options parameters. + */ + validate( + body: SavingsPlanPurchaseValidateRequest, + options?: SavingsPlanPurchaseValidateOptionalParams + ): Promise; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanUpdate.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanUpdate.ts new file mode 100644 index 000000000000..5727ed5ec80a --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlanUpdate.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + SavingsPlanUpdateValidateRequest, + SavingsPlanUpdateValidateOptionalParams, + SavingsPlanUpdateValidateResponse +} from "../models"; + +/** Interface representing a SavingsPlanUpdate. */ +export interface SavingsPlanUpdate { + /** + * Validate savings plan patch. + * @param savingsPlanOrderId Order ID of the savings plan + * @param savingsPlanId ID of the savings plan + * @param body Request body for validating a savings plan patch request + * @param options The options parameters. + */ + validate( + savingsPlanOrderId: string, + savingsPlanId: string, + body: SavingsPlanUpdateValidateRequest, + options?: SavingsPlanUpdateValidateOptionalParams + ): Promise; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlans.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlans.ts new file mode 100644 index 000000000000..f90faea15333 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlans.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 { SavingsPlanModel, SavingsPlansListOptionalParams } from "../models"; + +/// +/** Interface representing a SavingsPlans. */ +export interface SavingsPlans { + /** + * List savings plans. + * @param options The options parameters. + */ + list( + options?: SavingsPlansListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlansInOrder.ts b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlansInOrder.ts new file mode 100644 index 000000000000..06521bb6b9d4 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/src/operationsInterfaces/savingsPlansInOrder.ts @@ -0,0 +1,27 @@ +/* + * 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 { + SavingsPlanModel, + SavingsPlansInOrderListOptionalParams +} from "../models"; + +/// +/** Interface representing a SavingsPlansInOrder. */ +export interface SavingsPlansInOrder { + /** + * List savings plans in an order. + * @param savingsPlanOrderId Order ID of the savings plan + * @param options The options parameters. + */ + list( + savingsPlanOrderId: string, + options?: SavingsPlansInOrderListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/billingbenefits/arm-billingbenefits/test/sampleTest.ts b/sdk/billingbenefits/arm-billingbenefits/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/test/sampleTest.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 { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + 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" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/billingbenefits/arm-billingbenefits/tsconfig.json b/sdk/billingbenefits/arm-billingbenefits/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/billingbenefits/arm-billingbenefits/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/billingbenefits/ci.mgmt.yml b/sdk/billingbenefits/ci.mgmt.yml new file mode 100644 index 000000000000..35b967b9901a --- /dev/null +++ b/sdk/billingbenefits/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/billingbenefits/arm-billingbenefits + - sdk/billingbenefits/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/billingbenefits/arm-billingbenefits + - sdk/billingbenefits/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: billingbenefits + Artifacts: + - name: azure-arm-billingbenefits + safeName: azurearmbillingbenefits + \ No newline at end of file