From 813f04b5ab8b8eb04d3021cc6f11ffc808988307 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 22 Dec 2021 06:38:22 +0000 Subject: [PATCH] CodeGen from PR 17153 in Azure/azure-rest-api-specs softwareplan remove extra tag,solutions add go track2 config (#17153) * adhybridhealthservice space enum,softwareplan remove extra tag,solutions add go track2 config * add track2 repo * remove adhybridhealthservice --- common/config/rush/pnpm-lock.yaml | 24 ++ rush.json | 5 + .../arm-softwareplan/CHANGELOG.md | 5 + sdk/softwareplan/arm-softwareplan/LICENSE | 21 ++ sdk/softwareplan/arm-softwareplan/README.md | 98 ++++++ sdk/softwareplan/arm-softwareplan/_meta.json | 7 + .../arm-softwareplan/api-extractor.json | 18 ++ .../arm-softwareplan/package.json | 90 ++++++ .../review/arm-softwareplan.api.md | 214 +++++++++++++ .../arm-softwareplan/rollup.config.js | 188 +++++++++++ .../arm-softwareplan/src/index.ts | 12 + .../arm-softwareplan/src/models/index.ts | 228 +++++++++++++ .../arm-softwareplan/src/models/mappers.ts | 235 ++++++++++++++ .../arm-softwareplan/src/models/parameters.ts | 125 ++++++++ .../src/operations/hybridUseBenefit.ts | 301 ++++++++++++++++++ .../operations/hybridUseBenefitRevision.ts | 165 ++++++++++ .../arm-softwareplan/src/operations/index.ts | 12 + .../src/operations/operations.ts | 151 +++++++++ .../src/operations/softwarePlan.ts | 53 +++ .../operationsInterfaces/hybridUseBenefit.ts | 87 +++++ .../hybridUseBenefitRevision.ts | 30 ++ .../src/operationsInterfaces/index.ts | 12 + .../src/operationsInterfaces/operations.ts | 25 ++ .../src/operationsInterfaces/softwarePlan.ts | 18 ++ .../arm-softwareplan/src/softwarePlanRP.ts | 91 ++++++ .../arm-softwareplan/test/sampleTest.ts | 48 +++ .../arm-softwareplan/tsconfig.json | 19 ++ sdk/softwareplan/ci.yml | 29 ++ 28 files changed, 2311 insertions(+) create mode 100644 sdk/softwareplan/arm-softwareplan/CHANGELOG.md create mode 100644 sdk/softwareplan/arm-softwareplan/LICENSE create mode 100644 sdk/softwareplan/arm-softwareplan/README.md create mode 100644 sdk/softwareplan/arm-softwareplan/_meta.json create mode 100644 sdk/softwareplan/arm-softwareplan/api-extractor.json create mode 100644 sdk/softwareplan/arm-softwareplan/package.json create mode 100644 sdk/softwareplan/arm-softwareplan/review/arm-softwareplan.api.md create mode 100644 sdk/softwareplan/arm-softwareplan/rollup.config.js create mode 100644 sdk/softwareplan/arm-softwareplan/src/index.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/models/index.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/models/mappers.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/models/parameters.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operations/hybridUseBenefit.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operations/hybridUseBenefitRevision.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operations/index.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operations/operations.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operations/softwarePlan.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/hybridUseBenefit.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/hybridUseBenefitRevision.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/index.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/operations.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/softwarePlan.ts create mode 100644 sdk/softwareplan/arm-softwareplan/src/softwarePlanRP.ts create mode 100644 sdk/softwareplan/arm-softwareplan/test/sampleTest.ts create mode 100644 sdk/softwareplan/arm-softwareplan/tsconfig.json create mode 100644 sdk/softwareplan/ci.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e05bbb08a2a2..d4af44c514dd 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -64,6 +64,7 @@ specifiers: '@rush-temp/arm-security': file:./projects/arm-security.tgz '@rush-temp/arm-servicebus': file:./projects/arm-servicebus.tgz '@rush-temp/arm-servicefabric': file:./projects/arm-servicefabric.tgz + '@rush-temp/arm-softwareplan': file:./projects/arm-softwareplan.tgz '@rush-temp/arm-sql': file:./projects/arm-sql.tgz '@rush-temp/arm-sqlvirtualmachine': file:./projects/arm-sqlvirtualmachine.tgz '@rush-temp/arm-storage': file:./projects/arm-storage.tgz @@ -237,6 +238,7 @@ dependencies: '@rush-temp/arm-security': file:projects/arm-security.tgz '@rush-temp/arm-servicebus': file:projects/arm-servicebus.tgz '@rush-temp/arm-servicefabric': file:projects/arm-servicefabric.tgz + '@rush-temp/arm-softwareplan': file:projects/arm-softwareplan.tgz '@rush-temp/arm-sql': file:projects/arm-sql.tgz '@rush-temp/arm-sqlvirtualmachine': file:projects/arm-sqlvirtualmachine.tgz '@rush-temp/arm-storage': file:projects/arm-storage.tgz @@ -1406,6 +1408,7 @@ packages: /@opentelemetry/node/0.22.0_@opentelemetry+api@1.0.3: resolution: {integrity: sha512-+HhGbDruQ7cwejVOIYyxRa28uosnG8W95NiQZ6qE8PXXPsDSyGeftAPbtYpGit0H2f5hrVcMlwmWHeAo9xkSLA==} engines: {node: '>=8.0.0'} + deprecated: Package renamed to @opentelemetry/sdk-trace-node peerDependencies: '@opentelemetry/api': ^1.0.0 dependencies: @@ -9053,6 +9056,27 @@ packages: uglify-js: 3.14.5 dev: false + file:projects/arm-softwareplan.tgz: + resolution: {integrity: sha512-ZK968NwoFveLQTfh3waV6KjpB2Snn/GqxiRM4KNd+jXtjQ3TDtiwZQAdrxBew8W0lg0oXrOnflTdBTWtGiBRNQ==, tarball: file:projects/arm-softwareplan.tgz} + name: '@rush-temp/arm-softwareplan' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.19.2 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + dev: false + file:projects/arm-sql.tgz: resolution: {integrity: sha512-Y9z4v0i1QfZQ5oO9jP3D0fTaQmDlc4a0Ak8h1sR+pBMwngAuIA95jb1LfiK94aZ3LblRjPdMHQFNVCm8eHOUyQ==, tarball: file:projects/arm-sql.tgz} name: '@rush-temp/arm-sql' diff --git a/rush.json b/rush.json index 2c8aa35cf347..30fcfa887392 100644 --- a/rush.json +++ b/rush.json @@ -1175,6 +1175,11 @@ "packageName": "@azure/arm-monitor", "projectFolder": "sdk/monitor/arm-monitor", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-softwareplan", + "projectFolder": "sdk/softwareplan/arm-softwareplan", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/softwareplan/arm-softwareplan/CHANGELOG.md b/sdk/softwareplan/arm-softwareplan/CHANGELOG.md new file mode 100644 index 000000000000..68cdcd815787 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2021-12-22) + +The package of @azure/arm-softwareplan 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/softwareplan/arm-softwareplan/LICENSE b/sdk/softwareplan/arm-softwareplan/LICENSE new file mode 100644 index 000000000000..ccb63b166732 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/softwareplan/arm-softwareplan/README.md b/sdk/softwareplan/arm-softwareplan/README.md new file mode 100644 index 000000000000..1822e9277878 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/README.md @@ -0,0 +1,98 @@ +# Azure Service client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client. + +Azure software plans let users create and manage licenses for various software used in Azure. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/softwareplan/arm-softwareplan) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-softwareplan) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-softwareplan) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-softwareplan` package + +Install the Azure Service client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-softwareplan +``` + +### Create and authenticate a `SoftwarePlanRP` + +To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal]. + +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 Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { SoftwarePlanRP } = require("@azure/arm-softwareplan"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new SoftwarePlanRP(new DefaultAzureCredential(), 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 + +### SoftwarePlanRP + +`SoftwarePlanRP` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fsoftwareplan%2Farm-softwareplan%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/softwareplan/arm-softwareplan/_meta.json b/sdk/softwareplan/arm-softwareplan/_meta.json new file mode 100644 index 000000000000..f78a29aacf81 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "8204d32d7c0042ec8359cd44ddf225032fd54ce5", + "readme": "specification/softwareplan/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/softwareplan/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" +} \ No newline at end of file diff --git a/sdk/softwareplan/arm-softwareplan/api-extractor.json b/sdk/softwareplan/arm-softwareplan/api-extractor.json new file mode 100644 index 000000000000..db43804963a3 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-softwareplan.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/softwareplan/arm-softwareplan/package.json b/sdk/softwareplan/arm-softwareplan/package.json new file mode 100644 index 000000000000..fa695f197064 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/package.json @@ -0,0 +1,90 @@ +{ + "name": "@azure/arm-softwareplan", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for SoftwarePlanRP.", + "version": "1.0.0", + "engines": { "node": ">=12.0.0" }, + "dependencies": { + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" + }, + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-softwareplan.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", + "rollup-plugin-sourcemaps": "^0.4.2", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/softwareplan/arm-softwareplan", + "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": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/softwareplan/arm-softwareplan/review/arm-softwareplan.api.md b/sdk/softwareplan/arm-softwareplan/review/arm-softwareplan.api.md new file mode 100644 index 000000000000..4ec8c0009751 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/review/arm-softwareplan.api.md @@ -0,0 +1,214 @@ +## API Report File for "@azure/arm-softwareplan" + +> 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'; + +// @public +export type ErrorCode = string; + +// @public +export interface ErrorModel { + code?: ErrorCode; + message?: string; +} + +// @public +export interface HybridUseBenefit { + create(scope: string, planId: string, body: HybridUseBenefitModel, options?: HybridUseBenefitCreateOptionalParams): Promise; + delete(scope: string, planId: string, options?: HybridUseBenefitDeleteOptionalParams): Promise; + get(scope: string, planId: string, options?: HybridUseBenefitGetOptionalParams): Promise; + list(scope: string, options?: HybridUseBenefitListOptionalParams): PagedAsyncIterableIterator; + update(scope: string, planId: string, body: HybridUseBenefitModel, options?: HybridUseBenefitUpdateOptionalParams): Promise; +} + +// @public +export interface HybridUseBenefitCreateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type HybridUseBenefitCreateResponse = HybridUseBenefitModel; + +// @public +export interface HybridUseBenefitDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface HybridUseBenefitGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type HybridUseBenefitGetResponse = HybridUseBenefitModel; + +// @public +export interface HybridUseBenefitListNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type HybridUseBenefitListNextResponse = HybridUseBenefitListResult; + +// @public +export interface HybridUseBenefitListOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type HybridUseBenefitListResponse = HybridUseBenefitListResult; + +// @public +export interface HybridUseBenefitListResult { + nextLink?: string; + value?: HybridUseBenefitModel[]; +} + +// @public +export type HybridUseBenefitModel = Resource & { + sku: Sku; + readonly etag?: number; + readonly provisioningState?: ProvisioningState; + readonly createdDate?: Date; + readonly lastUpdatedDate?: Date; +}; + +// @public +export interface HybridUseBenefitRevision { + list(scope: string, planId: string, options?: HybridUseBenefitRevisionListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface HybridUseBenefitRevisionListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type HybridUseBenefitRevisionListNextResponse = HybridUseBenefitListResult; + +// @public +export interface HybridUseBenefitRevisionListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type HybridUseBenefitRevisionListResponse = HybridUseBenefitListResult; + +// @public +export interface HybridUseBenefitUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type HybridUseBenefitUpdateResponse = HybridUseBenefitModel; + +// @public +export enum KnownErrorCode { + // (undocumented) + InvalidRequestParameter = "InvalidRequestParameter", + // (undocumented) + MissingRequestParameter = "MissingRequestParameter" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationList { + nextLink?: string; + value?: OperationResponse[]; +} + +// @public +export interface OperationResponse { + display?: OperationDisplay; + name?: string; + origin?: string; +} + +// @public +export interface Operations { + list(scope: string, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationList; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationList; + +// @public +export type ProvisioningState = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface Sku { + name?: string; +} + +// @public +export interface SoftwarePlan { + register(options?: SoftwarePlanRegisterOptionalParams): Promise; +} + +// @public +export interface SoftwarePlanRegisterOptionalParams extends coreClient.OperationOptions { +} + +// @public (undocumented) +export class SoftwarePlanRP extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: SoftwarePlanRPOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + hybridUseBenefit: HybridUseBenefit; + // (undocumented) + hybridUseBenefitRevision: HybridUseBenefitRevision; + // (undocumented) + operations: Operations; + // (undocumented) + softwarePlan: SoftwarePlan; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface SoftwarePlanRPOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/softwareplan/arm-softwareplan/rollup.config.js b/sdk/softwareplan/arm-softwareplan/rollup.config.js new file mode 100644 index 000000000000..9be1955eb7f1 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/rollup.config.js @@ -0,0 +1,188 @@ +/* + * 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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/softwareplan/arm-softwareplan/src/index.ts b/sdk/softwareplan/arm-softwareplan/src/index.ts new file mode 100644 index 000000000000..8f134202a0da --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/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 { SoftwarePlanRP } from "./softwarePlanRP"; +export * from "./operationsInterfaces"; diff --git a/sdk/softwareplan/arm-softwareplan/src/models/index.ts b/sdk/softwareplan/arm-softwareplan/src/models/index.ts new file mode 100644 index 000000000000..8bbfa71c2225 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/models/index.ts @@ -0,0 +1,228 @@ +/* + * 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"; + +/** Error object returned by the RP */ +export interface ErrorModel { + /** Error code */ + code?: ErrorCode; + /** A user readable error message. Localized based on x-ms-effective-locale header in the request */ + message?: string; +} + +/** List of hybrid use benefits */ +export interface HybridUseBenefitListResult { + /** List of hybrid use benefits */ + value?: HybridUseBenefitModel[]; + /** Url to get the next page of items. */ + nextLink?: string; +} + +/** The SKU to be applied for this resource */ +export interface Sku { + /** Name of the SKU to be applied */ + name?: string; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. 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; +} + +/** List all the operations. */ +export interface OperationList { + /** List of all operations */ + value?: OperationResponse[]; + /** Url to get the next page of items. */ + nextLink?: string; +} + +/** Operation response. */ +export interface OperationResponse { + /** Name of the operation */ + name?: string; + /** Display properties for the operation */ + display?: OperationDisplay; + /** Origin of the response */ + origin?: string; +} + +/** Display fields for an operation. */ +export interface OperationDisplay { + /** Resource Provider name */ + provider?: string; + /** Resource that is acted upon */ + resource?: string; + /** Operation to be performed */ + operation?: string; + /** Description of the operation */ + description?: string; +} + +/** Response on GET of a hybrid use benefit */ +export type HybridUseBenefitModel = Resource & { + /** Hybrid use benefit SKU */ + sku: Sku; + /** + * Indicates the revision of the hybrid use benefit + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly etag?: number; + /** + * Provisioning state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * Created date + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly createdDate?: Date; + /** + * Last updated date + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedDate?: Date; +}; + +/** Known values of {@link ErrorCode} that the service accepts. */ +export enum KnownErrorCode { + InvalidRequestParameter = "InvalidRequestParameter", + MissingRequestParameter = "MissingRequestParameter" +} + +/** + * Defines values for ErrorCode. \ + * {@link KnownErrorCode} can be used interchangeably with ErrorCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InvalidRequestParameter** \ + * **MissingRequestParameter** + */ +export type ErrorCode = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Succeeded = "Succeeded", + Cancelled = "Cancelled", + 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 + * **Succeeded** \ + * **Cancelled** \ + * **Failed** + */ +export type ProvisioningState = string; + +/** Optional parameters. */ +export interface SoftwarePlanRegisterOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface HybridUseBenefitListOptionalParams + extends coreClient.OperationOptions { + /** Supports applying filter on the type of SKU */ + filter?: string; +} + +/** Contains response data for the list operation. */ +export type HybridUseBenefitListResponse = HybridUseBenefitListResult; + +/** Optional parameters. */ +export interface HybridUseBenefitCreateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the create operation. */ +export type HybridUseBenefitCreateResponse = HybridUseBenefitModel; + +/** Optional parameters. */ +export interface HybridUseBenefitUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type HybridUseBenefitUpdateResponse = HybridUseBenefitModel; + +/** Optional parameters. */ +export interface HybridUseBenefitGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type HybridUseBenefitGetResponse = HybridUseBenefitModel; + +/** Optional parameters. */ +export interface HybridUseBenefitDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface HybridUseBenefitListNextOptionalParams + extends coreClient.OperationOptions { + /** Supports applying filter on the type of SKU */ + filter?: string; +} + +/** Contains response data for the listNext operation. */ +export type HybridUseBenefitListNextResponse = HybridUseBenefitListResult; + +/** Optional parameters. */ +export interface HybridUseBenefitRevisionListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type HybridUseBenefitRevisionListResponse = HybridUseBenefitListResult; + +/** Optional parameters. */ +export interface HybridUseBenefitRevisionListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type HybridUseBenefitRevisionListNextResponse = HybridUseBenefitListResult; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationList; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationList; + +/** Optional parameters. */ +export interface SoftwarePlanRPOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/softwareplan/arm-softwareplan/src/models/mappers.ts b/sdk/softwareplan/arm-softwareplan/src/models/mappers.ts new file mode 100644 index 000000000000..f5ba94dbbc5a --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/models/mappers.ts @@ -0,0 +1,235 @@ +/* + * 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 ErrorModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const HybridUseBenefitListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HybridUseBenefitListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "HybridUseBenefitModel" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Sku: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Sku", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +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" + } + } + } + } +}; + +export const OperationList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OperationResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResponse", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const HybridUseBenefitModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HybridUseBenefitModel", + modelProperties: { + ...Resource.type.modelProperties, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + etag: { + serializedName: "etag", + readOnly: true, + type: { + name: "Number" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + createdDate: { + serializedName: "properties.createdDate", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastUpdatedDate: { + serializedName: "properties.lastUpdatedDate", + readOnly: true, + type: { + name: "DateTime" + } + } + } + } +}; diff --git a/sdk/softwareplan/arm-softwareplan/src/models/parameters.ts b/sdk/softwareplan/arm-softwareplan/src/models/parameters.ts new file mode 100644 index 000000000000..c3950a7a13a7 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/models/parameters.ts @@ -0,0 +1,125 @@ +/* + * 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 { HybridUseBenefitModel as HybridUseBenefitModelMapper } 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 subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2019-12-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const scope: OperationURLParameter = { + parameterPath: "scope", + mapper: { + serializedName: "scope", + required: true, + type: { + name: "String" + } + } +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +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: HybridUseBenefitModelMapper +}; + +export const planId: OperationURLParameter = { + parameterPath: "planId", + mapper: { + serializedName: "planId", + required: true, + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; diff --git a/sdk/softwareplan/arm-softwareplan/src/operations/hybridUseBenefit.ts b/sdk/softwareplan/arm-softwareplan/src/operations/hybridUseBenefit.ts new file mode 100644 index 000000000000..06ec2d080638 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operations/hybridUseBenefit.ts @@ -0,0 +1,301 @@ +/* + * 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 { HybridUseBenefit } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { SoftwarePlanRP } from "../softwarePlanRP"; +import { + HybridUseBenefitModel, + HybridUseBenefitListNextOptionalParams, + HybridUseBenefitListOptionalParams, + HybridUseBenefitListResponse, + HybridUseBenefitCreateOptionalParams, + HybridUseBenefitCreateResponse, + HybridUseBenefitUpdateOptionalParams, + HybridUseBenefitUpdateResponse, + HybridUseBenefitGetOptionalParams, + HybridUseBenefitGetResponse, + HybridUseBenefitDeleteOptionalParams, + HybridUseBenefitListNextResponse +} from "../models"; + +/// +/** Class containing HybridUseBenefit operations. */ +export class HybridUseBenefitImpl implements HybridUseBenefit { + private readonly client: SoftwarePlanRP; + + /** + * Initialize a new instance of the class HybridUseBenefit class. + * @param client Reference to the service client + */ + constructor(client: SoftwarePlanRP) { + this.client = client; + } + + /** + * Get all hybrid use benefits associated with an ARM resource. + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param options The options parameters. + */ + public list( + scope: string, + options?: HybridUseBenefitListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(scope, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(scope, options); + } + }; + } + + private async *listPagingPage( + scope: string, + options?: HybridUseBenefitListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(scope, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(scope, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + scope: string, + options?: HybridUseBenefitListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(scope, options)) { + yield* page; + } + } + + /** + * Get all hybrid use benefits associated with an ARM resource. + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param options The options parameters. + */ + private _list( + scope: string, + options?: HybridUseBenefitListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, options }, + listOperationSpec + ); + } + + /** + * Create a new hybrid use benefit under a given scope + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param body Request body for creating a hybrid use benefit + * @param options The options parameters. + */ + create( + scope: string, + planId: string, + body: HybridUseBenefitModel, + options?: HybridUseBenefitCreateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, planId, body, options }, + createOperationSpec + ); + } + + /** + * Updates an existing hybrid use benefit + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param body Request body for creating a hybrid use benefit + * @param options The options parameters. + */ + update( + scope: string, + planId: string, + body: HybridUseBenefitModel, + options?: HybridUseBenefitUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, planId, body, options }, + updateOperationSpec + ); + } + + /** + * Gets a given plan ID + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param options The options parameters. + */ + get( + scope: string, + planId: string, + options?: HybridUseBenefitGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, planId, options }, + getOperationSpec + ); + } + + /** + * Deletes a given plan ID + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param options The options parameters. + */ + delete( + scope: string, + planId: string, + options?: HybridUseBenefitDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, planId, options }, + deleteOperationSpec + ); + } + + /** + * ListNext + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + scope: string, + nextLink: string, + options?: HybridUseBenefitListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.HybridUseBenefitListResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.scope], + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.HybridUseBenefitModel + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.scope, Parameters.planId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.HybridUseBenefitModel + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.scope, Parameters.planId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.HybridUseBenefitModel + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.scope, Parameters.planId], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.scope, Parameters.planId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.HybridUseBenefitListResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.scope, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/softwareplan/arm-softwareplan/src/operations/hybridUseBenefitRevision.ts b/sdk/softwareplan/arm-softwareplan/src/operations/hybridUseBenefitRevision.ts new file mode 100644 index 000000000000..729e76482026 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operations/hybridUseBenefitRevision.ts @@ -0,0 +1,165 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { HybridUseBenefitRevision } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { SoftwarePlanRP } from "../softwarePlanRP"; +import { + HybridUseBenefitModel, + HybridUseBenefitRevisionListNextOptionalParams, + HybridUseBenefitRevisionListOptionalParams, + HybridUseBenefitRevisionListResponse, + HybridUseBenefitRevisionListNextResponse +} from "../models"; + +/// +/** Class containing HybridUseBenefitRevision operations. */ +export class HybridUseBenefitRevisionImpl implements HybridUseBenefitRevision { + private readonly client: SoftwarePlanRP; + + /** + * Initialize a new instance of the class HybridUseBenefitRevision class. + * @param client Reference to the service client + */ + constructor(client: SoftwarePlanRP) { + this.client = client; + } + + /** + * Gets the version history of a hybrid use benefit + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param options The options parameters. + */ + public list( + scope: string, + planId: string, + options?: HybridUseBenefitRevisionListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(scope, planId, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(scope, planId, options); + } + }; + } + + private async *listPagingPage( + scope: string, + planId: string, + options?: HybridUseBenefitRevisionListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(scope, planId, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(scope, planId, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + scope: string, + planId: string, + options?: HybridUseBenefitRevisionListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(scope, planId, options)) { + yield* page; + } + } + + /** + * Gets the version history of a hybrid use benefit + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param options The options parameters. + */ + private _list( + scope: string, + planId: string, + options?: HybridUseBenefitRevisionListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, planId, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + scope: string, + planId: string, + nextLink: string, + options?: HybridUseBenefitRevisionListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, planId, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}/revisions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.HybridUseBenefitListResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.scope, Parameters.planId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.HybridUseBenefitListResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.scope, + Parameters.planId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/softwareplan/arm-softwareplan/src/operations/index.ts b/sdk/softwareplan/arm-softwareplan/src/operations/index.ts new file mode 100644 index 000000000000..cab53e90d196 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operations/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 "./softwarePlan"; +export * from "./hybridUseBenefit"; +export * from "./hybridUseBenefitRevision"; +export * from "./operations"; diff --git a/sdk/softwareplan/arm-softwareplan/src/operations/operations.ts b/sdk/softwareplan/arm-softwareplan/src/operations/operations.ts new file mode 100644 index 000000000000..2410c5aaedcd --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operations/operations.ts @@ -0,0 +1,151 @@ +/* + * 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 { SoftwarePlanRP } from "../softwarePlanRP"; +import { + OperationResponse, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: SoftwarePlanRP; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: SoftwarePlanRP) { + this.client = client; + } + + /** + * List all the operations. + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param options The options parameters. + */ + public list( + scope: string, + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(scope, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(scope, options); + } + }; + } + + private async *listPagingPage( + scope: string, + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(scope, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(scope, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + scope: string, + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(scope, options)) { + yield* page; + } + } + + /** + * List all the operations. + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param options The options parameters. + */ + private _list( + scope: string, + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + scope: string, + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { scope, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.SoftwarePlan/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.scope], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.scope, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/softwareplan/arm-softwareplan/src/operations/softwarePlan.ts b/sdk/softwareplan/arm-softwareplan/src/operations/softwarePlan.ts new file mode 100644 index 000000000000..97f8b6d7e209 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operations/softwarePlan.ts @@ -0,0 +1,53 @@ +/* + * 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 { SoftwarePlan } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { SoftwarePlanRP } from "../softwarePlanRP"; +import { SoftwarePlanRegisterOptionalParams } from "../models"; + +/** Class containing SoftwarePlan operations. */ +export class SoftwarePlanImpl implements SoftwarePlan { + private readonly client: SoftwarePlanRP; + + /** + * Initialize a new instance of the class SoftwarePlan class. + * @param client Reference to the service client + */ + constructor(client: SoftwarePlanRP) { + this.client = client; + } + + /** + * Register to Microsoft.SoftwarePlan resource provider. + * @param options The options parameters. + */ + register(options?: SoftwarePlanRegisterOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, registerOperationSpec); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const registerOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.SoftwarePlan/register", + httpMethod: "POST", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/hybridUseBenefit.ts b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/hybridUseBenefit.ts new file mode 100644 index 000000000000..f9aa997e6962 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/hybridUseBenefit.ts @@ -0,0 +1,87 @@ +/* + * 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 { + HybridUseBenefitModel, + HybridUseBenefitListOptionalParams, + HybridUseBenefitCreateOptionalParams, + HybridUseBenefitCreateResponse, + HybridUseBenefitUpdateOptionalParams, + HybridUseBenefitUpdateResponse, + HybridUseBenefitGetOptionalParams, + HybridUseBenefitGetResponse, + HybridUseBenefitDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a HybridUseBenefit. */ +export interface HybridUseBenefit { + /** + * Get all hybrid use benefits associated with an ARM resource. + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param options The options parameters. + */ + list( + scope: string, + options?: HybridUseBenefitListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Create a new hybrid use benefit under a given scope + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param body Request body for creating a hybrid use benefit + * @param options The options parameters. + */ + create( + scope: string, + planId: string, + body: HybridUseBenefitModel, + options?: HybridUseBenefitCreateOptionalParams + ): Promise; + /** + * Updates an existing hybrid use benefit + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param body Request body for creating a hybrid use benefit + * @param options The options parameters. + */ + update( + scope: string, + planId: string, + body: HybridUseBenefitModel, + options?: HybridUseBenefitUpdateOptionalParams + ): Promise; + /** + * Gets a given plan ID + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param options The options parameters. + */ + get( + scope: string, + planId: string, + options?: HybridUseBenefitGetOptionalParams + ): Promise; + /** + * Deletes a given plan ID + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param options The options parameters. + */ + delete( + scope: string, + planId: string, + options?: HybridUseBenefitDeleteOptionalParams + ): Promise; +} diff --git a/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/hybridUseBenefitRevision.ts b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/hybridUseBenefitRevision.ts new file mode 100644 index 000000000000..fcc45f46f29d --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/hybridUseBenefitRevision.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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + HybridUseBenefitModel, + HybridUseBenefitRevisionListOptionalParams +} from "../models"; + +/// +/** Interface representing a HybridUseBenefitRevision. */ +export interface HybridUseBenefitRevision { + /** + * Gets the version history of a hybrid use benefit + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param planId This is a unique identifier for a plan. Should be a guid. + * @param options The options parameters. + */ + list( + scope: string, + planId: string, + options?: HybridUseBenefitRevisionListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/index.ts b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..cab53e90d196 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/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 "./softwarePlan"; +export * from "./hybridUseBenefit"; +export * from "./hybridUseBenefitRevision"; +export * from "./operations"; diff --git a/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/operations.ts b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..4ad619e953d0 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/operations.ts @@ -0,0 +1,25 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { OperationResponse, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List all the operations. + * @param scope The scope at which the operation is performed. This is limited to + * Microsoft.Compute/virtualMachines and Microsoft.Compute/hostGroups/hosts for now + * @param options The options parameters. + */ + list( + scope: string, + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/softwarePlan.ts b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/softwarePlan.ts new file mode 100644 index 000000000000..b4457dd7dbbe --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/operationsInterfaces/softwarePlan.ts @@ -0,0 +1,18 @@ +/* + * 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 { SoftwarePlanRegisterOptionalParams } from "../models"; + +/** Interface representing a SoftwarePlan. */ +export interface SoftwarePlan { + /** + * Register to Microsoft.SoftwarePlan resource provider. + * @param options The options parameters. + */ + register(options?: SoftwarePlanRegisterOptionalParams): Promise; +} diff --git a/sdk/softwareplan/arm-softwareplan/src/softwarePlanRP.ts b/sdk/softwareplan/arm-softwareplan/src/softwarePlanRP.ts new file mode 100644 index 000000000000..e87f4062a91b --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/src/softwarePlanRP.ts @@ -0,0 +1,91 @@ +/* + * 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 coreAuth from "@azure/core-auth"; +import { + SoftwarePlanImpl, + HybridUseBenefitImpl, + HybridUseBenefitRevisionImpl, + OperationsImpl +} from "./operations"; +import { + SoftwarePlan, + HybridUseBenefit, + HybridUseBenefitRevision, + Operations +} from "./operationsInterfaces"; +import { SoftwarePlanRPOptionalParams } from "./models"; + +export class SoftwarePlanRP extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; + + /** + * Initializes a new instance of the SoftwarePlanRP class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: SoftwarePlanRPOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: SoftwarePlanRPOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-softwareplan/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 || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2019-12-01"; + this.softwarePlan = new SoftwarePlanImpl(this); + this.hybridUseBenefit = new HybridUseBenefitImpl(this); + this.hybridUseBenefitRevision = new HybridUseBenefitRevisionImpl(this); + this.operations = new OperationsImpl(this); + } + + softwarePlan: SoftwarePlan; + hybridUseBenefit: HybridUseBenefit; + hybridUseBenefitRevision: HybridUseBenefitRevision; + operations: Operations; +} diff --git a/sdk/softwareplan/arm-softwareplan/test/sampleTest.ts b/sdk/softwareplan/arm-softwareplan/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/softwareplan/arm-softwareplan/tsconfig.json b/sdk/softwareplan/arm-softwareplan/tsconfig.json new file mode 100644 index 000000000000..6e3251194117 --- /dev/null +++ b/sdk/softwareplan/arm-softwareplan/tsconfig.json @@ -0,0 +1,19 @@ +{ + "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"] +} diff --git a/sdk/softwareplan/ci.yml b/sdk/softwareplan/ci.yml new file mode 100644 index 000000000000..b5f0d1ac9a3b --- /dev/null +++ b/sdk/softwareplan/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/softwareplan/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/softwareplan/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: softwareplan + Artifacts: + - name: azure-arm-softwareplan + safeName: azurearmsoftwareplan + \ No newline at end of file