From 76696998972a81f3fc5a04031e02bdf456912f8f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 30 Jun 2022 02:25:38 +0000 Subject: [PATCH] CodeGen from PR 19622 in Azure/azure-rest-api-specs Merge cfbaa864f5c35e38c9f857cdba890f7c2474ffef into 45472ea9fc026c14e8962f78757a589b6586fe9d --- common/config/rush/pnpm-lock.yaml | 38 +- rush.json | 9 +- .../arm-resourceconnector/CHANGELOG.md | 5 + .../arm-resourceconnector/LICENSE | 21 + .../arm-resourceconnector/README.md | 109 +++ .../arm-resourceconnector/_meta.json | 8 + .../arm-resourceconnector/api-extractor.json | 31 + .../arm-resourceconnector/package.json | 112 +++ .../review/arm-resourceconnector.api.md | 433 +++++++++ .../arm-resourceconnector/rollup.config.js | 122 +++ .../arm-resourceconnector/src/index.ts | 12 + .../arm-resourceconnector/src/lroImpl.ts | 34 + .../arm-resourceconnector/src/models/index.ts | 651 ++++++++++++++ .../src/models/mappers.ts | 748 ++++++++++++++++ .../src/models/parameters.ts | 145 +++ .../src/operations/appliances.ts | 839 ++++++++++++++++++ .../src/operations/index.ts | 9 + .../src/operationsInterfaces/appliances.ts | 172 ++++ .../src/operationsInterfaces/index.ts | 9 + .../src/resourceConnectorManagementClient.ts | 134 +++ .../arm-resourceconnector/test/sampleTest.ts | 43 + .../arm-resourceconnector/tsconfig.json | 27 + sdk/resourceconnector/ci.mgmt.yml | 38 + 23 files changed, 3742 insertions(+), 7 deletions(-) create mode 100644 sdk/resourceconnector/arm-resourceconnector/CHANGELOG.md create mode 100644 sdk/resourceconnector/arm-resourceconnector/LICENSE create mode 100644 sdk/resourceconnector/arm-resourceconnector/README.md create mode 100644 sdk/resourceconnector/arm-resourceconnector/_meta.json create mode 100644 sdk/resourceconnector/arm-resourceconnector/api-extractor.json create mode 100644 sdk/resourceconnector/arm-resourceconnector/package.json create mode 100644 sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector.api.md create mode 100644 sdk/resourceconnector/arm-resourceconnector/rollup.config.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/index.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/lroImpl.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/models/index.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/models/mappers.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/models/parameters.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/operations/appliances.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/operations/index.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/appliances.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/index.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/resourceConnectorManagementClient.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/test/sampleTest.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/tsconfig.json create mode 100644 sdk/resourceconnector/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e8862cec0c07..65073d9ed7bb 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -144,6 +144,7 @@ specifiers: '@rush-temp/arm-redisenterprisecache': file:./projects/arm-redisenterprisecache.tgz '@rush-temp/arm-relay': file:./projects/arm-relay.tgz '@rush-temp/arm-reservations': file:./projects/arm-reservations.tgz + '@rush-temp/arm-resourceconnector': file:./projects/arm-resourceconnector.tgz '@rush-temp/arm-resourcegraph': file:./projects/arm-resourcegraph.tgz '@rush-temp/arm-resourcehealth': file:./projects/arm-resourcehealth.tgz '@rush-temp/arm-resourcemover': file:./projects/arm-resourcemover.tgz @@ -430,6 +431,7 @@ dependencies: '@rush-temp/arm-redisenterprisecache': file:projects/arm-redisenterprisecache.tgz '@rush-temp/arm-relay': file:projects/arm-relay.tgz '@rush-temp/arm-reservations': file:projects/arm-reservations.tgz + '@rush-temp/arm-resourceconnector': file:projects/arm-resourceconnector.tgz '@rush-temp/arm-resourcegraph': file:projects/arm-resourcegraph.tgz '@rush-temp/arm-resourcehealth': file:projects/arm-resourcehealth.tgz '@rush-temp/arm-resourcemover': file:projects/arm-resourcemover.tgz @@ -3941,7 +3943,7 @@ packages: dependencies: semver: 7.3.7 shelljs: 0.8.5 - typescript: 4.8.0-dev.20220628 + typescript: 4.8.0-dev.20220629 dev: false /downlevel-dts/0.4.0: @@ -8751,8 +8753,8 @@ packages: hasBin: true dev: false - /typescript/4.8.0-dev.20220628: - resolution: {integrity: sha512-89n1Fp/JQev/bPPuVferlfw0VguLxr0uFergLfPbhs+6Hlu3M5rLwplGLHL+JZ+0+BsTyWg779TmaMcqa5FB5Q==} + /typescript/4.8.0-dev.20220629: + resolution: {integrity: sha512-QEp1M6iqlYpQXFF2f9ucXMkXbYcAoXcG0ws0IG8bWd7mjPGf8R5iVCbQVSm1dzV/GoOy0PsvfNe5/uL6D9TSPA==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -13553,6 +13555,33 @@ packages: - supports-color dev: false + file:projects/arm-resourceconnector.tgz: + resolution: {integrity: sha512-PdwaP9stxI29pz8MEzRWCNeEPS7bUJWCcaDAxB5V0McQAi3nWKNmc5LKI50hv5bUoaejI4uPzvq3PrCSr9FKFQ==, tarball: file:projects/arm-resourceconnector.tgz} + name: '@rush-temp/arm-resourceconnector' + version: 0.0.0 + dependencies: + '@azure/core-lro': 2.2.4 + '@azure/identity': 2.0.4 + '@microsoft/api-extractor': 7.18.11 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.74.1 + '@rollup/plugin-json': 4.1.0_rollup@2.74.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.74.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.74.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.74.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.74.1 + tslib: 2.4.0 + typescript: 4.2.4 + uglify-js: 3.15.5 + transitivePeerDependencies: + - '@types/node' + - debug + - supports-color + dev: false + file:projects/arm-resourcegraph.tgz: resolution: {integrity: sha512-0ECZkn0Vu/MMysUtodUMIulb/vYcwG+kzLPlbh9CLw0LU6lbzjpTyk0nrx9jGMMzj+sYjS3qBzIirlyMoa0GIg==, tarball: file:projects/arm-resourcegraph.tgz} name: '@rush-temp/arm-resourcegraph' @@ -14854,7 +14883,7 @@ packages: dev: false file:projects/communication-email.tgz: - resolution: {integrity: sha512-cg+0o/UDZTS8e6Eud4C2ql+IE9FaqPi5QPAtPgjoFTMqsKulijRkLtb1guIK1mJ9SkaqFbUq8JYFsIYkClMmnA==, tarball: file:projects/communication-email.tgz} + resolution: {integrity: sha512-AlPbxogx/1TifV283TyuACZ7i4eQcVPCzYNbFkyLanbd95uk97Q+991I7XLxgA9tOIgo1xOrZdGTJO1E6WFXsw==, tarball: file:projects/communication-email.tgz} name: '@rush-temp/communication-email' version: 0.0.0 dependencies: @@ -14892,7 +14921,6 @@ packages: transitivePeerDependencies: - bufferutil - debug - - encoding - supports-color - utf-8-validate dev: false diff --git a/rush.json b/rush.json index cdfc696c00fa..1f4bd6f338c3 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. @@ -1740,6 +1740,11 @@ "packageName": "@azure/arm-confidentialledger", "projectFolder": "sdk/confidentialledger/arm-confidentialledger", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-resourceconnector", + "projectFolder": "sdk/resourceconnector/arm-resourceconnector", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/CHANGELOG.md b/sdk/resourceconnector/arm-resourceconnector/CHANGELOG.md new file mode 100644 index 000000000000..91d7f361186e --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-06-30) + +The package of @azure/arm-resourceconnector 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/resourceconnector/arm-resourceconnector/LICENSE b/sdk/resourceconnector/arm-resourceconnector/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/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/resourceconnector/arm-resourceconnector/README.md b/sdk/resourceconnector/arm-resourceconnector/README.md new file mode 100644 index 000000000000..5e015a881ab2 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/README.md @@ -0,0 +1,109 @@ +# Azure ResourceConnectorManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ResourceConnectorManagement client. + +The appliances Rest API spec. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-resourceconnector) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-resourceconnector?view=azure-node-preview) | +[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. + +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-resourceconnector` package + +Install the Azure ResourceConnectorManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-resourceconnector +``` + +### Create and authenticate a `ResourceConnectorManagementClient` + +To create a client object to access the Azure ResourceConnectorManagement API, you will need the `endpoint` of your Azure ResourceConnectorManagement resource and a `credential`. The Azure ResourceConnectorManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure ResourceConnectorManagement 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 ResourceConnectorManagement** 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 { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +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 ResourceConnectorManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new ResourceConnectorManagementClient(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 + +### ResourceConnectorManagementClient + +`ResourceConnectorManagementClient` is the primary interface for developers using the Azure ResourceConnectorManagement client library. Explore the methods on this client object to understand the different features of the Azure ResourceConnectorManagement 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%2Fresourceconnector%2Farm-resourceconnector%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/resourceconnector/arm-resourceconnector/_meta.json b/sdk/resourceconnector/arm-resourceconnector/_meta.json new file mode 100644 index 000000000000..f2a5a1e032ca --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "b538d2bc1cd00abae704a7e7adc808e815ff56dd", + "readme": "specification/resourceconnector/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/resourceconnector/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.2", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" +} \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/api-extractor.json b/sdk/resourceconnector/arm-resourceconnector/api-extractor.json new file mode 100644 index 000000000000..5adf2f8e4305 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/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-resourceconnector.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/resourceconnector/arm-resourceconnector/package.json b/sdk/resourceconnector/arm-resourceconnector/package.json new file mode 100644 index 000000000000..8d5b602f8571 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/package.json @@ -0,0 +1,112 @@ +{ + "name": "@azure/arm-resourceconnector", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for ResourceConnectorManagementClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=12.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-resourceconnector.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "7.18.11", + "@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.2.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", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector", + "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", + "docs": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/resourceConnectorManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector.api.md b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector.api.md new file mode 100644 index 000000000000..bf5190153fda --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector.api.md @@ -0,0 +1,433 @@ +## API Report File for "@azure/arm-resourceconnector" + +> 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 AccessProfileType = string; + +// @public +export type Appliance = TrackedResource & { + identity?: Identity; + readonly systemData?: SystemData; + distro?: Distro; + infrastructureConfig?: AppliancePropertiesInfrastructureConfig; + readonly provisioningState?: string; + publicKey?: string; + readonly status?: Status; + version?: string; +}; + +// @public +export interface ApplianceCredentialKubeconfig { + readonly name?: AccessProfileType; + readonly value?: string; +} + +// @public +export interface ApplianceListClusterCustomerUserCredentialResults { + readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; + readonly sshKeys?: { + [propertyName: string]: SSHKey; + }; +} + +// @public +export interface ApplianceListCredentialResults { + readonly hybridConnectionConfig?: HybridConnectionConfig; + readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; +} + +// @public +export interface ApplianceListResult { + readonly nextLink?: string; + readonly value?: Appliance[]; +} + +// @public +export interface ApplianceOperation { + readonly description?: string; + readonly isDataAction?: boolean; + readonly name?: string; + readonly operation?: string; + readonly origin?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface ApplianceOperationsList { + nextLink?: string; + value: ApplianceOperation[]; +} + +// @public +export interface AppliancePropertiesInfrastructureConfig { + provider?: Provider; +} + +// @public +export interface Appliances { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, parameters: Appliance, options?: AppliancesCreateOrUpdateOptionalParams): Promise, AppliancesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, parameters: Appliance, options?: AppliancesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, options?: AppliancesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, options?: AppliancesDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, options?: AppliancesGetOptionalParams): Promise; + getUpgradeGraph(resourceGroupName: string, resourceName: string, upgradeGraph: string, options?: AppliancesGetUpgradeGraphOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: AppliancesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: AppliancesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + listClusterCustomerUserCredential(resourceGroupName: string, resourceName: string, options?: AppliancesListClusterCustomerUserCredentialOptionalParams): Promise; + listClusterUserCredential(resourceGroupName: string, resourceName: string, options?: AppliancesListClusterUserCredentialOptionalParams): Promise; + listOperations(options?: AppliancesListOperationsOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, resourceName: string, options?: AppliancesUpdateOptionalParams): Promise; +} + +// @public +export interface AppliancesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type AppliancesCreateOrUpdateResponse = Appliance; + +// @public +export interface AppliancesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface AppliancesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesGetResponse = Appliance; + +// @public +export interface AppliancesGetUpgradeGraphOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesGetUpgradeGraphResponse = UpgradeGraph; + +// @public +export interface AppliancesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesListByResourceGroupNextResponse = ApplianceListResult; + +// @public +export interface AppliancesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesListByResourceGroupResponse = ApplianceListResult; + +// @public +export interface AppliancesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesListBySubscriptionNextResponse = ApplianceListResult; + +// @public +export interface AppliancesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesListBySubscriptionResponse = ApplianceListResult; + +// @public +export interface AppliancesListClusterCustomerUserCredentialOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesListClusterCustomerUserCredentialResponse = ApplianceListClusterCustomerUserCredentialResults; + +// @public +export interface AppliancesListClusterUserCredentialOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesListClusterUserCredentialResponse = ApplianceListCredentialResults; + +// @public +export interface AppliancesListOperationsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesListOperationsNextResponse = ApplianceOperationsList; + +// @public +export interface AppliancesListOperationsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppliancesListOperationsResponse = ApplianceOperationsList; + +// @public +export interface AppliancesUpdateOptionalParams extends coreClient.OperationOptions { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type AppliancesUpdateResponse = Appliance; + +// @public +export type CreatedByType = string; + +// @public +export type Distro = 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 +export interface HybridConnectionConfig { + readonly expirationTime?: number; + readonly hybridConnectionName?: string; + readonly relay?: string; + readonly token?: string; +} + +// @public +export interface Identity { + readonly principalId?: string; + readonly tenantId?: string; + type?: ResourceIdentityType; +} + +// @public +export enum KnownAccessProfileType { + // (undocumented) + ClusterCustomerUser = "clusterCustomerUser", + // (undocumented) + ClusterUser = "clusterUser" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownDistro { + // (undocumented) + AKSEdge = "AKSEdge" +} + +// @public +export enum KnownProvider { + // (undocumented) + HCI = "HCI", + // (undocumented) + KubeVirt = "KubeVirt", + // (undocumented) + OpenStack = "OpenStack", + // (undocumented) + Scvmm = "SCVMM", + // (undocumented) + VMWare = "VMWare" +} + +// @public +export enum KnownResourceIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned" +} + +// @public +export enum KnownSSHKeyType { + // (undocumented) + SSHCustomerUser = "SSHCustomerUser" +} + +// @public +export enum KnownStatus { + // (undocumented) + Connected = "Connected", + // (undocumented) + Connecting = "Connecting", + // (undocumented) + None = "None", + // (undocumented) + Offline = "Offline", + // (undocumented) + PostUpgrade = "PostUpgrade", + // (undocumented) + PreparingForUpgrade = "PreparingForUpgrade", + // (undocumented) + PreUpgrade = "PreUpgrade", + // (undocumented) + Running = "Running", + // (undocumented) + UpdatingCapi = "UpdatingCAPI", + // (undocumented) + UpdatingCloudOperator = "UpdatingCloudOperator", + // (undocumented) + UpdatingCluster = "UpdatingCluster", + // (undocumented) + UpgradeClusterExtensionFailedToDelete = "UpgradeClusterExtensionFailedToDelete", + // (undocumented) + UpgradeComplete = "UpgradeComplete", + // (undocumented) + UpgradeFailed = "UpgradeFailed", + // (undocumented) + UpgradePrerequisitesCompleted = "UpgradePrerequisitesCompleted", + // (undocumented) + Validating = "Validating", + // (undocumented) + WaitingForCloudOperator = "WaitingForCloudOperator", + // (undocumented) + WaitingForHeartbeat = "WaitingForHeartbeat" +} + +// @public +export interface PatchableAppliance { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type Provider = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public (undocumented) +export class ResourceConnectorManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ResourceConnectorManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + appliances: Appliances; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface ResourceConnectorManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type ResourceIdentityType = string; + +// @public +export interface SSHKey { + privateKey?: string; + publicKey?: string; +} + +// @public +export type SSHKeyType = string; + +// @public +export type Status = string; + +// @public +export interface SupportedVersion { + readonly metadata?: SupportedVersionMetadata; + readonly version?: string; +} + +// @public +export interface SupportedVersionCatalogVersion { + readonly data?: SupportedVersionCatalogVersionData; + readonly name?: string; + readonly namespace?: string; +} + +// @public +export interface SupportedVersionCatalogVersionData { + readonly audience?: string; + readonly catalog?: string; + readonly offer?: string; + readonly version?: string; +} + +// @public +export interface SupportedVersionMetadata { + readonly catalogVersion?: SupportedVersionCatalogVersion; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type TrackedResource = Resource & { + tags?: { + [propertyName: string]: string; + }; + location: string; +}; + +// @public +export interface UpgradeGraph { + readonly id?: string; + readonly name?: string; + properties?: UpgradeGraphProperties; +} + +// @public +export interface UpgradeGraphProperties { + readonly applianceVersion?: string; + readonly supportedVersions?: SupportedVersion[]; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/resourceconnector/arm-resourceconnector/rollup.config.js b/sdk/resourceconnector/arm-resourceconnector/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/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/resourceconnector/arm-resourceconnector/src/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/index.ts new file mode 100644 index 000000000000..5fc67f7895ef --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/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 { ResourceConnectorManagementClient } from "./resourceConnectorManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/lroImpl.ts b/sdk/resourceconnector/arm-resourceconnector/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/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/resourceconnector/arm-resourceconnector/src/models/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/models/index.ts new file mode 100644 index 000000000000..1413b4168121 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/models/index.ts @@ -0,0 +1,651 @@ +/* + * 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"; + +/** Lists of Appliances operations. */ +export interface ApplianceOperationsList { + /** Next page of operations. */ + nextLink?: string; + /** Array of applianceOperation */ + value: ApplianceOperation[]; +} + +/** Appliances operation. */ +export interface ApplianceOperation { + /** + * Is this Operation a data plane operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** + * The name of the compute operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The origin of the compute operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: string; + /** + * The description of the operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** + * The display name of the compute operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * The resource provider for the operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * The display name of the resource the operation applies to. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: 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 List Appliances operation response. */ +export interface ApplianceListResult { + /** + * The URL to use for getting the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; + /** + * The list of Appliances. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Appliance[]; +} + +/** Identity for the resource. */ +export interface Identity { + /** + * The principal ID of resource identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID of resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** The identity type. */ + type?: ResourceIdentityType; +} + +/** Contains infrastructure information about the Appliance */ +export interface AppliancePropertiesInfrastructureConfig { + /** Information about the connected appliance. */ + provider?: Provider; +} + +/** 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; +} + +/** 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; +} + +/** The Appliances patchable resource definition. */ +export interface PatchableAppliance { + /** Resource tags */ + tags?: { [propertyName: string]: string }; +} + +/** The List Cluster Customer User Credential Results appliance. */ +export interface ApplianceListClusterCustomerUserCredentialResults { + /** + * The list of appliance kubeconfigs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; + /** + * Map of Customer User Public and Private SSH Keys + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sshKeys?: { [propertyName: string]: SSHKey }; +} + +/** Cluster User Credential appliance. */ +export interface ApplianceCredentialKubeconfig { + /** + * Name which contains the role of the kubeconfig. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: AccessProfileType; + /** + * Contains the kubeconfig value. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: string; +} + +/** Appliance SSHKey definition. */ +export interface SSHKey { + /** User Private Key. */ + privateKey?: string; + /** User Public Key. */ + publicKey?: string; +} + +/** The List Cluster User Credential appliance. */ +export interface ApplianceListCredentialResults { + /** + * Contains the REP (rendezvous endpoint) and “Listener” access token from notification service (NS). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly hybridConnectionConfig?: HybridConnectionConfig; + /** + * The list of appliance kubeconfigs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; +} + +/** Contains the REP (rendezvous endpoint) and “Listener” access token from notification service (NS). */ +export interface HybridConnectionConfig { + /** + * Timestamp when this token will be expired. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expirationTime?: number; + /** + * Name of the connection + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly hybridConnectionName?: string; + /** + * Name of the notification service. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly relay?: string; + /** + * Listener access token + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly token?: string; +} + +/** The Upgrade Graph for appliance. */ +export interface UpgradeGraph { + /** + * The appliance resource path + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The release train name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** The properties of supported version */ + properties?: UpgradeGraphProperties; +} + +/** The Upgrade Graph Properties for appliance. */ +export interface UpgradeGraphProperties { + /** + * The current appliance version + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly applianceVersion?: string; + /** + * This contains the current version and supported upgrade versions. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly supportedVersions?: SupportedVersion[]; +} + +/** The SupportedVersion object for appliance. */ +export interface SupportedVersion { + /** + * This is the metadata of the supported newer version. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly metadata?: SupportedVersionMetadata; + /** + * The newer version available for upgrade. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly version?: string; +} + +/** The SupportedVersionMetadata object for appliance. */ +export interface SupportedVersionMetadata { + /** + * The newer supported version catalog version. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly catalogVersion?: SupportedVersionCatalogVersion; +} + +/** The SupportedVersionCatalogVersion object for appliance. */ +export interface SupportedVersionCatalogVersion { + /** + * The newer supported version catalog version data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly data?: SupportedVersionCatalogVersionData; + /** + * The catalog version name for the version available for upgrade. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The catalog version namespace for the version available for upgrade. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly namespace?: string; +} + +/** The SupportedVersionCatalogVersionData object for appliance. */ +export interface SupportedVersionCatalogVersionData { + /** + * The image audience name for the version available for upgrade. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly audience?: string; + /** + * The image catalog name for the version available for upgrade. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly catalog?: string; + /** + * The image offer name for the version available for upgrade. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly offer?: string; + /** + * The image version for the version available for upgrade. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly version?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export type TrackedResource = Resource & { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +}; + +/** Appliances definition. */ +export type Appliance = TrackedResource & { + /** Identity for the resource. */ + identity?: Identity; + /** + * Metadata pertaining to creation and last modification of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** Represents a supported Fabric/Infra. (AKSEdge etc...). */ + distro?: Distro; + /** Contains infrastructure information about the Appliance */ + infrastructureConfig?: AppliancePropertiesInfrastructureConfig; + /** + * The current deployment or provisioning state, which only appears in the response. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: string; + /** Certificates pair used to download MSI certificate from HIS */ + publicKey?: string; + /** + * Appliance’s health and state of connection to on-prem + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: Status; + /** Version of the Appliance */ + version?: string; +}; + +/** Known values of {@link ResourceIdentityType} that the service accepts. */ +export enum KnownResourceIdentityType { + SystemAssigned = "SystemAssigned", + None = "None" +} + +/** + * Defines values for ResourceIdentityType. \ + * {@link KnownResourceIdentityType} can be used interchangeably with ResourceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SystemAssigned** \ + * **None** + */ +export type ResourceIdentityType = string; + +/** Known values of {@link Distro} that the service accepts. */ +export enum KnownDistro { + AKSEdge = "AKSEdge" +} + +/** + * Defines values for Distro. \ + * {@link KnownDistro} can be used interchangeably with Distro, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AKSEdge** + */ +export type Distro = string; + +/** Known values of {@link Provider} that the service accepts. */ +export enum KnownProvider { + VMWare = "VMWare", + HCI = "HCI", + Scvmm = "SCVMM", + KubeVirt = "KubeVirt", + OpenStack = "OpenStack" +} + +/** + * Defines values for Provider. \ + * {@link KnownProvider} can be used interchangeably with Provider, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **VMWare** \ + * **HCI** \ + * **SCVMM** \ + * **KubeVirt** \ + * **OpenStack** + */ +export type Provider = string; + +/** Known values of {@link Status} that the service accepts. */ +export enum KnownStatus { + WaitingForHeartbeat = "WaitingForHeartbeat", + Validating = "Validating", + Connecting = "Connecting", + Connected = "Connected", + Running = "Running", + PreparingForUpgrade = "PreparingForUpgrade", + UpgradePrerequisitesCompleted = "UpgradePrerequisitesCompleted", + PreUpgrade = "PreUpgrade", + UpdatingCloudOperator = "UpdatingCloudOperator", + WaitingForCloudOperator = "WaitingForCloudOperator", + UpdatingCapi = "UpdatingCAPI", + UpdatingCluster = "UpdatingCluster", + PostUpgrade = "PostUpgrade", + UpgradeComplete = "UpgradeComplete", + UpgradeClusterExtensionFailedToDelete = "UpgradeClusterExtensionFailedToDelete", + UpgradeFailed = "UpgradeFailed", + Offline = "Offline", + None = "None" +} + +/** + * Defines values for Status. \ + * {@link KnownStatus} can be used interchangeably with Status, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **WaitingForHeartbeat** \ + * **Validating** \ + * **Connecting** \ + * **Connected** \ + * **Running** \ + * **PreparingForUpgrade** \ + * **UpgradePrerequisitesCompleted** \ + * **PreUpgrade** \ + * **UpdatingCloudOperator** \ + * **WaitingForCloudOperator** \ + * **UpdatingCAPI** \ + * **UpdatingCluster** \ + * **PostUpgrade** \ + * **UpgradeComplete** \ + * **UpgradeClusterExtensionFailedToDelete** \ + * **UpgradeFailed** \ + * **Offline** \ + * **None** + */ +export type Status = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link AccessProfileType} that the service accepts. */ +export enum KnownAccessProfileType { + ClusterUser = "clusterUser", + ClusterCustomerUser = "clusterCustomerUser" +} + +/** + * Defines values for AccessProfileType. \ + * {@link KnownAccessProfileType} can be used interchangeably with AccessProfileType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **clusterUser** \ + * **clusterCustomerUser** + */ +export type AccessProfileType = string; + +/** Known values of {@link SSHKeyType} that the service accepts. */ +export enum KnownSSHKeyType { + SSHCustomerUser = "SSHCustomerUser" +} + +/** + * Defines values for SSHKeyType. \ + * {@link KnownSSHKeyType} can be used interchangeably with SSHKeyType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SSHCustomerUser** + */ +export type SSHKeyType = string; + +/** Optional parameters. */ +export interface AppliancesListOperationsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listOperations operation. */ +export type AppliancesListOperationsResponse = ApplianceOperationsList; + +/** Optional parameters. */ +export interface AppliancesListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type AppliancesListBySubscriptionResponse = ApplianceListResult; + +/** Optional parameters. */ +export interface AppliancesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type AppliancesListByResourceGroupResponse = ApplianceListResult; + +/** Optional parameters. */ +export interface AppliancesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AppliancesGetResponse = Appliance; + +/** Optional parameters. */ +export interface AppliancesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type AppliancesCreateOrUpdateResponse = Appliance; + +/** Optional parameters. */ +export interface AppliancesDeleteOptionalParams + 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; +} + +/** Optional parameters. */ +export interface AppliancesUpdateOptionalParams + extends coreClient.OperationOptions { + /** Resource tags */ + tags?: { [propertyName: string]: string }; +} + +/** Contains response data for the update operation. */ +export type AppliancesUpdateResponse = Appliance; + +/** Optional parameters. */ +export interface AppliancesListClusterCustomerUserCredentialOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listClusterCustomerUserCredential operation. */ +export type AppliancesListClusterCustomerUserCredentialResponse = ApplianceListClusterCustomerUserCredentialResults; + +/** Optional parameters. */ +export interface AppliancesListClusterUserCredentialOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listClusterUserCredential operation. */ +export type AppliancesListClusterUserCredentialResponse = ApplianceListCredentialResults; + +/** Optional parameters. */ +export interface AppliancesGetUpgradeGraphOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getUpgradeGraph operation. */ +export type AppliancesGetUpgradeGraphResponse = UpgradeGraph; + +/** Optional parameters. */ +export interface AppliancesListOperationsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listOperationsNext operation. */ +export type AppliancesListOperationsNextResponse = ApplianceOperationsList; + +/** Optional parameters. */ +export interface AppliancesListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type AppliancesListBySubscriptionNextResponse = ApplianceListResult; + +/** Optional parameters. */ +export interface AppliancesListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type AppliancesListByResourceGroupNextResponse = ApplianceListResult; + +/** Optional parameters. */ +export interface ResourceConnectorManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/models/mappers.ts b/sdk/resourceconnector/arm-resourceconnector/src/models/mappers.ts new file mode 100644 index 000000000000..ea946336724e --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/models/mappers.ts @@ -0,0 +1,748 @@ +/* + * 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 ApplianceOperationsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApplianceOperationsList", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApplianceOperation" + } + } + } + } + } + } +}; + +export const ApplianceOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApplianceOperation", + modelProperties: { + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "display.description", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "display.operation", + readOnly: true, + type: { + name: "String" + } + }, + provider: { + serializedName: "display.provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "display.resource", + 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 ApplianceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApplianceListResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + }, + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Appliance" + } + } + } + } + } + } +}; + +export const Identity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Identity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const AppliancePropertiesInfrastructureConfig: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppliancePropertiesInfrastructureConfig", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + } + } + } +}; + +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 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 PatchableAppliance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PatchableAppliance", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const ApplianceListClusterCustomerUserCredentialResults: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApplianceListClusterCustomerUserCredentialResults", + modelProperties: { + kubeconfigs: { + serializedName: "kubeconfigs", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApplianceCredentialKubeconfig" + } + } + } + }, + sshKeys: { + serializedName: "sshKeys", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "Composite", className: "SSHKey" } } + } + } + } + } +}; + +export const ApplianceCredentialKubeconfig: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApplianceCredentialKubeconfig", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + value: { + serializedName: "value", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SSHKey: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SSHKey", + modelProperties: { + privateKey: { + serializedName: "privateKey", + type: { + name: "String" + } + }, + publicKey: { + serializedName: "publicKey", + type: { + name: "String" + } + } + } + } +}; + +export const ApplianceListCredentialResults: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApplianceListCredentialResults", + modelProperties: { + hybridConnectionConfig: { + serializedName: "hybridConnectionConfig", + type: { + name: "Composite", + className: "HybridConnectionConfig" + } + }, + kubeconfigs: { + serializedName: "kubeconfigs", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApplianceCredentialKubeconfig" + } + } + } + } + } + } +}; + +export const HybridConnectionConfig: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HybridConnectionConfig", + modelProperties: { + expirationTime: { + serializedName: "expirationTime", + readOnly: true, + type: { + name: "Number" + } + }, + hybridConnectionName: { + serializedName: "hybridConnectionName", + readOnly: true, + type: { + name: "String" + } + }, + relay: { + serializedName: "relay", + readOnly: true, + type: { + name: "String" + } + }, + token: { + serializedName: "token", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const UpgradeGraph: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpgradeGraph", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "UpgradeGraphProperties" + } + } + } + } +}; + +export const UpgradeGraphProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpgradeGraphProperties", + modelProperties: { + applianceVersion: { + serializedName: "applianceVersion", + readOnly: true, + type: { + name: "String" + } + }, + supportedVersions: { + serializedName: "supportedVersions", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SupportedVersion" + } + } + } + } + } + } +}; + +export const SupportedVersion: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SupportedVersion", + modelProperties: { + metadata: { + serializedName: "metadata", + type: { + name: "Composite", + className: "SupportedVersionMetadata" + } + }, + version: { + serializedName: "version", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SupportedVersionMetadata: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SupportedVersionMetadata", + modelProperties: { + catalogVersion: { + serializedName: "catalogVersion", + type: { + name: "Composite", + className: "SupportedVersionCatalogVersion" + } + } + } + } +}; + +export const SupportedVersionCatalogVersion: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SupportedVersionCatalogVersion", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "SupportedVersionCatalogVersionData" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + namespace: { + serializedName: "namespace", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SupportedVersionCatalogVersionData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SupportedVersionCatalogVersionData", + modelProperties: { + audience: { + serializedName: "audience", + readOnly: true, + type: { + name: "String" + } + }, + catalog: { + serializedName: "catalog", + readOnly: true, + type: { + name: "String" + } + }, + offer: { + serializedName: "offer", + readOnly: true, + type: { + name: "String" + } + }, + version: { + serializedName: "version", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const Appliance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Appliance", + modelProperties: { + ...TrackedResource.type.modelProperties, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "Identity" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + distro: { + defaultValue: "AKSEdge", + serializedName: "properties.distro", + type: { + name: "String" + } + }, + infrastructureConfig: { + serializedName: "properties.infrastructureConfig", + type: { + name: "Composite", + className: "AppliancePropertiesInfrastructureConfig" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + publicKey: { + serializedName: "properties.publicKey", + type: { + name: "String" + } + }, + status: { + serializedName: "properties.status", + readOnly: true, + type: { + name: "String" + } + }, + version: { + serializedName: "properties.version", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/models/parameters.ts b/sdk/resourceconnector/arm-resourceconnector/src/models/parameters.ts new file mode 100644 index 000000000000..492603e90df5 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/models/parameters.ts @@ -0,0 +1,145 @@ +/* + * 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 { + Appliance as ApplianceMapper, + PatchableAppliance as PatchableApplianceMapper +} 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-04-15-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + constraints: { + Pattern: new RegExp( + "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$" + ), + MaxLength: 63, + MinLength: 1 + }, + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: ApplianceMapper +}; + +export const tags: OperationParameter = { + parameterPath: ["options", "tags"], + mapper: PatchableApplianceMapper +}; + +export const upgradeGraph: OperationURLParameter = { + parameterPath: "upgradeGraph", + mapper: { + serializedName: "upgradeGraph", + 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/resourceconnector/arm-resourceconnector/src/operations/appliances.ts b/sdk/resourceconnector/arm-resourceconnector/src/operations/appliances.ts new file mode 100644 index 000000000000..ec64b115b3e4 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/operations/appliances.ts @@ -0,0 +1,839 @@ +/* + * 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 { Appliances } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ResourceConnectorManagementClient } from "../resourceConnectorManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ApplianceOperation, + AppliancesListOperationsNextOptionalParams, + AppliancesListOperationsOptionalParams, + Appliance, + AppliancesListBySubscriptionNextOptionalParams, + AppliancesListBySubscriptionOptionalParams, + AppliancesListByResourceGroupNextOptionalParams, + AppliancesListByResourceGroupOptionalParams, + AppliancesListOperationsResponse, + AppliancesListBySubscriptionResponse, + AppliancesListByResourceGroupResponse, + AppliancesGetOptionalParams, + AppliancesGetResponse, + AppliancesCreateOrUpdateOptionalParams, + AppliancesCreateOrUpdateResponse, + AppliancesDeleteOptionalParams, + AppliancesUpdateOptionalParams, + AppliancesUpdateResponse, + AppliancesListClusterCustomerUserCredentialOptionalParams, + AppliancesListClusterCustomerUserCredentialResponse, + AppliancesListClusterUserCredentialOptionalParams, + AppliancesListClusterUserCredentialResponse, + AppliancesGetUpgradeGraphOptionalParams, + AppliancesGetUpgradeGraphResponse, + AppliancesListOperationsNextResponse, + AppliancesListBySubscriptionNextResponse, + AppliancesListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing Appliances operations. */ +export class AppliancesImpl implements Appliances { + private readonly client: ResourceConnectorManagementClient; + + /** + * Initialize a new instance of the class Appliances class. + * @param client Reference to the service client + */ + constructor(client: ResourceConnectorManagementClient) { + this.client = client; + } + + /** + * Lists all available Appliances operations. + * @param options The options parameters. + */ + public listOperations( + options?: AppliancesListOperationsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listOperationsPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listOperationsPagingPage(options); + } + }; + } + + private async *listOperationsPagingPage( + options?: AppliancesListOperationsOptionalParams + ): AsyncIterableIterator { + let result = await this._listOperations(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listOperationsNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listOperationsPagingAll( + options?: AppliancesListOperationsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listOperationsPagingPage(options)) { + yield* page; + } + } + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each + * Appliance + * @param options The options parameters. + */ + public listBySubscription( + options?: AppliancesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: AppliancesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listBySubscriptionPagingAll( + options?: AppliancesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns + * properties of each Appliance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: AppliancesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: AppliancesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: AppliancesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Lists all available Appliances operations. + * @param options The options parameters. + */ + private _listOperations( + options?: AppliancesListOperationsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listOperationsOperationSpec + ); + } + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each + * Appliance + * @param options The options parameters. + */ + private _listBySubscription( + options?: AppliancesListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns + * properties of each Appliance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: AppliancesListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Gets the details of an Appliance with a specified resource group and name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: AppliancesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + getOperationSpec + ); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + parameters: Appliance, + options?: AppliancesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + AppliancesCreateOrUpdateResponse + > + > { + 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, + { resourceGroupName, resourceName, parameters, options }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + parameters: Appliance, + options?: AppliancesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + resourceName: string, + options?: AppliancesDeleteOptionalParams + ): Promise, void>> { + 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, + { resourceGroupName, resourceName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: AppliancesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + resourceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and + * Subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + resourceName: string, + options?: AppliancesUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + updateOperationSpec + ); + } + + /** + * Returns the cluster customer user credentials for the dedicated appliance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + listClusterCustomerUserCredential( + resourceGroupName: string, + resourceName: string, + options?: AppliancesListClusterCustomerUserCredentialOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listClusterCustomerUserCredentialOperationSpec + ); + } + + /** + * Returns the cluster user credentials for the dedicated appliance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + listClusterUserCredential( + resourceGroupName: string, + resourceName: string, + options?: AppliancesListClusterUserCredentialOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listClusterUserCredentialOperationSpec + ); + } + + /** + * Gets the upgrade graph of an Appliance with a specified resource group and name and specific release + * train. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param upgradeGraph Upgrade graph version, ex - stable + * @param options The options parameters. + */ + getUpgradeGraph( + resourceGroupName: string, + resourceName: string, + upgradeGraph: string, + options?: AppliancesGetUpgradeGraphOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, upgradeGraph, options }, + getUpgradeGraphOperationSpec + ); + } + + /** + * ListOperationsNext + * @param nextLink The nextLink from the previous successful call to the ListOperations method. + * @param options The options parameters. + */ + private _listOperationsNext( + nextLink: string, + options?: AppliancesListOperationsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listOperationsNextOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: AppliancesListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: AppliancesListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationsOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceConnector/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplianceOperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/appliances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplianceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplianceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Appliance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Appliance + }, + 201: { + bodyMapper: Mappers.Appliance + }, + 202: { + bodyMapper: Mappers.Appliance + }, + 204: { + bodyMapper: Mappers.Appliance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Appliance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: { + parameterPath: { tags: ["options", "tags"] }, + mapper: { ...Mappers.PatchableAppliance, required: true } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listClusterCustomerUserCredentialOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}/listClusterCustomerUserCredential", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ApplianceListClusterCustomerUserCredentialResults + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listClusterUserCredentialOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}/listClusterUserCredential", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ApplianceListCredentialResults + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getUpgradeGraphOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}/upgradeGraphs/{upgradeGraph}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpgradeGraph + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.upgradeGraph + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplianceOperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplianceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplianceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/operations/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/operations/index.ts new file mode 100644 index 000000000000..b83a9a9c162f --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/operations/index.ts @@ -0,0 +1,9 @@ +/* + * 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 "./appliances"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/appliances.ts b/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/appliances.ts new file mode 100644 index 000000000000..30b93c2f76ed --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/appliances.ts @@ -0,0 +1,172 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ApplianceOperation, + AppliancesListOperationsOptionalParams, + Appliance, + AppliancesListBySubscriptionOptionalParams, + AppliancesListByResourceGroupOptionalParams, + AppliancesGetOptionalParams, + AppliancesGetResponse, + AppliancesCreateOrUpdateOptionalParams, + AppliancesCreateOrUpdateResponse, + AppliancesDeleteOptionalParams, + AppliancesUpdateOptionalParams, + AppliancesUpdateResponse, + AppliancesListClusterCustomerUserCredentialOptionalParams, + AppliancesListClusterCustomerUserCredentialResponse, + AppliancesListClusterUserCredentialOptionalParams, + AppliancesListClusterUserCredentialResponse, + AppliancesGetUpgradeGraphOptionalParams, + AppliancesGetUpgradeGraphResponse +} from "../models"; + +/// +/** Interface representing a Appliances. */ +export interface Appliances { + /** + * Lists all available Appliances operations. + * @param options The options parameters. + */ + listOperations( + options?: AppliancesListOperationsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each + * Appliance + * @param options The options parameters. + */ + listBySubscription( + options?: AppliancesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns + * properties of each Appliance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: AppliancesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the details of an Appliance with a specified resource group and name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: AppliancesGetOptionalParams + ): Promise; + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + parameters: Appliance, + options?: AppliancesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + AppliancesCreateOrUpdateResponse + > + >; + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + parameters: Appliance, + options?: AppliancesCreateOrUpdateOptionalParams + ): Promise; + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + options?: AppliancesDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: AppliancesDeleteOptionalParams + ): Promise; + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and + * Subscription. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + resourceName: string, + options?: AppliancesUpdateOptionalParams + ): Promise; + /** + * Returns the cluster customer user credentials for the dedicated appliance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + listClusterCustomerUserCredential( + resourceGroupName: string, + resourceName: string, + options?: AppliancesListClusterCustomerUserCredentialOptionalParams + ): Promise; + /** + * Returns the cluster user credentials for the dedicated appliance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param options The options parameters. + */ + listClusterUserCredential( + resourceGroupName: string, + resourceName: string, + options?: AppliancesListClusterUserCredentialOptionalParams + ): Promise; + /** + * Gets the upgrade graph of an Appliance with a specified resource group and name and specific release + * train. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param upgradeGraph Upgrade graph version, ex - stable + * @param options The options parameters. + */ + getUpgradeGraph( + resourceGroupName: string, + resourceName: string, + upgradeGraph: string, + options?: AppliancesGetUpgradeGraphOptionalParams + ): Promise; +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..b83a9a9c162f --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/index.ts @@ -0,0 +1,9 @@ +/* + * 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 "./appliances"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/resourceConnectorManagementClient.ts b/sdk/resourceconnector/arm-resourceconnector/src/resourceConnectorManagementClient.ts new file mode 100644 index 000000000000..b781769af665 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/resourceConnectorManagementClient.ts @@ -0,0 +1,134 @@ +/* + * 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 { AppliancesImpl } from "./operations"; +import { Appliances } from "./operationsInterfaces"; +import { ResourceConnectorManagementClientOptionalParams } from "./models"; + +export class ResourceConnectorManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the ResourceConnectorManagementClient 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?: ResourceConnectorManagementClientOptionalParams + ) { + 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: ResourceConnectorManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-resourceconnector/1.0.0-beta.1`; + 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); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-04-15-preview"; + this.appliances = new AppliancesImpl(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 item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + appliances: Appliances; +} diff --git a/sdk/resourceconnector/arm-resourceconnector/test/sampleTest.ts b/sdk/resourceconnector/arm-resourceconnector/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/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/resourceconnector/arm-resourceconnector/tsconfig.json b/sdk/resourceconnector/arm-resourceconnector/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/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/resourceconnector/ci.mgmt.yml b/sdk/resourceconnector/ci.mgmt.yml new file mode 100644 index 000000000000..c21468300aba --- /dev/null +++ b/sdk/resourceconnector/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/resourceconnector/arm-resourceconnector + - sdk/resourceconnector/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/resourceconnector/arm-resourceconnector + - sdk/resourceconnector/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: resourceconnector + Artifacts: + - name: azure-arm-resourceconnector + safeName: azurearmresourceconnector + \ No newline at end of file