From ffdda32249fa57b6f608c337c7afe18e40062156 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 21 Nov 2025 23:31:06 +0000 Subject: [PATCH] Configurations: 'specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/ResourceConnector/tspconfig.yaml', API Version: 2025-03-01-preview, SDK Release Type: beta, and CommitSHA: 'e96c24570a484cff13d153fb472f812878866a39' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5601551 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- pnpm-lock.yaml | 33 +- .../arm-resourceconnector/CHANGELOG.md | 70 +- .../arm-resourceconnector/LICENSE | 2 +- .../arm-resourceconnector/README.md | 21 +- .../arm-resourceconnector/_meta.json | 8 - .../arm-resourceconnector/api-extractor.json | 4 +- .../arm-resourceconnector/assets.json | 6 - .../arm-resourceconnector/eslint.config.mjs | 14 + .../arm-resourceconnector/metadata.json | 62 + .../arm-resourceconnector/package.json | 207 ++-- ...sourceconnector-api-appliances-node.api.md | 94 ++ .../arm-resourceconnector-api-node.api.md | 28 + .../arm-resourceconnector-models-node.api.md | 326 ++++++ .../review/arm-resourceconnector-node.api.md | 297 +++-- .../arm-resourceconnector/sample.env | 5 +- .../appliancesCreateOrUpdateSample.ts | 58 +- .../samples-dev/appliancesDeleteSample.ts | 22 +- .../samples-dev/appliancesGetSample.ts | 21 +- .../appliancesGetTelemetryConfigSample.ts | 17 +- .../appliancesGetUpgradeGraphSample.ts | 26 +- .../appliancesListByResourceGroupSample.ts | 21 +- .../appliancesListBySubscriptionSample.ts | 18 +- ...pliancesListClusterUserCredentialSample.ts | 24 +- .../samples-dev/appliancesListKeysSample.ts | 21 +- .../appliancesListOperationsSample.ts | 18 +- .../samples-dev/appliancesUpdateSample.ts | 26 +- .../appliancesCreateOrUpdateSample.js | 45 - .../v1/javascript/appliancesDeleteSample.js | 36 - .../v1/javascript/appliancesGetSample.js | 36 - .../appliancesGetTelemetryConfigSample.js | 34 - .../appliancesGetUpgradeGraphSample.js | 41 - .../appliancesListByResourceGroupSample.js | 38 - .../appliancesListBySubscriptionSample.js | 37 - ...pliancesListClusterUserCredentialSample.js | 36 - .../v1/javascript/appliancesListKeysSample.js | 36 - .../appliancesListOperationsSample.js | 35 - .../v1/javascript/appliancesUpdateSample.js | 38 - .../samples/v1/javascript/sample.env | 4 - .../samples/v1/typescript/sample.env | 4 - .../src/appliancesCreateOrUpdateSample.ts | 53 - .../typescript/src/appliancesDeleteSample.ts | 44 - .../v1/typescript/src/appliancesGetSample.ts | 41 - .../src/appliancesGetTelemetryConfigSample.ts | 38 - .../src/appliancesGetUpgradeGraphSample.ts | 46 - .../appliancesListByResourceGroupSample.ts | 45 - .../src/appliancesListBySubscriptionSample.ts | 41 - ...pliancesListClusterUserCredentialSample.ts | 44 - .../src/appliancesListKeysSample.ts | 44 - .../src/appliancesListOperationsSample.ts | 35 - .../typescript/src/appliancesUpdateSample.ts | 50 - .../samples/v1/typescript/tsconfig.json | 17 - .../{v1 => v2-beta}/javascript/README.md | 58 +- .../appliancesCreateOrUpdateSample.js | 54 + .../javascript/appliancesDeleteSample.js | 24 + .../v2-beta/javascript/appliancesGetSample.js | 25 + .../appliancesGetTelemetryConfigSample.js | 25 + .../appliancesGetUpgradeGraphSample.js | 29 + .../appliancesListByResourceGroupSample.js | 29 + .../appliancesListBySubscriptionSample.js | 29 + ...pliancesListClusterUserCredentialSample.js | 28 + .../javascript/appliancesListKeysSample.js | 25 + .../appliancesListOperationsSample.js | 29 + .../javascript/appliancesUpdateSample.js | 27 + .../{v1 => v2-beta}/javascript/package.json | 12 +- .../samples/v2-beta/javascript/sample.env | 1 + .../{v1 => v2-beta}/typescript/README.md | 58 +- .../{v1 => v2-beta}/typescript/package.json | 14 +- .../samples/v2-beta/typescript/sample.env | 1 + .../src/appliancesCreateOrUpdateSample.ts | 54 + .../typescript/src/appliancesDeleteSample.ts | 24 + .../typescript/src/appliancesGetSample.ts | 25 + .../src/appliancesGetTelemetryConfigSample.ts | 25 + .../src/appliancesGetUpgradeGraphSample.ts | 29 + .../appliancesListByResourceGroupSample.ts | 29 + .../src/appliancesListBySubscriptionSample.ts | 29 + ...pliancesListClusterUserCredentialSample.ts | 28 + .../src/appliancesListKeysSample.ts | 25 + .../src/appliancesListOperationsSample.ts | 29 + .../typescript/src/appliancesUpdateSample.ts | 27 + .../samples/v2-beta/typescript/tsconfig.json | 20 + .../src/api/appliances/index.ts | 29 + .../src/api/appliances/operations.ts | 630 ++++++++++ .../src/api/appliances/options.ts | 46 + .../arm-resourceconnector/src/api/index.ts | 8 + .../api/resourceConnectorManagementContext.ts | 74 ++ .../src/classic/appliances/index.ts | 170 +++ .../src/classic/index.ts | 4 + .../arm-resourceconnector/src/index.ts | 84 +- .../arm-resourceconnector/src/logger.ts | 5 + .../arm-resourceconnector/src/lroImpl.ts | 38 - .../arm-resourceconnector/src/models/index.ts | 835 +------------ .../src/models/mappers.ts | 811 ------------- .../src/models/models.ts | 1030 +++++++++++++++++ .../src/models/parameters.ts | 145 --- .../src/operations/appliances.ts | 916 --------------- .../src/operations/index.ts | 9 - .../src/operationsInterfaces/appliances.ts | 181 --- .../src/operationsInterfaces/index.ts | 9 - .../arm-resourceconnector/src/pagingHelper.ts | 39 - .../src/resourceConnectorManagementClient.ts | 183 +-- .../src/restorePollerHelpers.ts | 155 +++ .../src/static-helpers/cloudSettingHelpers.ts | 42 + .../src/static-helpers/pagingHelpers.ts | 246 ++++ .../src/static-helpers/pollingHelpers.ts | 127 ++ .../src/static-helpers/urlTemplate.ts | 227 ++++ .../test/public/sampleTest.spec.ts | 28 + .../test/public/utils/recordedClient.ts | 24 + ...esourceconnnector__operations_test.spec.ts | 97 -- .../test/snippets.spec.ts | 2 +- .../arm-resourceconnector/tsconfig.json | 3 +- .../tsconfig.samples.json | 4 +- .../arm-resourceconnector/tsp-location.yaml | 4 + .../arm-resourceconnector/vitest.config.ts | 1 - .../vitest.esm.config.ts | 8 + sdk/resourceconnector/ci.mgmt.yml | 5 +- 115 files changed, 4791 insertions(+), 4607 deletions(-) delete mode 100644 sdk/resourceconnector/arm-resourceconnector/_meta.json delete mode 100644 sdk/resourceconnector/arm-resourceconnector/assets.json create mode 100644 sdk/resourceconnector/arm-resourceconnector/eslint.config.mjs create mode 100644 sdk/resourceconnector/arm-resourceconnector/metadata.json create mode 100644 sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-api-appliances-node.api.md create mode 100644 sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-api-node.api.md create mode 100644 sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-models-node.api.md delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesCreateOrUpdateSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesDeleteSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetTelemetryConfigSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetUpgradeGraphSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListByResourceGroupSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListBySubscriptionSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListClusterUserCredentialSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListKeysSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListOperationsSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesUpdateSample.js delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/sample.env delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/sample.env delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesCreateOrUpdateSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesDeleteSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetTelemetryConfigSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetUpgradeGraphSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListByResourceGroupSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListBySubscriptionSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListClusterUserCredentialSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListKeysSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListOperationsSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesUpdateSample.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/tsconfig.json rename sdk/resourceconnector/arm-resourceconnector/samples/{v1 => v2-beta}/javascript/README.md (53%) create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesCreateOrUpdateSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesDeleteSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetTelemetryConfigSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetUpgradeGraphSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListByResourceGroupSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListBySubscriptionSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListClusterUserCredentialSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListKeysSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListOperationsSample.js create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesUpdateSample.js rename sdk/resourceconnector/arm-resourceconnector/samples/{v1 => v2-beta}/javascript/package.json (68%) create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/sample.env rename sdk/resourceconnector/arm-resourceconnector/samples/{v1 => v2-beta}/typescript/README.md (55%) rename sdk/resourceconnector/arm-resourceconnector/samples/{v1 => v2-beta}/typescript/package.json (70%) create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/sample.env create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesCreateOrUpdateSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesDeleteSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetTelemetryConfigSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetUpgradeGraphSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListByResourceGroupSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListBySubscriptionSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListClusterUserCredentialSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListKeysSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListOperationsSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesUpdateSample.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/tsconfig.json create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/api/appliances/index.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/api/appliances/operations.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/api/appliances/options.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/api/index.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/api/resourceConnectorManagementContext.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/classic/appliances/index.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/classic/index.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/logger.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/src/lroImpl.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/src/models/mappers.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/models/models.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/src/models/parameters.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/src/operations/appliances.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/src/operations/index.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/appliances.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/index.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/src/pagingHelper.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/restorePollerHelpers.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/static-helpers/cloudSettingHelpers.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/static-helpers/pagingHelpers.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/static-helpers/pollingHelpers.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/src/static-helpers/urlTemplate.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/test/public/sampleTest.spec.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/test/public/utils/recordedClient.ts delete mode 100644 sdk/resourceconnector/arm-resourceconnector/test/resourceconnnector__operations_test.spec.ts create mode 100644 sdk/resourceconnector/arm-resourceconnector/tsp-location.yaml create mode 100644 sdk/resourceconnector/arm-resourceconnector/vitest.esm.config.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 30c886b52578..c21b6c70fa42 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25934,24 +25934,27 @@ importers: sdk/resourceconnector/arm-resourceconnector: dependencies: + '@azure-rest/core-client': + specifier: ^2.3.1 + version: link:../../core/core-client-rest '@azure/abort-controller': specifier: ^2.1.2 version: link:../../core/abort-controller '@azure/core-auth': specifier: ^1.9.0 version: link:../../core/core-auth - '@azure/core-client': - specifier: ^1.9.2 - version: link:../../core/core-client '@azure/core-lro': - specifier: ^2.5.3 - version: 2.7.2 - '@azure/core-paging': - specifier: ^1.6.2 - version: link:../../core/core-paging + specifier: ^3.1.0 + version: link:../../core/core-lro '@azure/core-rest-pipeline': - specifier: ^1.19.0 + specifier: ^1.20.0 version: link:../../core/core-rest-pipeline + '@azure/core-util': + specifier: ^1.12.0 + version: link:../../core/core-util + '@azure/logger': + specifier: ^1.2.0 + version: link:../../core/logger tslib: specifier: ^2.8.1 version: 2.8.1 @@ -25968,12 +25971,12 @@ importers: '@azure/dev-tool': specifier: workspace:^ version: link:../../../common/tools/dev-tool + '@azure/eslint-plugin-azure-sdk': + specifier: workspace:^ + version: link:../../../common/tools/eslint-plugin-azure-sdk '@azure/identity': specifier: catalog:internal version: 4.13.0 - '@azure/logger': - specifier: ^1.1.4 - version: link:../../core/logger '@types/node': specifier: 'catalog:' version: 20.19.25 @@ -25989,9 +25992,15 @@ importers: dotenv: specifier: catalog:testing version: 16.6.1 + eslint: + specifier: 'catalog:' + version: 9.39.1 playwright: specifier: catalog:testing version: 1.56.1 + prettier: + specifier: 'catalog:' + version: 3.6.2 rimraf: specifier: 'catalog:' version: 6.1.0 diff --git a/sdk/resourceconnector/arm-resourceconnector/CHANGELOG.md b/sdk/resourceconnector/arm-resourceconnector/CHANGELOG.md index cdcd5f9c7c3a..d2983245663d 100644 --- a/sdk/resourceconnector/arm-resourceconnector/CHANGELOG.md +++ b/sdk/resourceconnector/arm-resourceconnector/CHANGELOG.md @@ -1,7 +1,71 @@ # Release History - -## 1.0.0 (2023-08-14) + +## 2.0.0-beta.1 (2025-11-21) +Compared with version 1.0.0 ### Features Added + - Added operation AppliancesOperations.createOrUpdate + - Added operation AppliancesOperations.delete + - Added Interface ApplianceOperationValueDisplay + - Added Interface ApplianceProperties + - Added Interface DnsConfiguration + - Added Interface Event_2 + - Added Interface GatewayConfiguration + - Added Interface NetworkProfile + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface ProxyConfiguration + - Added Interface RestorePollerOptions + - Interface Appliance has a new optional parameter properties + - Interface ApplianceOperation has a new optional parameter display + - Interface AppliancesListKeysOptionalParams has a new optional parameter artifactType + - Added Type Alias AzureSupportedClouds + - Added Enum AzureClouds + - Added Enum KnownVersions + - Enum KnownStatus has a new value ArcGatewayUpdateComplete + - Enum KnownStatus has a new value ArcGatewayUpdateFailed + - Enum KnownStatus has a new value ArcGatewayUpdatePreparing + - Enum KnownStatus has a new value ArcGatewayUpdating + - Enum KnownStatus has a new value EtcdSnapshotFailed + - Enum KnownStatus has a new value NetworkDNSUpdateComplete + - Enum KnownStatus has a new value NetworkDNSUpdateFailed + - Enum KnownStatus has a new value NetworkDNSUpdatePreparing + - Enum KnownStatus has a new value NetworkDNSUpdating + - Enum KnownStatus has a new value NetworkProxyUpdateComplete + - Enum KnownStatus has a new value NetworkProxyUpdateFailed + - Enum KnownStatus has a new value NetworkProxyUpdatePreparing + - Enum KnownStatus has a new value NetworkProxyUpdating + - Enum KnownStatus has a new value ValidatingEtcdHealth + - Enum KnownStatus has a new value ValidatingImageDownload + - Enum KnownStatus has a new value ValidatingImageUpload + - Enum KnownStatus has a new value ValidatingSFSConnectivity + +### Breaking Changes + - Removed operation Appliances.beginCreateOrUpdate + - Removed operation Appliances.beginCreateOrUpdateAndWait + - Removed operation Appliances.beginDelete + - Removed operation Appliances.beginDeleteAndWait + - Operation Appliances.update has a new signature + - Removed Interface ApplianceOperationsList + - Interface Appliance no longer has parameter distro + - Interface Appliance no longer has parameter infrastructureConfig + - Interface Appliance no longer has parameter provisioningState + - Interface Appliance no longer has parameter publicKey + - Interface Appliance no longer has parameter status + - Interface Appliance no longer has parameter version + - Interface ApplianceOperation no longer has parameter description + - Interface ApplianceOperation no longer has parameter operation + - Interface ApplianceOperation no longer has parameter provider + - Interface ApplianceOperation no longer has parameter resource + - Interface AppliancesUpdateOptionalParams no longer has parameter tags + - Removed Type Alias ArtifactType + - Removed Type Alias SSHKeyType + - Removed Enum KnownArtifactType + - Removed Enum KnownSSHKeyType + - Enum KnownProvider no longer has value KubeVirt + - Enum KnownProvider no longer has value OpenStack + + +## 1.0.0 (2023-08-14) -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/azsdk/js/mgmt/quickstart ). +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/azsdk/js/mgmt/quickstart). diff --git a/sdk/resourceconnector/arm-resourceconnector/LICENSE b/sdk/resourceconnector/arm-resourceconnector/LICENSE index b2f52a2bad4e..63447fd8bbbf 100644 --- a/sdk/resourceconnector/arm-resourceconnector/LICENSE +++ b/sdk/resourceconnector/arm-resourceconnector/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/README.md b/sdk/resourceconnector/arm-resourceconnector/README.md index eb7f7b4fe456..81d18666efd4 100644 --- a/sdk/resourceconnector/arm-resourceconnector/README.md +++ b/sdk/resourceconnector/arm-resourceconnector/README.md @@ -4,10 +4,12 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f 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://learn.microsoft.com/javascript/api/@azure/arm-resourceconnector) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [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://learn.microsoft.com/javascript/api/@azure/arm-resourceconnector?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector/samples) ## Getting started @@ -44,7 +46,6 @@ 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://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). @@ -64,16 +65,16 @@ For browser environments, use the `InteractiveBrowserCredential` from the `@azur import { InteractiveBrowserCredential } from "@azure/identity"; import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); ``` -### JavaScript Bundle +### 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 @@ -98,7 +99,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## 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. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector/samples) directory for detailed examples on how to use this library. ## Contributing @@ -108,10 +109,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - - -[azure_cli]: https://learn.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 diff --git a/sdk/resourceconnector/arm-resourceconnector/_meta.json b/sdk/resourceconnector/arm-resourceconnector/_meta.json deleted file mode 100644 index 86e883a678df..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "6c6b16dc98d720304633b76c8e82c282ffa9cc08", - "readme": "specification/resourceconnector/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\resourceconnector\\resource-manager\\readme.md --use=@autorest/typescript@6.0.5 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", - "use": "@autorest/typescript@6.0.5" -} \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/api-extractor.json b/sdk/resourceconnector/arm-resourceconnector/api-extractor.json index 16d81e2eb512..870d6d399477 100644 --- a/sdk/resourceconnector/arm-resourceconnector/api-extractor.json +++ b/sdk/resourceconnector/arm-resourceconnector/api-extractor.json @@ -1,3 +1 @@ -{ - "extends": "../../../api-extractor-base.json" -} +{ "extends": "../../../api-extractor-base.json" } diff --git a/sdk/resourceconnector/arm-resourceconnector/assets.json b/sdk/resourceconnector/arm-resourceconnector/assets.json deleted file mode 100644 index 5c1874cf73fc..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/resourceconnector/arm-resourceconnector", - "Tag": "js/resourceconnector/arm-resourceconnector_f519a726c0" -} diff --git a/sdk/resourceconnector/arm-resourceconnector/eslint.config.mjs b/sdk/resourceconnector/arm-resourceconnector/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]); diff --git a/sdk/resourceconnector/arm-resourceconnector/metadata.json b/sdk/resourceconnector/arm-resourceconnector/metadata.json new file mode 100644 index 000000000000..61087c326503 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/metadata.json @@ -0,0 +1,62 @@ +{ + "apiVersion": "2025-03-01-preview", + "emitterVersion": "0.46.1", + "crossLanguageDefinitions": { + "CrossLanguagePackageId": "Microsoft.ResourceConnector", + "CrossLanguageDefinitionId": { + "@azure/arm-resourceconnector!appliance:interface": "Microsoft.ResourceConnector.Appliance", + "@azure/arm-resourceconnector!applianceProperties:interface": "Microsoft.ResourceConnector.ApplianceProperties", + "@azure/arm-resourceconnector!appliancePropertiesInfrastructureConfig:interface": "Microsoft.ResourceConnector.AppliancePropertiesInfrastructureConfig", + "@azure/arm-resourceconnector!Event:interface": "Microsoft.ResourceConnector.Event", + "@azure/arm-resourceconnector!NetworkProfile:interface": "Microsoft.ResourceConnector.NetworkProfile", + "@azure/arm-resourceconnector!ProxyConfiguration:interface": "Microsoft.ResourceConnector.ProxyConfiguration", + "@azure/arm-resourceconnector!DnsConfiguration:interface": "Microsoft.ResourceConnector.DnsConfiguration", + "@azure/arm-resourceconnector!GatewayConfiguration:interface": "Microsoft.ResourceConnector.GatewayConfiguration", + "@azure/arm-resourceconnector!Identity:interface": "Microsoft.ResourceConnector.Identity", + "@azure/arm-resourceconnector!TrackedResource:interface": "Azure.ResourceManager.CommonTypes.TrackedResource", + "@azure/arm-resourceconnector!Resource:interface": "Azure.ResourceManager.CommonTypes.Resource", + "@azure/arm-resourceconnector!SystemData:interface": "Azure.ResourceManager.CommonTypes.SystemData", + "@azure/arm-resourceconnector!ErrorResponse:interface": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "@azure/arm-resourceconnector!ErrorDetail:interface": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "@azure/arm-resourceconnector!ErrorAdditionalInfo:interface": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "@azure/arm-resourceconnector!ArmOperationStatusResourceProvisioningState:interface": "Azure.ResourceManager.ArmOperationStatus", + "@azure/arm-resourceconnector!patchableAppliance:interface": "Microsoft.ResourceConnector.PatchableAppliance", + "@azure/arm-resourceconnector!applianceListResult:interface": "Microsoft.ResourceConnector.ApplianceListResult", + "@azure/arm-resourceconnector!applianceListCredentialResults:interface": "Microsoft.ResourceConnector.ApplianceListCredentialResults", + "@azure/arm-resourceconnector!HybridConnectionConfig:interface": "Microsoft.ResourceConnector.HybridConnectionConfig", + "@azure/arm-resourceconnector!applianceCredentialKubeconfig:interface": "Microsoft.ResourceConnector.ApplianceCredentialKubeconfig", + "@azure/arm-resourceconnector!applianceListKeysResults:interface": "Microsoft.ResourceConnector.ApplianceListKeysResults", + "@azure/arm-resourceconnector!ArtifactProfile:interface": "Microsoft.ResourceConnector.ArtifactProfile", + "@azure/arm-resourceconnector!SSHKey:interface": "Microsoft.ResourceConnector.SSHKey", + "@azure/arm-resourceconnector!UpgradeGraph:interface": "Microsoft.ResourceConnector.UpgradeGraph", + "@azure/arm-resourceconnector!UpgradeGraphProperties:interface": "Microsoft.ResourceConnector.UpgradeGraphProperties", + "@azure/arm-resourceconnector!SupportedVersion:interface": "Microsoft.ResourceConnector.SupportedVersion", + "@azure/arm-resourceconnector!SupportedVersionMetadata:interface": "Microsoft.ResourceConnector.SupportedVersionMetadata", + "@azure/arm-resourceconnector!SupportedVersionCatalogVersion:interface": "Microsoft.ResourceConnector.SupportedVersionCatalogVersion", + "@azure/arm-resourceconnector!SupportedVersionCatalogVersionData:interface": "Microsoft.ResourceConnector.SupportedVersionCatalogVersionData", + "@azure/arm-resourceconnector!applianceOperationsList:interface": "Microsoft.ResourceConnector.ApplianceOperationsList", + "@azure/arm-resourceconnector!applianceOperation:interface": "Microsoft.ResourceConnector.ApplianceOperation", + "@azure/arm-resourceconnector!applianceOperationValueDisplay:interface": "Microsoft.ResourceConnector.ApplianceOperationValueDisplay", + "@azure/arm-resourceconnector!applianceGetTelemetryConfigResult:interface": "Microsoft.ResourceConnector.ApplianceGetTelemetryConfigResult", + "@azure/arm-resourceconnector!KnownDistro:enum": "Microsoft.ResourceConnector.Distro", + "@azure/arm-resourceconnector!KnownProvider:enum": "Microsoft.ResourceConnector.Provider", + "@azure/arm-resourceconnector!KnownStatus:enum": "Microsoft.ResourceConnector.Status", + "@azure/arm-resourceconnector!KnownResourceIdentityType:enum": "Microsoft.ResourceConnector.ResourceIdentityType", + "@azure/arm-resourceconnector!KnowncreatedByType:enum": "Azure.ResourceManager.CommonTypes.createdByType", + "@azure/arm-resourceconnector!KnownResourceProvisioningState:enum": "Azure.ResourceManager.ResourceProvisioningState", + "@azure/arm-resourceconnector!KnownAccessProfileType:enum": "Microsoft.ResourceConnector.AccessProfileType", + "@azure/arm-resourceconnector!KnownVersions:enum": "Microsoft.ResourceConnector.Versions", + "@azure/arm-resourceconnector!AppliancesOperations#getTelemetryConfig:member": "Microsoft.ResourceConnector.AppliancesOperationGroup.getTelemetryConfig", + "@azure/arm-resourceconnector!AppliancesOperations#ListOperations:member": "Azure.ResourceManager.Legacy.Operations.list", + "@azure/arm-resourceconnector!AppliancesOperations#getUpgradeGraph:member": "Microsoft.ResourceConnector.Appliances.getUpgradeGraph", + "@azure/arm-resourceconnector!AppliancesOperations#listKeys:member": "Microsoft.ResourceConnector.Appliances.listKeys", + "@azure/arm-resourceconnector!AppliancesOperations#listClusterUserCredential:member": "Microsoft.ResourceConnector.Appliances.listClusterUserCredential", + "@azure/arm-resourceconnector!AppliancesOperations#listBySubscription:member": "Microsoft.ResourceConnector.Appliances.listBySubscription", + "@azure/arm-resourceconnector!AppliancesOperations#listByResourceGroup:member": "Microsoft.ResourceConnector.Appliances.listByResourceGroup", + "@azure/arm-resourceconnector!AppliancesOperations#delete:member": "Microsoft.ResourceConnector.Appliances.delete", + "@azure/arm-resourceconnector!AppliancesOperations#update:member": "Microsoft.ResourceConnector.Appliances.update", + "@azure/arm-resourceconnector!AppliancesOperations#createOrUpdate:member": "Microsoft.ResourceConnector.Appliances.createOrUpdate", + "@azure/arm-resourceconnector!AppliancesOperations#get:member": "Microsoft.ResourceConnector.Appliances.get" + } + } +} diff --git a/sdk/resourceconnector/arm-resourceconnector/package.json b/sdk/resourceconnector/arm-resourceconnector/package.json index 84f15c48a495..28d4abbfc562 100644 --- a/sdk/resourceconnector/arm-resourceconnector/package.json +++ b/sdk/resourceconnector/arm-resourceconnector/package.json @@ -1,117 +1,121 @@ { "name": "@azure/arm-resourceconnector", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", + "version": "2.0.0-beta.1", "description": "A generated SDK for ResourceConnectorManagementClient.", - "version": "1.0.0", "engines": { "node": ">=20.0.0" }, - "dependencies": { - "@azure/abort-controller": "^2.1.2", - "@azure/core-auth": "^1.9.0", - "@azure/core-client": "^1.9.2", - "@azure/core-lro": "^2.5.3", - "@azure/core-paging": "^1.6.2", - "@azure/core-rest-pipeline": "^1.19.0", - "tslib": "^2.8.1" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/appliances": "./src/api/appliances/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false, + "project": "../../../tsconfig.src.build.json" }, + "type": "module", + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", + "files": [ + "dist/", + "!dist/**/*.d.*ts.map", + "README.md", + "LICENSE" + ], + "sdk-type": "mgmt", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/resourceConnectorManagementContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure/core-util": "^1.12.0", + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, "devDependencies": { "@azure-tools/test-credential": "workspace:^", "@azure-tools/test-recorder": "workspace:^", "@azure-tools/test-utils-vitest": "workspace:^", "@azure/dev-tool": "workspace:^", + "tshy": "catalog:", + "@azure/eslint-plugin-azure-sdk": "workspace:^", "@azure/identity": "catalog:internal", - "@azure/logger": "^1.1.4", "@types/node": "catalog:", + "cross-env": "catalog:", + "eslint": "catalog:", + "prettier": "catalog:", + "rimraf": "catalog:", "@vitest/browser-playwright": "catalog:testing", "@vitest/coverage-istanbul": "catalog:testing", - "cross-env": "catalog:", "dotenv": "catalog:testing", "playwright": "catalog:testing", - "rimraf": "catalog:", - "tshy": "catalog:", "typescript": "catalog:", "vitest": "catalog:testing" }, - "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/", - "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" - ], "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", - "check-format": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", - "lint": "echo skipped", + "extract-api": "rimraf review && dev-tool run extract-api", "pack": "pnpm pack 2>&1", + "lint": "echo skipped", + "lint:fix": "echo skipped", + "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "execute:samples": "dev-tool samples run samples-dev", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", + "test:browser": "dev-tool run build-test && dev-tool run test:vitest --browser", + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", + "test:node": "dev-tool run test:vitest", + "test:node:esm": "dev-tool run test:vitest --esm", "test": "npm run test:node && npm run test:browser", - "test:browser": "echo skipped", - "test:node": "dev-tool run build-test --no-browser-test && dev-tool run test:vitest", "update-snippets": "dev-tool run update-snippets" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/resourceConnectorManagementClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-resourceconnector", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-resourceconnector?view=azure-node-preview" }, - "type": "module", - "tshy": { - "project": "../../../tsconfig.src.build.json", - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false - }, - "browser": "./dist/browser/index.js", - "react-native": "./dist/react-native/index.js", "exports": { "./package.json": "./package.json", ".": { @@ -131,6 +135,63 @@ "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/appliances": { + "browser": { + "types": "./dist/browser/api/appliances/index.d.ts", + "default": "./dist/browser/api/appliances/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/appliances/index.d.ts", + "default": "./dist/react-native/api/appliances/index.js" + }, + "import": { + "types": "./dist/esm/api/appliances/index.d.ts", + "default": "./dist/esm/api/appliances/index.js" + }, + "require": { + "types": "./dist/commonjs/api/appliances/index.d.ts", + "default": "./dist/commonjs/api/appliances/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } } - } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-api-appliances-node.api.md b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-api-appliances-node.api.md new file mode 100644 index 000000000000..ca5626fbbef3 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-api-appliances-node.api.md @@ -0,0 +1,94 @@ +## 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 type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: ResourceConnectorManagementContext, resourceGroupName: string, resourceName: string, options?: AppliancesDeleteOptionalParams): PollerLike, void>; + +// @public +export interface AppliancesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface AppliancesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface AppliancesGetOptionalParams extends OperationOptions { +} + +// @public +export interface AppliancesGetTelemetryConfigOptionalParams extends OperationOptions { +} + +// @public +export interface AppliancesGetUpgradeGraphOptionalParams extends OperationOptions { +} + +// @public +export interface AppliancesListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface AppliancesListBySubscriptionOptionalParams extends OperationOptions { +} + +// @public +export interface AppliancesListClusterUserCredentialOptionalParams extends OperationOptions { +} + +// @public +export interface AppliancesListKeysOptionalParams extends OperationOptions { + artifactType?: string; +} + +// @public +export interface AppliancesListOperationsOptionalParams extends OperationOptions { +} + +// @public +export interface AppliancesUpdateOptionalParams extends OperationOptions { +} + +// @public +export function createOrUpdate(context: ResourceConnectorManagementContext, resourceGroupName: string, resourceName: string, parameters: Appliance, options?: AppliancesCreateOrUpdateOptionalParams): PollerLike, Appliance>; + +// @public +export function get(context: ResourceConnectorManagementContext, resourceGroupName: string, resourceName: string, options?: AppliancesGetOptionalParams): Promise; + +// @public +export function getTelemetryConfig(context: ResourceConnectorManagementContext, options?: AppliancesGetTelemetryConfigOptionalParams): Promise; + +// @public +export function getUpgradeGraph(context: ResourceConnectorManagementContext, resourceGroupName: string, resourceName: string, upgradeGraph: string, options?: AppliancesGetUpgradeGraphOptionalParams): Promise; + +// @public +export function listByResourceGroup(context: ResourceConnectorManagementContext, resourceGroupName: string, options?: AppliancesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listBySubscription(context: ResourceConnectorManagementContext, options?: AppliancesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listClusterUserCredential(context: ResourceConnectorManagementContext, resourceGroupName: string, resourceName: string, options?: AppliancesListClusterUserCredentialOptionalParams): Promise; + +// @public +export function listKeys(context: ResourceConnectorManagementContext, resourceGroupName: string, resourceName: string, options?: AppliancesListKeysOptionalParams): Promise; + +// @public +export function listOperations(context: ResourceConnectorManagementContext, options?: AppliancesListOperationsOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: ResourceConnectorManagementContext, resourceGroupName: string, resourceName: string, parameters: PatchableAppliance, options?: AppliancesUpdateOptionalParams): Promise; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-api-node.api.md b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-api-node.api.md new file mode 100644 index 000000000000..42dc253b044d --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-api-node.api.md @@ -0,0 +1,28 @@ +## 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 type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; + +// @public +export function createResourceConnectorManagement(credential: TokenCredential, subscriptionId: string, options?: ResourceConnectorManagementClientOptionalParams): ResourceConnectorManagementContext; + +// @public +export interface ResourceConnectorManagementClientOptionalParams extends ClientOptions { + apiVersion?: string; + cloudSetting?: AzureSupportedClouds; +} + +// @public +export interface ResourceConnectorManagementContext extends Client { + apiVersion: string; + subscriptionId: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-models-node.api.md b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-models-node.api.md new file mode 100644 index 000000000000..0ca4269c5e78 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-models-node.api.md @@ -0,0 +1,326 @@ +## 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 + +// @public +export type AccessProfileType = string; + +// @public +export interface Appliance extends TrackedResource { + identity?: Identity; + properties?: ApplianceProperties; +} + +// @public +export interface ApplianceCredentialKubeconfig { + readonly name?: AccessProfileType; + readonly value?: string; +} + +// @public +export interface ApplianceGetTelemetryConfigResult { + readonly telemetryInstrumentationKey?: string; +} + +// @public +export interface ApplianceListCredentialResults { + readonly hybridConnectionConfig?: HybridConnectionConfig; + readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; +} + +// @public +export interface ApplianceListKeysResults { + readonly artifactProfiles?: Record; + readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; + readonly sshKeys?: Record; +} + +// @public +export interface ApplianceOperation { + display?: ApplianceOperationValueDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: string; +} + +// @public +export interface ApplianceOperationValueDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface ApplianceProperties { + distro?: Distro; + readonly events?: Event_2[]; + infrastructureConfig?: AppliancePropertiesInfrastructureConfig; + networkProfile?: NetworkProfile; + readonly provisioningState?: string; + publicKey?: string; + readonly status?: Status; + version?: string; +} + +// @public +export interface AppliancePropertiesInfrastructureConfig { + provider?: Provider; +} + +// @public +export interface ArtifactProfile { + readonly endpoint?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export type Distro = string; + +// @public +export interface DnsConfiguration { + version?: string; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: any; + 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 +interface Event_2 { + code?: string; + message?: string; + severity?: string; + status?: string; + timestamp?: Date; + type?: string; +} +export { Event_2 as Event } + +// @public +export interface GatewayConfiguration { + version?: string; +} + +// @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 { + ClusterCustomerUser = "clusterCustomerUser", + ClusterUser = "clusterUser" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownDistro { + AKSEdge = "AKSEdge" +} + +// @public +export enum KnownProvider { + HCI = "HCI", + Scvmm = "SCVMM", + VMWare = "VMWare" +} + +// @public +export enum KnownResourceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned" +} + +// @public +export enum KnownStatus { + ArcGatewayUpdateComplete = "ArcGatewayUpdateComplete", + ArcGatewayUpdateFailed = "ArcGatewayUpdateFailed", + ArcGatewayUpdatePreparing = "ArcGatewayUpdatePreparing", + ArcGatewayUpdating = "ArcGatewayUpdating", + Connected = "Connected", + Connecting = "Connecting", + EtcdSnapshotFailed = "ETCDSnapshotFailed", + ImageDeprovisioning = "ImageDeprovisioning", + ImageDownloaded = "ImageDownloaded", + ImageDownloading = "ImageDownloading", + ImagePending = "ImagePending", + ImageProvisioned = "ImageProvisioned", + ImageProvisioning = "ImageProvisioning", + ImageUnknown = "ImageUnknown", + NetworkDNSUpdateComplete = "NetworkDNSUpdateComplete", + NetworkDNSUpdateFailed = "NetworkDNSUpdateFailed", + NetworkDNSUpdatePreparing = "NetworkDNSUpdatePreparing", + NetworkDNSUpdating = "NetworkDNSUpdating", + NetworkProxyUpdateComplete = "NetworkProxyUpdateComplete", + NetworkProxyUpdateFailed = "NetworkProxyUpdateFailed", + NetworkProxyUpdatePreparing = "NetworkProxyUpdatePreparing", + NetworkProxyUpdating = "NetworkProxyUpdating", + None = "None", + Offline = "Offline", + PostUpgrade = "PostUpgrade", + PreparingForUpgrade = "PreparingForUpgrade", + PreUpgrade = "PreUpgrade", + Running = "Running", + UpdatingCapi = "UpdatingCAPI", + UpdatingCloudOperator = "UpdatingCloudOperator", + UpdatingCluster = "UpdatingCluster", + UpgradeClusterExtensionFailedToDelete = "UpgradeClusterExtensionFailedToDelete", + UpgradeComplete = "UpgradeComplete", + UpgradeFailed = "UpgradeFailed", + UpgradePrerequisitesCompleted = "UpgradePrerequisitesCompleted", + UpgradingKvaio = "UpgradingKVAIO", + Validating = "Validating", + ValidatingEtcdHealth = "ValidatingETCDHealth", + ValidatingImageDownload = "ValidatingImageDownload", + ValidatingImageUpload = "ValidatingImageUpload", + ValidatingSFSConnectivity = "ValidatingSFSConnectivity", + WaitingForCloudOperator = "WaitingForCloudOperator", + WaitingForHeartbeat = "WaitingForHeartbeat", + WaitingForKvaio = "WaitingForKVAIO" +} + +// @public +export enum KnownVersions { + V20221027 = "2022-10-27", + V20250301Preview = "2025-03-01-preview" +} + +// @public +export interface NetworkProfile { + dnsConfiguration?: DnsConfiguration; + gatewayConfiguration?: GatewayConfiguration; + proxyConfiguration?: ProxyConfiguration; +} + +// @public +export interface PatchableAppliance { + tags?: Record; +} + +// @public +export type Provider = string; + +// @public +export interface ProxyConfiguration { + version?: string; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type ResourceIdentityType = string; + +// @public +export interface SSHKey { + readonly certificate?: string; + readonly creationTimeStamp?: number; + readonly expirationTimeStamp?: number; + readonly privateKey?: string; + readonly publicKey?: 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 interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @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/review/arm-resourceconnector-node.api.md b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-node.api.md index 398c8d41c251..e9495a6b8c69 100644 --- a/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-node.api.md +++ b/sdk/resourceconnector/arm-resourceconnector/review/arm-resourceconnector-node.api.md @@ -4,24 +4,22 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; -import { OperationState } from '@azure/core-lro'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { SimplePollerLike } from '@azure/core-lro'; +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { Pipeline } from '@azure/core-rest-pipeline'; +import type { PollerLike } from '@azure/core-lro'; +import type { TokenCredential } from '@azure/core-auth'; // @public export type AccessProfileType = string; // @public export interface Appliance extends TrackedResource { - distro?: Distro; identity?: Identity; - infrastructureConfig?: AppliancePropertiesInfrastructureConfig; - readonly provisioningState?: string; - publicKey?: string; - readonly status?: Status; - version?: string; + properties?: ApplianceProperties; } // @public @@ -43,36 +41,37 @@ export interface ApplianceListCredentialResults { // @public export interface ApplianceListKeysResults { - readonly artifactProfiles?: { - [propertyName: string]: ArtifactProfile; - }; + readonly artifactProfiles?: Record; readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; - readonly sshKeys?: { - [propertyName: string]: SSHKey; - }; + readonly sshKeys?: Record; } // @public -export interface ApplianceListResult { - readonly nextLink?: string; - readonly value?: Appliance[]; +export interface ApplianceOperation { + display?: ApplianceOperationValueDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: string; } // @public -export interface ApplianceOperation { +export interface ApplianceOperationValueDisplay { 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[]; +export interface ApplianceProperties { + distro?: Distro; + readonly events?: Event_2[]; + infrastructureConfig?: AppliancePropertiesInfrastructureConfig; + networkProfile?: NetworkProfile; + readonly provisioningState?: string; + publicKey?: string; + readonly status?: Status; + version?: string; } // @public @@ -81,131 +80,86 @@ export interface AppliancePropertiesInfrastructureConfig { } // @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; - getTelemetryConfig(options?: AppliancesGetTelemetryConfigOptionalParams): Promise; - getUpgradeGraph(resourceGroupName: string, resourceName: string, upgradeGraph: string, options?: AppliancesGetUpgradeGraphOptionalParams): Promise; - listByResourceGroup(resourceGroupName: string, options?: AppliancesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listBySubscription(options?: AppliancesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; - listClusterUserCredential(resourceGroupName: string, resourceName: string, options?: AppliancesListClusterUserCredentialOptionalParams): Promise; - listKeys(resourceGroupName: string, resourceName: string, options?: AppliancesListKeysOptionalParams): Promise; - listOperations(options?: AppliancesListOperationsOptionalParams): PagedAsyncIterableIterator; - update(resourceGroupName: string, resourceName: string, options?: AppliancesUpdateOptionalParams): Promise; -} - -// @public -export interface AppliancesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface AppliancesCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type AppliancesCreateOrUpdateResponse = Appliance; - -// @public -export interface AppliancesDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface AppliancesDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface AppliancesGetOptionalParams extends coreClient.OperationOptions { +export interface AppliancesGetOptionalParams extends OperationOptions { } // @public -export type AppliancesGetResponse = Appliance; - -// @public -export interface AppliancesGetTelemetryConfigOptionalParams extends coreClient.OperationOptions { +export interface AppliancesGetTelemetryConfigOptionalParams extends OperationOptions { } // @public -export type AppliancesGetTelemetryConfigResponse = ApplianceGetTelemetryConfigResult; - -// @public -export interface AppliancesGetUpgradeGraphOptionalParams extends coreClient.OperationOptions { +export interface AppliancesGetUpgradeGraphOptionalParams extends OperationOptions { } // @public -export type AppliancesGetUpgradeGraphResponse = UpgradeGraph; - -// @public -export interface AppliancesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +export interface AppliancesListByResourceGroupOptionalParams extends OperationOptions { } // @public -export type AppliancesListByResourceGroupNextResponse = ApplianceListResult; - -// @public -export interface AppliancesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +export interface AppliancesListBySubscriptionOptionalParams extends OperationOptions { } // @public -export type AppliancesListByResourceGroupResponse = ApplianceListResult; - -// @public -export interface AppliancesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +export interface AppliancesListClusterUserCredentialOptionalParams extends OperationOptions { } // @public -export type AppliancesListBySubscriptionNextResponse = ApplianceListResult; - -// @public -export interface AppliancesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +export interface AppliancesListKeysOptionalParams extends OperationOptions { + artifactType?: string; } // @public -export type AppliancesListBySubscriptionResponse = ApplianceListResult; - -// @public -export interface AppliancesListClusterUserCredentialOptionalParams extends coreClient.OperationOptions { +export interface AppliancesListOperationsOptionalParams extends OperationOptions { } // @public -export type AppliancesListClusterUserCredentialResponse = ApplianceListCredentialResults; - -// @public -export interface AppliancesListKeysOptionalParams extends coreClient.OperationOptions { +export interface AppliancesOperations { + createOrUpdate: (resourceGroupName: string, resourceName: string, parameters: Appliance, options?: AppliancesCreateOrUpdateOptionalParams) => PollerLike, Appliance>; + delete: (resourceGroupName: string, resourceName: string, options?: AppliancesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, resourceName: string, options?: AppliancesGetOptionalParams) => Promise; + getTelemetryConfig: (options?: AppliancesGetTelemetryConfigOptionalParams) => Promise; + getUpgradeGraph: (resourceGroupName: string, resourceName: string, upgradeGraph: string, options?: AppliancesGetUpgradeGraphOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: AppliancesListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: AppliancesListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + listClusterUserCredential: (resourceGroupName: string, resourceName: string, options?: AppliancesListClusterUserCredentialOptionalParams) => Promise; + listKeys: (resourceGroupName: string, resourceName: string, options?: AppliancesListKeysOptionalParams) => Promise; + listOperations: (options?: AppliancesListOperationsOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, resourceName: string, parameters: PatchableAppliance, options?: AppliancesUpdateOptionalParams) => Promise; } // @public -export type AppliancesListKeysResponse = ApplianceListKeysResults; - -// @public -export interface AppliancesListOperationsNextOptionalParams extends coreClient.OperationOptions { +export interface AppliancesUpdateOptionalParams extends OperationOptions { } // @public -export type AppliancesListOperationsNextResponse = ApplianceOperationsList; - -// @public -export interface AppliancesListOperationsOptionalParams extends coreClient.OperationOptions { +export interface ArtifactProfile { + readonly endpoint?: string; } // @public -export type AppliancesListOperationsResponse = ApplianceOperationsList; - -// @public -export interface AppliancesUpdateOptionalParams extends coreClient.OperationOptions { - tags?: { - [propertyName: string]: string; - }; +export enum AzureClouds { + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" } // @public -export type AppliancesUpdateResponse = Appliance; - -// @public -export interface ArtifactProfile { - readonly endpoint?: string; -} +export type AzureSupportedClouds = `${AzureClouds}`; // @public -export type ArtifactType = string; +export type ContinuablePage = TPage & { + continuationToken?: string; +}; // @public export type CreatedByType = string; @@ -213,9 +167,14 @@ export type CreatedByType = string; // @public export type Distro = string; +// @public +export interface DnsConfiguration { + version?: string; +} + // @public export interface ErrorAdditionalInfo { - readonly info?: Record; + readonly info?: any; readonly type?: string; } @@ -234,7 +193,20 @@ export interface ErrorResponse { } // @public -export function getContinuationToken(page: unknown): string | undefined; +interface Event_2 { + code?: string; + message?: string; + severity?: string; + status?: string; + timestamp?: Date; + type?: string; +} +export { Event_2 as Event } + +// @public +export interface GatewayConfiguration { + version?: string; +} // @public export interface HybridConnectionConfig { @@ -257,11 +229,6 @@ export enum KnownAccessProfileType { ClusterUser = "clusterUser" } -// @public -export enum KnownArtifactType { - LogsArtifactType = "LogsArtifactType" -} - // @public export enum KnownCreatedByType { Application = "Application", @@ -278,8 +245,6 @@ export enum KnownDistro { // @public export enum KnownProvider { HCI = "HCI", - KubeVirt = "KubeVirt", - OpenStack = "OpenStack", Scvmm = "SCVMM", VMWare = "VMWare" } @@ -290,18 +255,15 @@ export enum KnownResourceIdentityType { SystemAssigned = "SystemAssigned" } -// @public -export enum KnownSSHKeyType { - LogsKey = "LogsKey", - ManagementCAKey = "ManagementCAKey", - ScopedAccessKey = "ScopedAccessKey", - SSHCustomerUser = "SSHCustomerUser" -} - // @public export enum KnownStatus { + ArcGatewayUpdateComplete = "ArcGatewayUpdateComplete", + ArcGatewayUpdateFailed = "ArcGatewayUpdateFailed", + ArcGatewayUpdatePreparing = "ArcGatewayUpdatePreparing", + ArcGatewayUpdating = "ArcGatewayUpdating", Connected = "Connected", Connecting = "Connecting", + EtcdSnapshotFailed = "ETCDSnapshotFailed", ImageDeprovisioning = "ImageDeprovisioning", ImageDownloaded = "ImageDownloaded", ImageDownloading = "ImageDownloading", @@ -309,6 +271,14 @@ export enum KnownStatus { ImageProvisioned = "ImageProvisioned", ImageProvisioning = "ImageProvisioning", ImageUnknown = "ImageUnknown", + NetworkDNSUpdateComplete = "NetworkDNSUpdateComplete", + NetworkDNSUpdateFailed = "NetworkDNSUpdateFailed", + NetworkDNSUpdatePreparing = "NetworkDNSUpdatePreparing", + NetworkDNSUpdating = "NetworkDNSUpdating", + NetworkProxyUpdateComplete = "NetworkProxyUpdateComplete", + NetworkProxyUpdateFailed = "NetworkProxyUpdateFailed", + NetworkProxyUpdatePreparing = "NetworkProxyUpdatePreparing", + NetworkProxyUpdating = "NetworkProxyUpdating", None = "None", Offline = "Offline", PostUpgrade = "PostUpgrade", @@ -324,21 +294,53 @@ export enum KnownStatus { UpgradePrerequisitesCompleted = "UpgradePrerequisitesCompleted", UpgradingKvaio = "UpgradingKVAIO", Validating = "Validating", + ValidatingEtcdHealth = "ValidatingETCDHealth", + ValidatingImageDownload = "ValidatingImageDownload", + ValidatingImageUpload = "ValidatingImageUpload", + ValidatingSFSConnectivity = "ValidatingSFSConnectivity", WaitingForCloudOperator = "WaitingForCloudOperator", WaitingForHeartbeat = "WaitingForHeartbeat", WaitingForKvaio = "WaitingForKVAIO" } +// @public +export enum KnownVersions { + V20221027 = "2022-10-27", + V20250301Preview = "2025-03-01-preview" +} + +// @public +export interface NetworkProfile { + dnsConfiguration?: DnsConfiguration; + gatewayConfiguration?: GatewayConfiguration; + proxyConfiguration?: ProxyConfiguration; +} + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + // @public export interface PatchableAppliance { - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public export type Provider = string; +// @public +export interface ProxyConfiguration { + version?: string; +} + // @public export interface Resource { readonly id?: string; @@ -348,29 +350,31 @@ export interface Resource { } // @public (undocumented) -export class ResourceConnectorManagementClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ResourceConnectorManagementClientOptionalParams); - constructor(credentials: coreAuth.TokenCredential, options?: ResourceConnectorManagementClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - appliances: Appliances; - // (undocumented) - subscriptionId?: string; -} - -// @public -export interface ResourceConnectorManagementClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +export class ResourceConnectorManagementClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: ResourceConnectorManagementClientOptionalParams); + readonly appliances: AppliancesOperations; + readonly pipeline: Pipeline; +} + +// @public +export interface ResourceConnectorManagementClientOptionalParams extends ClientOptions { apiVersion?: string; - endpoint?: string; + cloudSetting?: AzureSupportedClouds; } // @public export type ResourceIdentityType = string; +// @public +export function restorePoller(client: ResourceConnectorManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + // @public export interface SSHKey { readonly certificate?: string; @@ -380,9 +384,6 @@ export interface SSHKey { readonly publicKey?: string; } -// @public -export type SSHKeyType = string; - // @public export type Status = string; @@ -425,9 +426,7 @@ export interface SystemData { // @public export interface TrackedResource extends Resource { location: string; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public diff --git a/sdk/resourceconnector/arm-resourceconnector/sample.env b/sdk/resourceconnector/arm-resourceconnector/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/resourceconnector/arm-resourceconnector/sample.env +++ b/sdk/resourceconnector/arm-resourceconnector/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesCreateOrUpdateSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesCreateOrUpdateSample.ts index d0dc6b8d0cc5..fabe3559d9d7 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesCreateOrUpdateSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesCreateOrUpdateSample.ts @@ -1,40 +1,54 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Creates or updates an Appliance in the specified Subscription and Resource Group. - * - * @summary Creates or updates an Appliance in the specified Subscription and Resource Group. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesCreate_Update.json - */ - -import type { Appliance } from "@azure/arm-resourceconnector"; import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @summary creates or updates an Appliance in the specified Subscription and Resource Group. + * x-ms-original-file: 2025-03-01-preview/AppliancesCreate_Update.json + */ async function createOrUpdateAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const parameters: Appliance = { - distro: "AKSEdge", - infrastructureConfig: { provider: "VMWare" }, + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.createOrUpdate("testresourcegroup", "appliance01", { location: "West US", - }; + properties: { + distro: "AKSEdge", + infrastructureConfig: { provider: "VMWare" }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @summary creates or updates an Appliance in the specified Subscription and Resource Group. + * x-ms-original-file: 2025-03-01-preview/AppliancesUpdateProxy.json + */ +async function updateApplianceProxyConfiguration(): Promise { const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - parameters, - ); + const result = await client.appliances.createOrUpdate("testresourcegroup", "appliance01", { + location: "West US", + properties: { + distro: "AKSEdge", + publicKey: "xxxxxxxx", + infrastructureConfig: { provider: "VMWare" }, + networkProfile: { proxyConfiguration: { version: "latest" } }, + }, + }); console.log(result); } async function main(): Promise { await createOrUpdateAppliance(); + await updateApplianceProxyConfiguration(); } main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesDeleteSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesDeleteSample.ts index 9f7735f2522d..378e3af88383 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesDeleteSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesDeleteSample.ts @@ -1,26 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. - * - * @summary Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesDelete.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @summary deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * x-ms-original-file: 2025-03-01-preview/AppliancesDelete.json + */ async function deleteAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.beginDeleteAndWait(resourceGroupName, resourceName); - console.log(result); + await client.appliances.delete("testresourcegroup", "appliance01"); } async function main(): Promise { diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetSample.ts index 6a59dbb992ba..1a3e3a10d822 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetSample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets the details of an Appliance with a specified resource group and name. - * - * @summary Gets the details of an Appliance with a specified resource group and name. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesGet.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets the details of an Appliance with a specified resource group and name. + * + * @summary gets the details of an Appliance with a specified resource group and name. + * x-ms-original-file: 2025-03-01-preview/AppliancesGet.json + */ async function getAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.get(resourceGroupName, resourceName); + const result = await client.appliances.get("testresourcegroup", "appliance01"); console.log(result); } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetTelemetryConfigSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetTelemetryConfigSample.ts index c4f028369db4..c5577bdc50fa 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetTelemetryConfigSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetTelemetryConfigSample.ts @@ -1,21 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets the telemetry config. - * - * @summary Gets the telemetry config. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/TelemetryConfig.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets the telemetry config. + * + * @summary gets the telemetry config. + * x-ms-original-file: 2025-03-01-preview/TelemetryConfig.json + */ async function getTelemetryConfigAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); const result = await client.appliances.getTelemetryConfig(); console.log(result); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetUpgradeGraphSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetUpgradeGraphSample.ts index b769d5bae9da..6c06c3bbd65d 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetUpgradeGraphSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesGetUpgradeGraphSample.ts @@ -1,29 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. - * - * @summary Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/UpgradeGraph.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. + * + * @summary gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. + * x-ms-original-file: 2025-03-01-preview/UpgradeGraph.json + */ async function getApplianceUpgradeGraph(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const upgradeGraph = "stable"; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); const result = await client.appliances.getUpgradeGraph( - resourceGroupName, - resourceName, - upgradeGraph, + "testresourcegroup", + "appliance01", + "stable", ); console.log(result); } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListByResourceGroupSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListByResourceGroupSample.ts index 37a5238019bc..d57ebf388f0c 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListByResourceGroupSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListByResourceGroupSample.ts @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. - * - * @summary Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListByResourceGroup.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. + * + * @summary gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListByResourceGroup.json + */ async function listAppliancesByResourceGroup(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.appliances.listByResourceGroup(resourceGroupName)) { + for await (const item of client.appliances.listByResourceGroup("testresourcegroup")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListBySubscriptionSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListBySubscriptionSample.ts index bb19aa9042e2..afe0935ed9a6 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListBySubscriptionSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListBySubscriptionSample.ts @@ -1,26 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance - * - * @summary Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListBySubscription.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance + * + * @summary gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance + * x-ms-original-file: 2025-03-01-preview/AppliancesListBySubscription.json + */ async function listAppliancesBySubscription(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.appliances.listBySubscription()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListClusterUserCredentialSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListClusterUserCredentialSample.ts index 2ca2fe4c61f8..c5e33a994f41 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListClusterUserCredentialSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListClusterUserCredentialSample.ts @@ -1,25 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Returns the cluster user credentials for the dedicated appliance. - * - * @summary Returns the cluster user credentials for the dedicated appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListClusterUserCredential.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to returns the cluster user credentials for the dedicated appliance. + * + * @summary returns the cluster user credentials for the dedicated appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListClusterUserCredential.json + */ async function listClusterUserCredentialAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.listClusterUserCredential(resourceGroupName, resourceName); + const result = await client.appliances.listClusterUserCredential( + "testresourcegroup", + "appliance01", + ); console.log(result); } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListKeysSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListKeysSample.ts index 08047d633ce3..6a17d6694faa 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListKeysSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListKeysSample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Returns the cluster customer credentials for the dedicated appliance. - * - * @summary Returns the cluster customer credentials for the dedicated appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListKeys.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to returns the cluster customer credentials for the dedicated appliance. + * + * @summary returns the cluster customer credentials for the dedicated appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListKeys.json + */ async function listKeysAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.listKeys(resourceGroupName, resourceName); + const result = await client.appliances.listKeys("testresourcegroup", "appliance01"); console.log(result); } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListOperationsSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListOperationsSample.ts index 784f4583f36e..4664c528ef62 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListOperationsSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesListOperationsSample.ts @@ -1,24 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists all available Appliances operations. - * - * @summary Lists all available Appliances operations. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListOperations.json - */ - import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists all available Appliances operations. + * + * @summary lists all available Appliances operations. + * x-ms-original-file: 2025-03-01-preview/AppliancesListOperations.json + */ async function listAppliancesOperations(): Promise { const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.appliances.listOperations()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesUpdateSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesUpdateSample.ts index 0bf69756f739..5e5b413981ba 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesUpdateSample.ts +++ b/sdk/resourceconnector/arm-resourceconnector/samples-dev/appliancesUpdateSample.ts @@ -1,28 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. - * - * @summary Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesPatch.json - */ - -import type { AppliancesUpdateOptionalParams } from "@azure/arm-resourceconnector"; import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @summary updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * x-ms-original-file: 2025-03-01-preview/AppliancesPatch.json + */ async function updateAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const tags = { key: "value" }; - const options: AppliancesUpdateOptionalParams = { tags }; const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.update(resourceGroupName, resourceName, options); + const result = await client.appliances.update("testresourcegroup", "appliance01", { + tags: { key: "value" }, + }); console.log(result); } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesCreateOrUpdateSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesCreateOrUpdateSample.js deleted file mode 100644 index 343c8d660588..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesCreateOrUpdateSample.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Creates or updates an Appliance in the specified Subscription and Resource Group. - * - * @summary Creates or updates an Appliance in the specified Subscription and Resource Group. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesCreate_Update.json - */ -async function createOrUpdateAppliance() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const parameters = { - distro: "AKSEdge", - infrastructureConfig: { provider: "VMWare" }, - location: "West US", - }; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - parameters - ); - console.log(result); -} - -async function main() { - createOrUpdateAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesDeleteSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesDeleteSample.js deleted file mode 100644 index 9df82e2b6ec5..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesDeleteSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. - * - * @summary Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesDelete.json - */ -async function deleteAppliance() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.beginDeleteAndWait(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - deleteAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetSample.js deleted file mode 100644 index 63e957a541f4..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets the details of an Appliance with a specified resource group and name. - * - * @summary Gets the details of an Appliance with a specified resource group and name. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesGet.json - */ -async function getAppliance() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.get(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - getAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetTelemetryConfigSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetTelemetryConfigSample.js deleted file mode 100644 index 49f4ef26bdc6..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetTelemetryConfigSample.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets the telemetry config. - * - * @summary Gets the telemetry config. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/TelemetryConfig.json - */ -async function getTelemetryConfigAppliance() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.getTelemetryConfig(); - console.log(result); -} - -async function main() { - getTelemetryConfigAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetUpgradeGraphSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetUpgradeGraphSample.js deleted file mode 100644 index 9516afc89b16..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetUpgradeGraphSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. - * - * @summary Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/UpgradeGraph.json - */ -async function getApplianceUpgradeGraph() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const upgradeGraph = "stable"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.getUpgradeGraph( - resourceGroupName, - resourceName, - upgradeGraph - ); - console.log(result); -} - -async function main() { - getApplianceUpgradeGraph(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListByResourceGroupSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListByResourceGroupSample.js deleted file mode 100644 index 9290941f9766..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListByResourceGroupSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. - * - * @summary Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListByResourceGroup.json - */ -async function listAppliancesByResourceGroup() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.appliances.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listAppliancesByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListBySubscriptionSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListBySubscriptionSample.js deleted file mode 100644 index 2dd076d2a0cb..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListBySubscriptionSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance - * - * @summary Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListBySubscription.json - */ -async function listAppliancesBySubscription() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.appliances.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listAppliancesBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListClusterUserCredentialSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListClusterUserCredentialSample.js deleted file mode 100644 index e498901dd7fc..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListClusterUserCredentialSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Returns the cluster user credentials for the dedicated appliance. - * - * @summary Returns the cluster user credentials for the dedicated appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListClusterUserCredential.json - */ -async function listClusterUserCredentialAppliance() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.listClusterUserCredential(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - listClusterUserCredentialAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListKeysSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListKeysSample.js deleted file mode 100644 index 4b9673f30e87..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListKeysSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Returns the cluster customer credentials for the dedicated appliance. - * - * @summary Returns the cluster customer credentials for the dedicated appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListKeys.json - */ -async function listKeysAppliance() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.listKeys(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - listKeysAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListOperationsSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListOperationsSample.js deleted file mode 100644 index d941c9f001e2..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListOperationsSample.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists all available Appliances operations. - * - * @summary Lists all available Appliances operations. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListOperations.json - */ -async function listAppliancesOperations() { - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential); - const resArray = new Array(); - for await (let item of client.appliances.listOperations()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listAppliancesOperations(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesUpdateSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesUpdateSample.js deleted file mode 100644 index 73cc0d22d12a..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesUpdateSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. - * - * @summary Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesPatch.json - */ -async function updateAppliance() { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const tags = { key: "value" }; - const options = { tags }; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential, subscriptionId); - const result = await client.appliances.update(resourceGroupName, resourceName, options); - console.log(result); -} - -async function main() { - updateAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/sample.env b/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/sample.env b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesCreateOrUpdateSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesCreateOrUpdateSample.ts deleted file mode 100644 index 68dccfb858c4..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesCreateOrUpdateSample.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - Appliance, - ResourceConnectorManagementClient -} from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates or updates an Appliance in the specified Subscription and Resource Group. - * - * @summary Creates or updates an Appliance in the specified Subscription and Resource Group. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesCreate_Update.json - */ -async function createOrUpdateAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = - process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const parameters: Appliance = { - distro: "AKSEdge", - infrastructureConfig: { provider: "VMWare" }, - location: "West US" - }; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const result = await client.appliances.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - parameters - ); - console.log(result); -} - -async function main(): Promise { - createOrUpdateAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesDeleteSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesDeleteSample.ts deleted file mode 100644 index d3f303e84810..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesDeleteSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. - * - * @summary Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesDelete.json - */ -async function deleteAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = - process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const result = await client.appliances.beginDeleteAndWait( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - deleteAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetSample.ts deleted file mode 100644 index d3343d895ce3..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the details of an Appliance with a specified resource group and name. - * - * @summary Gets the details of an Appliance with a specified resource group and name. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesGet.json - */ -async function getAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = - process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const result = await client.appliances.get(resourceGroupName, resourceName); - console.log(result); -} - -async function main(): Promise { - getAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetTelemetryConfigSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetTelemetryConfigSample.ts deleted file mode 100644 index 345d939981fb..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetTelemetryConfigSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the telemetry config. - * - * @summary Gets the telemetry config. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/TelemetryConfig.json - */ -async function getTelemetryConfigAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const result = await client.appliances.getTelemetryConfig(); - console.log(result); -} - -async function main(): Promise { - getTelemetryConfigAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetUpgradeGraphSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetUpgradeGraphSample.ts deleted file mode 100644 index 164766f3ea18..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetUpgradeGraphSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. - * - * @summary Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/UpgradeGraph.json - */ -async function getApplianceUpgradeGraph(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = - process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const upgradeGraph = "stable"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const result = await client.appliances.getUpgradeGraph( - resourceGroupName, - resourceName, - upgradeGraph - ); - console.log(result); -} - -async function main(): Promise { - getApplianceUpgradeGraph(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListByResourceGroupSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListByResourceGroupSample.ts deleted file mode 100644 index 071439299714..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListByResourceGroupSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. - * - * @summary Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListByResourceGroup.json - */ -async function listAppliancesByResourceGroup(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = - process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const resArray = new Array(); - for await (let item of client.appliances.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - listAppliancesByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListBySubscriptionSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListBySubscriptionSample.ts deleted file mode 100644 index d86d34846b2b..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListBySubscriptionSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance - * - * @summary Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListBySubscription.json - */ -async function listAppliancesBySubscription(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const resArray = new Array(); - for await (let item of client.appliances.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - listAppliancesBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListClusterUserCredentialSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListClusterUserCredentialSample.ts deleted file mode 100644 index 62610b72085f..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListClusterUserCredentialSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Returns the cluster user credentials for the dedicated appliance. - * - * @summary Returns the cluster user credentials for the dedicated appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListClusterUserCredential.json - */ -async function listClusterUserCredentialAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = - process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const result = await client.appliances.listClusterUserCredential( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - listClusterUserCredentialAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListKeysSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListKeysSample.ts deleted file mode 100644 index 7c2ff3ddb3c9..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListKeysSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Returns the cluster customer credentials for the dedicated appliance. - * - * @summary Returns the cluster customer credentials for the dedicated appliance. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListKeys.json - */ -async function listKeysAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = - process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const result = await client.appliances.listKeys( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - listKeysAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListOperationsSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListOperationsSample.ts deleted file mode 100644 index 66dc0b51af04..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListOperationsSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all available Appliances operations. - * - * @summary Lists all available Appliances operations. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListOperations.json - */ -async function listAppliancesOperations(): Promise { - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient(credential); - const resArray = new Array(); - for await (let item of client.appliances.listOperations()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - listAppliancesOperations(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesUpdateSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesUpdateSample.ts deleted file mode 100644 index 295d43bc5ed1..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesUpdateSample.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - AppliancesUpdateOptionalParams, - ResourceConnectorManagementClient -} from "@azure/arm-resourceconnector"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. - * - * @summary Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. - * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesPatch.json - */ -async function updateAppliance(): Promise { - const subscriptionId = - process.env["RESOURCECONNECTOR_SUBSCRIPTION_ID"] || - "11111111-2222-3333-4444-555555555555"; - const resourceGroupName = - process.env["RESOURCECONNECTOR_RESOURCE_GROUP"] || "testresourcegroup"; - const resourceName = "appliance01"; - const tags = { key: "value" }; - const options: AppliancesUpdateOptionalParams = { tags }; - const credential = new DefaultAzureCredential(); - const client = new ResourceConnectorManagementClient( - credential, - subscriptionId - ); - const result = await client.appliances.update( - resourceGroupName, - resourceName, - options - ); - console.log(result); -} - -async function main(): Promise { - updateAppliance(); -} - -main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/tsconfig.json b/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/README.md b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/README.md similarity index 53% rename from sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/README.md rename to sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/README.md index ea4d0a5113b8..c0fc185f81c6 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/README.md +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/README.md @@ -1,20 +1,20 @@ -# client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [appliancesCreateOrUpdateSample.js][appliancescreateorupdatesample] | Creates or updates an Appliance in the specified Subscription and Resource Group. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesCreate_Update.json | -| [appliancesDeleteSample.js][appliancesdeletesample] | Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesDelete.json | -| [appliancesGetSample.js][appliancesgetsample] | Gets the details of an Appliance with a specified resource group and name. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesGet.json | -| [appliancesGetTelemetryConfigSample.js][appliancesgettelemetryconfigsample] | Gets the telemetry config. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/TelemetryConfig.json | -| [appliancesGetUpgradeGraphSample.js][appliancesgetupgradegraphsample] | Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/UpgradeGraph.json | -| [appliancesListByResourceGroupSample.js][applianceslistbyresourcegroupsample] | Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListByResourceGroup.json | -| [appliancesListBySubscriptionSample.js][applianceslistbysubscriptionsample] | Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListBySubscription.json | -| [appliancesListClusterUserCredentialSample.js][applianceslistclusterusercredentialsample] | Returns the cluster user credentials for the dedicated appliance. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListClusterUserCredential.json | -| [appliancesListKeysSample.js][applianceslistkeyssample] | Returns the cluster customer credentials for the dedicated appliance. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListKeys.json | -| [appliancesListOperationsSample.js][applianceslistoperationssample] | Lists all available Appliances operations. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListOperations.json | -| [appliancesUpdateSample.js][appliancesupdatesample] | Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesPatch.json | +# @azure/arm-resourceconnector client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for @azure/arm-resourceconnector in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [appliancesCreateOrUpdateSample.js][appliancescreateorupdatesample] | creates or updates an Appliance in the specified Subscription and Resource Group. x-ms-original-file: 2025-03-01-preview/AppliancesCreate_Update.json | +| [appliancesDeleteSample.js][appliancesdeletesample] | deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. x-ms-original-file: 2025-03-01-preview/AppliancesDelete.json | +| [appliancesGetSample.js][appliancesgetsample] | gets the details of an Appliance with a specified resource group and name. x-ms-original-file: 2025-03-01-preview/AppliancesGet.json | +| [appliancesGetTelemetryConfigSample.js][appliancesgettelemetryconfigsample] | gets the telemetry config. x-ms-original-file: 2025-03-01-preview/TelemetryConfig.json | +| [appliancesGetUpgradeGraphSample.js][appliancesgetupgradegraphsample] | gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. x-ms-original-file: 2025-03-01-preview/UpgradeGraph.json | +| [appliancesListByResourceGroupSample.js][applianceslistbyresourcegroupsample] | gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. x-ms-original-file: 2025-03-01-preview/AppliancesListByResourceGroup.json | +| [appliancesListBySubscriptionSample.js][applianceslistbysubscriptionsample] | gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance x-ms-original-file: 2025-03-01-preview/AppliancesListBySubscription.json | +| [appliancesListClusterUserCredentialSample.js][applianceslistclusterusercredentialsample] | returns the cluster user credentials for the dedicated appliance. x-ms-original-file: 2025-03-01-preview/AppliancesListClusterUserCredential.json | +| [appliancesListKeysSample.js][applianceslistkeyssample] | returns the cluster customer credentials for the dedicated appliance. x-ms-original-file: 2025-03-01-preview/AppliancesListKeys.json | +| [appliancesListOperationsSample.js][applianceslistoperationssample] | lists all available Appliances operations. x-ms-original-file: 2025-03-01-preview/AppliancesListOperations.json | +| [appliancesUpdateSample.js][appliancesupdatesample] | updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. x-ms-original-file: 2025-03-01-preview/AppliancesPatch.json | ## Prerequisites @@ -47,24 +47,24 @@ node appliancesCreateOrUpdateSample.js Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -cross-env RESOURCECONNECTOR_SUBSCRIPTION_ID="" RESOURCECONNECTOR_RESOURCE_GROUP="" node appliancesCreateOrUpdateSample.js +node appliancesCreateOrUpdateSample.js ``` ## Next Steps Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[appliancescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesCreateOrUpdateSample.js -[appliancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesDeleteSample.js -[appliancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetSample.js -[appliancesgettelemetryconfigsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetTelemetryConfigSample.js -[appliancesgetupgradegraphsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesGetUpgradeGraphSample.js -[applianceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListByResourceGroupSample.js -[applianceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListBySubscriptionSample.js -[applianceslistclusterusercredentialsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListClusterUserCredentialSample.js -[applianceslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListKeysSample.js -[applianceslistoperationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesListOperationsSample.js -[appliancesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/appliancesUpdateSample.js +[appliancescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesCreateOrUpdateSample.js +[appliancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesDeleteSample.js +[appliancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetSample.js +[appliancesgettelemetryconfigsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetTelemetryConfigSample.js +[appliancesgetupgradegraphsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetUpgradeGraphSample.js +[applianceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListByResourceGroupSample.js +[applianceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListBySubscriptionSample.js +[applianceslistclusterusercredentialsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListClusterUserCredentialSample.js +[applianceslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListKeysSample.js +[applianceslistoperationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListOperationsSample.js +[appliancesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesUpdateSample.js [apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-resourceconnector?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector/README.md diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesCreateOrUpdateSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesCreateOrUpdateSample.js new file mode 100644 index 000000000000..4d381987065f --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesCreateOrUpdateSample.js @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @summary creates or updates an Appliance in the specified Subscription and Resource Group. + * x-ms-original-file: 2025-03-01-preview/AppliancesCreate_Update.json + */ +async function createOrUpdateAppliance() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.createOrUpdate("testresourcegroup", "appliance01", { + location: "West US", + properties: { + distro: "AKSEdge", + infrastructureConfig: { provider: "VMWare" }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @summary creates or updates an Appliance in the specified Subscription and Resource Group. + * x-ms-original-file: 2025-03-01-preview/AppliancesUpdateProxy.json + */ +async function updateApplianceProxyConfiguration() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.createOrUpdate("testresourcegroup", "appliance01", { + location: "West US", + properties: { + distro: "AKSEdge", + publicKey: "xxxxxxxx", + infrastructureConfig: { provider: "VMWare" }, + networkProfile: { proxyConfiguration: { version: "latest" } }, + }, + }); + console.log(result); +} + +async function main() { + await createOrUpdateAppliance(); + await updateApplianceProxyConfiguration(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesDeleteSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesDeleteSample.js new file mode 100644 index 000000000000..fae214eda740 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @summary deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * x-ms-original-file: 2025-03-01-preview/AppliancesDelete.json + */ +async function deleteAppliance() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + await client.appliances.delete("testresourcegroup", "appliance01"); +} + +async function main() { + await deleteAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetSample.js new file mode 100644 index 000000000000..adedaf90e605 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets the details of an Appliance with a specified resource group and name. + * + * @summary gets the details of an Appliance with a specified resource group and name. + * x-ms-original-file: 2025-03-01-preview/AppliancesGet.json + */ +async function getAppliance() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.get("testresourcegroup", "appliance01"); + console.log(result); +} + +async function main() { + await getAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetTelemetryConfigSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetTelemetryConfigSample.js new file mode 100644 index 000000000000..1c36a4fd3ee2 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetTelemetryConfigSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets the telemetry config. + * + * @summary gets the telemetry config. + * x-ms-original-file: 2025-03-01-preview/TelemetryConfig.json + */ +async function getTelemetryConfigAppliance() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.getTelemetryConfig(); + console.log(result); +} + +async function main() { + await getTelemetryConfigAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetUpgradeGraphSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetUpgradeGraphSample.js new file mode 100644 index 000000000000..18eccfe028e4 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesGetUpgradeGraphSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. + * + * @summary gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. + * x-ms-original-file: 2025-03-01-preview/UpgradeGraph.json + */ +async function getApplianceUpgradeGraph() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.getUpgradeGraph( + "testresourcegroup", + "appliance01", + "stable", + ); + console.log(result); +} + +async function main() { + await getApplianceUpgradeGraph(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListByResourceGroupSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListByResourceGroupSample.js new file mode 100644 index 000000000000..22699e3b4539 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. + * + * @summary gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListByResourceGroup.json + */ +async function listAppliancesByResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.appliances.listByResourceGroup("testresourcegroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAppliancesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListBySubscriptionSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListBySubscriptionSample.js new file mode 100644 index 000000000000..93c187842c61 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListBySubscriptionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance + * + * @summary gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance + * x-ms-original-file: 2025-03-01-preview/AppliancesListBySubscription.json + */ +async function listAppliancesBySubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.appliances.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAppliancesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListClusterUserCredentialSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListClusterUserCredentialSample.js new file mode 100644 index 000000000000..bbb9e3696074 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListClusterUserCredentialSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to returns the cluster user credentials for the dedicated appliance. + * + * @summary returns the cluster user credentials for the dedicated appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListClusterUserCredential.json + */ +async function listClusterUserCredentialAppliance() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.listClusterUserCredential( + "testresourcegroup", + "appliance01", + ); + console.log(result); +} + +async function main() { + await listClusterUserCredentialAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListKeysSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListKeysSample.js new file mode 100644 index 000000000000..4c627c3fe760 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListKeysSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to returns the cluster customer credentials for the dedicated appliance. + * + * @summary returns the cluster customer credentials for the dedicated appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListKeys.json + */ +async function listKeysAppliance() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.listKeys("testresourcegroup", "appliance01"); + console.log(result); +} + +async function main() { + await listKeysAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListOperationsSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListOperationsSample.js new file mode 100644 index 000000000000..b9aeaa0344a6 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesListOperationsSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all available Appliances operations. + * + * @summary lists all available Appliances operations. + * x-ms-original-file: 2025-03-01-preview/AppliancesListOperations.json + */ +async function listAppliancesOperations() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.appliances.listOperations()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAppliancesOperations(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesUpdateSample.js b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesUpdateSample.js new file mode 100644 index 000000000000..67a858d4f89b --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/appliancesUpdateSample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ResourceConnectorManagementClient } = require("@azure/arm-resourceconnector"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @summary updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * x-ms-original-file: 2025-03-01-preview/AppliancesPatch.json + */ +async function updateAppliance() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.update("testresourcegroup", "appliance01", { + tags: { key: "value" }, + }); + console.log(result); +} + +async function main() { + await updateAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/package.json b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/package.json similarity index 68% rename from sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/package.json rename to sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/package.json index 8f2b18027f84..7dc1e6eef498 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/javascript/package.json +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/arm-resourceconnector-js", + "name": "@azure-samples/arm-resourceconnector-js-beta", "private": true, "version": "1.0.0", - "description": " client library samples for JavaScript", + "description": "@azure/arm-resourceconnector client library samples for JavaScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -14,6 +14,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -25,8 +26,11 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector", "dependencies": { - "@azure/arm-resourceconnector": "latest", + "@azure/arm-resourceconnector": "next", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "cross-env": "latest" } } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/sample.env b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/javascript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/README.md b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/README.md similarity index 55% rename from sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/README.md rename to sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/README.md index 1f587c3e805b..7d7e7b25a9ca 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/README.md +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/README.md @@ -1,20 +1,20 @@ -# client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [appliancesCreateOrUpdateSample.ts][appliancescreateorupdatesample] | Creates or updates an Appliance in the specified Subscription and Resource Group. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesCreate_Update.json | -| [appliancesDeleteSample.ts][appliancesdeletesample] | Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesDelete.json | -| [appliancesGetSample.ts][appliancesgetsample] | Gets the details of an Appliance with a specified resource group and name. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesGet.json | -| [appliancesGetTelemetryConfigSample.ts][appliancesgettelemetryconfigsample] | Gets the telemetry config. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/TelemetryConfig.json | -| [appliancesGetUpgradeGraphSample.ts][appliancesgetupgradegraphsample] | Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/UpgradeGraph.json | -| [appliancesListByResourceGroupSample.ts][applianceslistbyresourcegroupsample] | Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListByResourceGroup.json | -| [appliancesListBySubscriptionSample.ts][applianceslistbysubscriptionsample] | Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListBySubscription.json | -| [appliancesListClusterUserCredentialSample.ts][applianceslistclusterusercredentialsample] | Returns the cluster user credentials for the dedicated appliance. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListClusterUserCredential.json | -| [appliancesListKeysSample.ts][applianceslistkeyssample] | Returns the cluster customer credentials for the dedicated appliance. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListKeys.json | -| [appliancesListOperationsSample.ts][applianceslistoperationssample] | Lists all available Appliances operations. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesListOperations.json | -| [appliancesUpdateSample.ts][appliancesupdatesample] | Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesPatch.json | +# @azure/arm-resourceconnector client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for @azure/arm-resourceconnector in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [appliancesCreateOrUpdateSample.ts][appliancescreateorupdatesample] | creates or updates an Appliance in the specified Subscription and Resource Group. x-ms-original-file: 2025-03-01-preview/AppliancesCreate_Update.json | +| [appliancesDeleteSample.ts][appliancesdeletesample] | deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. x-ms-original-file: 2025-03-01-preview/AppliancesDelete.json | +| [appliancesGetSample.ts][appliancesgetsample] | gets the details of an Appliance with a specified resource group and name. x-ms-original-file: 2025-03-01-preview/AppliancesGet.json | +| [appliancesGetTelemetryConfigSample.ts][appliancesgettelemetryconfigsample] | gets the telemetry config. x-ms-original-file: 2025-03-01-preview/TelemetryConfig.json | +| [appliancesGetUpgradeGraphSample.ts][appliancesgetupgradegraphsample] | gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. x-ms-original-file: 2025-03-01-preview/UpgradeGraph.json | +| [appliancesListByResourceGroupSample.ts][applianceslistbyresourcegroupsample] | gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. x-ms-original-file: 2025-03-01-preview/AppliancesListByResourceGroup.json | +| [appliancesListBySubscriptionSample.ts][applianceslistbysubscriptionsample] | gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance x-ms-original-file: 2025-03-01-preview/AppliancesListBySubscription.json | +| [appliancesListClusterUserCredentialSample.ts][applianceslistclusterusercredentialsample] | returns the cluster user credentials for the dedicated appliance. x-ms-original-file: 2025-03-01-preview/AppliancesListClusterUserCredential.json | +| [appliancesListKeysSample.ts][applianceslistkeyssample] | returns the cluster customer credentials for the dedicated appliance. x-ms-original-file: 2025-03-01-preview/AppliancesListKeys.json | +| [appliancesListOperationsSample.ts][applianceslistoperationssample] | lists all available Appliances operations. x-ms-original-file: 2025-03-01-preview/AppliancesListOperations.json | +| [appliancesUpdateSample.ts][appliancesupdatesample] | updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. x-ms-original-file: 2025-03-01-preview/AppliancesPatch.json | ## Prerequisites @@ -59,24 +59,24 @@ node dist/appliancesCreateOrUpdateSample.js Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -cross-env RESOURCECONNECTOR_SUBSCRIPTION_ID="" RESOURCECONNECTOR_RESOURCE_GROUP="" node dist/appliancesCreateOrUpdateSample.js +node dist/appliancesCreateOrUpdateSample.js ``` ## Next Steps Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[appliancescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesCreateOrUpdateSample.ts -[appliancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesDeleteSample.ts -[appliancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetSample.ts -[appliancesgettelemetryconfigsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetTelemetryConfigSample.ts -[appliancesgetupgradegraphsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesGetUpgradeGraphSample.ts -[applianceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListByResourceGroupSample.ts -[applianceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListBySubscriptionSample.ts -[applianceslistclusterusercredentialsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListClusterUserCredentialSample.ts -[applianceslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListKeysSample.ts -[applianceslistoperationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesListOperationsSample.ts -[appliancesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/src/appliancesUpdateSample.ts +[appliancescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesCreateOrUpdateSample.ts +[appliancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesDeleteSample.ts +[appliancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetSample.ts +[appliancesgettelemetryconfigsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetTelemetryConfigSample.ts +[appliancesgetupgradegraphsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetUpgradeGraphSample.ts +[applianceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListByResourceGroupSample.ts +[applianceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListBySubscriptionSample.ts +[applianceslistclusterusercredentialsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListClusterUserCredentialSample.ts +[applianceslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListKeysSample.ts +[applianceslistoperationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListOperationsSample.ts +[appliancesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesUpdateSample.ts [apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-resourceconnector?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector/README.md diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/package.json b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/package.json similarity index 70% rename from sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/package.json rename to sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/package.json index cb5cc85e5afe..9754ef4387cd 100644 --- a/sdk/resourceconnector/arm-resourceconnector/samples/v1/typescript/package.json +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/arm-resourceconnector-ts", + "name": "@azure-samples/arm-resourceconnector-ts-beta", "private": true, "version": "1.0.0", - "description": " client library samples for TypeScript", + "description": "@azure/arm-resourceconnector client library samples for TypeScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -18,6 +18,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -29,13 +30,14 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourceconnector/arm-resourceconnector", "dependencies": { - "@azure/arm-resourceconnector": "latest", + "@azure/arm-resourceconnector": "next", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.13.0" }, "devDependencies": { "@types/node": "^20.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" + "cross-env": "latest", + "rimraf": "latest", + "typescript": "~5.9.3" } } diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/sample.env b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesCreateOrUpdateSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..fabe3559d9d7 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesCreateOrUpdateSample.ts @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @summary creates or updates an Appliance in the specified Subscription and Resource Group. + * x-ms-original-file: 2025-03-01-preview/AppliancesCreate_Update.json + */ +async function createOrUpdateAppliance(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.createOrUpdate("testresourcegroup", "appliance01", { + location: "West US", + properties: { + distro: "AKSEdge", + infrastructureConfig: { provider: "VMWare" }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @summary creates or updates an Appliance in the specified Subscription and Resource Group. + * x-ms-original-file: 2025-03-01-preview/AppliancesUpdateProxy.json + */ +async function updateApplianceProxyConfiguration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.createOrUpdate("testresourcegroup", "appliance01", { + location: "West US", + properties: { + distro: "AKSEdge", + publicKey: "xxxxxxxx", + infrastructureConfig: { provider: "VMWare" }, + networkProfile: { proxyConfiguration: { version: "latest" } }, + }, + }); + console.log(result); +} + +async function main(): Promise { + await createOrUpdateAppliance(); + await updateApplianceProxyConfiguration(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesDeleteSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesDeleteSample.ts new file mode 100644 index 000000000000..378e3af88383 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @summary deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * x-ms-original-file: 2025-03-01-preview/AppliancesDelete.json + */ +async function deleteAppliance(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + await client.appliances.delete("testresourcegroup", "appliance01"); +} + +async function main(): Promise { + await deleteAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetSample.ts new file mode 100644 index 000000000000..1a3e3a10d822 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the details of an Appliance with a specified resource group and name. + * + * @summary gets the details of an Appliance with a specified resource group and name. + * x-ms-original-file: 2025-03-01-preview/AppliancesGet.json + */ +async function getAppliance(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.get("testresourcegroup", "appliance01"); + console.log(result); +} + +async function main(): Promise { + await getAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetTelemetryConfigSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetTelemetryConfigSample.ts new file mode 100644 index 000000000000..c5577bdc50fa --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetTelemetryConfigSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the telemetry config. + * + * @summary gets the telemetry config. + * x-ms-original-file: 2025-03-01-preview/TelemetryConfig.json + */ +async function getTelemetryConfigAppliance(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.getTelemetryConfig(); + console.log(result); +} + +async function main(): Promise { + await getTelemetryConfigAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetUpgradeGraphSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetUpgradeGraphSample.ts new file mode 100644 index 000000000000..6c06c3bbd65d --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesGetUpgradeGraphSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. + * + * @summary gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. + * x-ms-original-file: 2025-03-01-preview/UpgradeGraph.json + */ +async function getApplianceUpgradeGraph(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.getUpgradeGraph( + "testresourcegroup", + "appliance01", + "stable", + ); + console.log(result); +} + +async function main(): Promise { + await getApplianceUpgradeGraph(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListByResourceGroupSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListByResourceGroupSample.ts new file mode 100644 index 000000000000..d57ebf388f0c --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. + * + * @summary gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListByResourceGroup.json + */ +async function listAppliancesByResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.appliances.listByResourceGroup("testresourcegroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAppliancesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListBySubscriptionSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListBySubscriptionSample.ts new file mode 100644 index 000000000000..afe0935ed9a6 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance + * + * @summary gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance + * x-ms-original-file: 2025-03-01-preview/AppliancesListBySubscription.json + */ +async function listAppliancesBySubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.appliances.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAppliancesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListClusterUserCredentialSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListClusterUserCredentialSample.ts new file mode 100644 index 000000000000..c5e33a994f41 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListClusterUserCredentialSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to returns the cluster user credentials for the dedicated appliance. + * + * @summary returns the cluster user credentials for the dedicated appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListClusterUserCredential.json + */ +async function listClusterUserCredentialAppliance(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.listClusterUserCredential( + "testresourcegroup", + "appliance01", + ); + console.log(result); +} + +async function main(): Promise { + await listClusterUserCredentialAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListKeysSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListKeysSample.ts new file mode 100644 index 000000000000..6a17d6694faa --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListKeysSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to returns the cluster customer credentials for the dedicated appliance. + * + * @summary returns the cluster customer credentials for the dedicated appliance. + * x-ms-original-file: 2025-03-01-preview/AppliancesListKeys.json + */ +async function listKeysAppliance(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.listKeys("testresourcegroup", "appliance01"); + console.log(result); +} + +async function main(): Promise { + await listKeysAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListOperationsSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListOperationsSample.ts new file mode 100644 index 000000000000..4664c528ef62 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesListOperationsSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all available Appliances operations. + * + * @summary lists all available Appliances operations. + * x-ms-original-file: 2025-03-01-preview/AppliancesListOperations.json + */ +async function listAppliancesOperations(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.appliances.listOperations()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAppliancesOperations(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesUpdateSample.ts b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesUpdateSample.ts new file mode 100644 index 000000000000..5e5b413981ba --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/src/appliancesUpdateSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ResourceConnectorManagementClient } from "@azure/arm-resourceconnector"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @summary updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * x-ms-original-file: 2025-03-01-preview/AppliancesPatch.json + */ +async function updateAppliance(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11111111-2222-3333-4444-555555555555"; + const client = new ResourceConnectorManagementClient(credential, subscriptionId); + const result = await client.appliances.update("testresourcegroup", "appliance01", { + tags: { key: "value" }, + }); + console.log(result); +} + +async function main(): Promise { + await updateAppliance(); +} + +main().catch(console.error); diff --git a/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/tsconfig.json b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..400db87cf648 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/samples/v2-beta/typescript/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "commonjs", + "lib": [], + "importHelpers": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node10", + "esModuleInterop": true, + "outDir": "./dist", + "resolveJsonModule": true + }, + "include": [ + "./src" + ] +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/index.ts new file mode 100644 index 000000000000..c4765c2a2faa --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/index.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + getTelemetryConfig, + listOperations, + getUpgradeGraph, + listKeys, + listClusterUserCredential, + listBySubscription, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + AppliancesGetTelemetryConfigOptionalParams, + AppliancesListOperationsOptionalParams, + AppliancesGetUpgradeGraphOptionalParams, + AppliancesListKeysOptionalParams, + AppliancesListClusterUserCredentialOptionalParams, + AppliancesListBySubscriptionOptionalParams, + AppliancesListByResourceGroupOptionalParams, + AppliancesDeleteOptionalParams, + AppliancesUpdateOptionalParams, + AppliancesCreateOrUpdateOptionalParams, + AppliancesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/operations.ts b/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/operations.ts new file mode 100644 index 000000000000..02681de864d4 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/operations.ts @@ -0,0 +1,630 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ResourceConnectorManagementContext as Client } from "../index.js"; +import type { + Appliance, + PatchableAppliance, + _ApplianceListResult, + ApplianceListCredentialResults, + ApplianceListKeysResults, + UpgradeGraph, + _ApplianceOperationsList, + ApplianceOperation, + ApplianceGetTelemetryConfigResult, +} from "../../models/models.js"; +import { + applianceSerializer, + applianceDeserializer, + errorResponseDeserializer, + patchableApplianceSerializer, + _applianceListResultDeserializer, + applianceListCredentialResultsDeserializer, + applianceListKeysResultsDeserializer, + upgradeGraphDeserializer, + _applianceOperationsListDeserializer, + applianceGetTelemetryConfigResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + AppliancesGetTelemetryConfigOptionalParams, + AppliancesListOperationsOptionalParams, + AppliancesGetUpgradeGraphOptionalParams, + AppliancesListKeysOptionalParams, + AppliancesListClusterUserCredentialOptionalParams, + AppliancesListBySubscriptionOptionalParams, + AppliancesListByResourceGroupOptionalParams, + AppliancesDeleteOptionalParams, + AppliancesUpdateOptionalParams, + AppliancesCreateOrUpdateOptionalParams, + AppliancesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _getTelemetryConfigSend( + context: Client, + options: AppliancesGetTelemetryConfigOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/telemetryconfig{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getTelemetryConfigDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return applianceGetTelemetryConfigResultDeserializer(result.body); +} + +/** Gets the telemetry config. */ +export async function getTelemetryConfig( + context: Client, + options: AppliancesGetTelemetryConfigOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTelemetryConfigSend(context, options); + return _getTelemetryConfigDeserialize(result); +} + +export function _listOperationsSend( + context: Client, + options: AppliancesListOperationsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.ResourceConnector/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listOperationsDeserialize( + result: PathUncheckedResponse, +): Promise<_ApplianceOperationsList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _applianceOperationsListDeserializer(result.body); +} + +/** Lists all available Appliances operations. */ +export function listOperations( + context: Client, + options: AppliancesListOperationsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listOperationsSend(context, options), + _listOperationsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _getUpgradeGraphSend( + context: Client, + resourceGroupName: string, + resourceName: string, + upgradeGraph: string, + options: AppliancesGetUpgradeGraphOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}/upgradeGraphs/{upgradeGraph}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + upgradeGraph: upgradeGraph, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getUpgradeGraphDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return upgradeGraphDeserializer(result.body); +} + +/** Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. */ +export async function getUpgradeGraph( + context: Client, + resourceGroupName: string, + resourceName: string, + upgradeGraph: string, + options: AppliancesGetUpgradeGraphOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getUpgradeGraphSend( + context, + resourceGroupName, + resourceName, + upgradeGraph, + options, + ); + return _getUpgradeGraphDeserialize(result); +} + +export function _listKeysSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: AppliancesListKeysOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}/listkeys{?api%2Dversion,artifactType}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion, + artifactType: options?.artifactType, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listKeysDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return applianceListKeysResultsDeserializer(result.body); +} + +/** Returns the cluster customer credentials for the dedicated appliance. */ +export async function listKeys( + context: Client, + resourceGroupName: string, + resourceName: string, + options: AppliancesListKeysOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listKeysSend(context, resourceGroupName, resourceName, options); + return _listKeysDeserialize(result); +} + +export function _listClusterUserCredentialSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: AppliancesListClusterUserCredentialOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}/listClusterUserCredential{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listClusterUserCredentialDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return applianceListCredentialResultsDeserializer(result.body); +} + +/** Returns the cluster user credentials for the dedicated appliance. */ +export async function listClusterUserCredential( + context: Client, + resourceGroupName: string, + resourceName: string, + options: AppliancesListClusterUserCredentialOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _listClusterUserCredentialSend( + context, + resourceGroupName, + resourceName, + options, + ); + return _listClusterUserCredentialDeserialize(result); +} + +export function _listBySubscriptionSend( + context: Client, + options: AppliancesListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/appliances{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_ApplianceListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _applianceListResultDeserializer(result.body); +} + +/** Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance */ +export function listBySubscription( + context: Client, + options: AppliancesListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: AppliancesListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_ApplianceListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _applianceListResultDeserializer(result.body); +} + +/** Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: AppliancesListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: AppliancesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + resourceName: string, + options: AppliancesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _$deleteSend(context, resourceGroupName, resourceName, options), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + resourceName: string, + parameters: PatchableAppliance, + options: AppliancesUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: patchableApplianceSerializer(parameters), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return applianceDeserializer(result.body); +} + +/** Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. */ +export async function update( + context: Client, + resourceGroupName: string, + resourceName: string, + parameters: PatchableAppliance, + options: AppliancesUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateSend(context, resourceGroupName, resourceName, parameters, options); + return _updateDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + resourceName: string, + parameters: Appliance, + options: AppliancesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: applianceSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return applianceDeserializer(result.body); +} + +/** Creates or updates an Appliance in the specified Subscription and Resource Group. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + resourceName: string, + parameters: Appliance, + options: AppliancesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Appliance> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, resourceName, parameters, options), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Appliance>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: AppliancesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return applianceDeserializer(result.body); +} + +/** Gets the details of an Appliance with a specified resource group and name. */ +export async function get( + context: Client, + resourceGroupName: string, + resourceName: string, + options: AppliancesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, resourceName, options); + return _getDeserialize(result); +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/options.ts b/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/options.ts new file mode 100644 index 000000000000..50175bd92a62 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/api/appliances/options.ts @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface AppliancesGetTelemetryConfigOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AppliancesListOperationsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AppliancesGetUpgradeGraphOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AppliancesListKeysOptionalParams extends OperationOptions { + /** This sets the type of artifact being returned, when empty no artifact endpoint is returned. */ + artifactType?: string; +} + +/** Optional parameters. */ +export interface AppliancesListClusterUserCredentialOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AppliancesListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AppliancesListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AppliancesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AppliancesUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AppliancesCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AppliancesGetOptionalParams extends OperationOptions {} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/api/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/api/index.ts new file mode 100644 index 000000000000..89a5e1e8464a --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createResourceConnectorManagement, + ResourceConnectorManagementContext, + ResourceConnectorManagementClientOptionalParams, +} from "./resourceConnectorManagementContext.js"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/api/resourceConnectorManagementContext.ts b/sdk/resourceconnector/arm-resourceconnector/src/api/resourceConnectorManagementContext.ts new file mode 100644 index 000000000000..aa9c6c3408bd --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/api/resourceConnectorManagementContext.ts @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import type { AzureSupportedClouds } from "../static-helpers/cloudSettingHelpers.js"; +import { getArmEndpoint } from "../static-helpers/cloudSettingHelpers.js"; +import type { Client, ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import type { TokenCredential } from "@azure/core-auth"; + +/** The appliances Rest API spec. */ +export interface ResourceConnectorManagementContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; +} + +/** Optional parameters for the client. */ +export interface ResourceConnectorManagementClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; + /** Specifies the Azure cloud environment for the client. */ + cloudSetting?: AzureSupportedClouds; +} + +/** The appliances Rest API spec. */ +export function createResourceConnectorManagement( + credential: TokenCredential, + subscriptionId: string, + options: ResourceConnectorManagementClientOptionalParams = {}, +): ResourceConnectorManagementContext { + const endpointUrl = + options.endpoint ?? getArmEndpoint(options.cloudSetting) ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-resourceconnector/2.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2025-03-01-preview"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return { + ...clientContext, + apiVersion, + subscriptionId, + } as ResourceConnectorManagementContext; +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/classic/appliances/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/classic/appliances/index.ts new file mode 100644 index 000000000000..dd3f5eb2f24d --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/classic/appliances/index.ts @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ResourceConnectorManagementContext } from "../../api/resourceConnectorManagementContext.js"; +import { + getTelemetryConfig, + listOperations, + getUpgradeGraph, + listKeys, + listClusterUserCredential, + listBySubscription, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/appliances/operations.js"; +import type { + AppliancesGetTelemetryConfigOptionalParams, + AppliancesListOperationsOptionalParams, + AppliancesGetUpgradeGraphOptionalParams, + AppliancesListKeysOptionalParams, + AppliancesListClusterUserCredentialOptionalParams, + AppliancesListBySubscriptionOptionalParams, + AppliancesListByResourceGroupOptionalParams, + AppliancesDeleteOptionalParams, + AppliancesUpdateOptionalParams, + AppliancesCreateOrUpdateOptionalParams, + AppliancesGetOptionalParams, +} from "../../api/appliances/options.js"; +import type { + Appliance, + PatchableAppliance, + ApplianceListCredentialResults, + ApplianceListKeysResults, + UpgradeGraph, + ApplianceOperation, + ApplianceGetTelemetryConfigResult, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Appliances operations. */ +export interface AppliancesOperations { + /** Gets the telemetry config. */ + getTelemetryConfig: ( + options?: AppliancesGetTelemetryConfigOptionalParams, + ) => Promise; + /** Lists all available Appliances operations. */ + listOperations: ( + options?: AppliancesListOperationsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Gets the upgrade graph of an Appliance with a specified resource group and name and specific release train. */ + getUpgradeGraph: ( + resourceGroupName: string, + resourceName: string, + upgradeGraph: string, + options?: AppliancesGetUpgradeGraphOptionalParams, + ) => Promise; + /** Returns the cluster customer credentials for the dedicated appliance. */ + listKeys: ( + resourceGroupName: string, + resourceName: string, + options?: AppliancesListKeysOptionalParams, + ) => Promise; + /** Returns the cluster user credentials for the dedicated appliance. */ + listClusterUserCredential: ( + resourceGroupName: string, + resourceName: string, + options?: AppliancesListClusterUserCredentialOptionalParams, + ) => Promise; + /** Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance */ + listBySubscription: ( + options?: AppliancesListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of each Appliance. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: AppliancesListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + resourceName: string, + options?: AppliancesDeleteOptionalParams, + ) => PollerLike, void>; + /** Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. */ + update: ( + resourceGroupName: string, + resourceName: string, + parameters: PatchableAppliance, + options?: AppliancesUpdateOptionalParams, + ) => Promise; + /** Creates or updates an Appliance in the specified Subscription and Resource Group. */ + createOrUpdate: ( + resourceGroupName: string, + resourceName: string, + parameters: Appliance, + options?: AppliancesCreateOrUpdateOptionalParams, + ) => PollerLike, Appliance>; + /** Gets the details of an Appliance with a specified resource group and name. */ + get: ( + resourceGroupName: string, + resourceName: string, + options?: AppliancesGetOptionalParams, + ) => Promise; +} + +function _getAppliances(context: ResourceConnectorManagementContext) { + return { + getTelemetryConfig: (options?: AppliancesGetTelemetryConfigOptionalParams) => + getTelemetryConfig(context, options), + listOperations: (options?: AppliancesListOperationsOptionalParams) => + listOperations(context, options), + getUpgradeGraph: ( + resourceGroupName: string, + resourceName: string, + upgradeGraph: string, + options?: AppliancesGetUpgradeGraphOptionalParams, + ) => getUpgradeGraph(context, resourceGroupName, resourceName, upgradeGraph, options), + listKeys: ( + resourceGroupName: string, + resourceName: string, + options?: AppliancesListKeysOptionalParams, + ) => listKeys(context, resourceGroupName, resourceName, options), + listClusterUserCredential: ( + resourceGroupName: string, + resourceName: string, + options?: AppliancesListClusterUserCredentialOptionalParams, + ) => listClusterUserCredential(context, resourceGroupName, resourceName, options), + listBySubscription: (options?: AppliancesListBySubscriptionOptionalParams) => + listBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: AppliancesListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + resourceName: string, + options?: AppliancesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, resourceName, options), + update: ( + resourceGroupName: string, + resourceName: string, + parameters: PatchableAppliance, + options?: AppliancesUpdateOptionalParams, + ) => update(context, resourceGroupName, resourceName, parameters, options), + createOrUpdate: ( + resourceGroupName: string, + resourceName: string, + parameters: Appliance, + options?: AppliancesCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, resourceName, parameters, options), + get: (resourceGroupName: string, resourceName: string, options?: AppliancesGetOptionalParams) => + get(context, resourceGroupName, resourceName, options), + }; +} + +export function _getAppliancesOperations( + context: ResourceConnectorManagementContext, +): AppliancesOperations { + return { + ..._getAppliances(context), + }; +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/classic/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/classic/index.ts new file mode 100644 index 000000000000..d1047f51f7a7 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/classic/index.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { AppliancesOperations } from "./appliances/index.js"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/index.ts index 957735ddd332..ac70590caf6d 100644 --- a/sdk/resourceconnector/arm-resourceconnector/src/index.ts +++ b/sdk/resourceconnector/arm-resourceconnector/src/index.ts @@ -1,13 +1,75 @@ -/* - * 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. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureClouds, AzureSupportedClouds } from "./static-helpers/cloudSettingHelpers.js"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; export { ResourceConnectorManagementClient } from "./resourceConnectorManagementClient.js"; -export * from "./operationsInterfaces/index.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + Appliance, + ApplianceProperties, + KnownDistro, + Distro, + AppliancePropertiesInfrastructureConfig, + KnownProvider, + Provider, + KnownStatus, + Status, + Event, + NetworkProfile, + ProxyConfiguration, + DnsConfiguration, + GatewayConfiguration, + Identity, + KnownResourceIdentityType, + ResourceIdentityType, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + PatchableAppliance, + ApplianceListCredentialResults, + HybridConnectionConfig, + ApplianceCredentialKubeconfig, + KnownAccessProfileType, + AccessProfileType, + ApplianceListKeysResults, + ArtifactProfile, + SSHKey, + UpgradeGraph, + UpgradeGraphProperties, + SupportedVersion, + SupportedVersionMetadata, + SupportedVersionCatalogVersion, + SupportedVersionCatalogVersionData, + ApplianceOperation, + ApplianceOperationValueDisplay, + ApplianceGetTelemetryConfigResult, + KnownVersions, +} from "./models/index.js"; +export { ResourceConnectorManagementClientOptionalParams } from "./api/index.js"; +export { + AppliancesGetTelemetryConfigOptionalParams, + AppliancesListOperationsOptionalParams, + AppliancesGetUpgradeGraphOptionalParams, + AppliancesListKeysOptionalParams, + AppliancesListClusterUserCredentialOptionalParams, + AppliancesListBySubscriptionOptionalParams, + AppliancesListByResourceGroupOptionalParams, + AppliancesDeleteOptionalParams, + AppliancesUpdateOptionalParams, + AppliancesCreateOrUpdateOptionalParams, + AppliancesGetOptionalParams, +} from "./api/appliances/index.js"; +export { AppliancesOperations } from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds, AzureSupportedClouds }; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/logger.ts b/sdk/resourceconnector/arm-resourceconnector/src/logger.ts new file mode 100644 index 000000000000..2a1b5e11e022 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-resourceconnector"); diff --git a/sdk/resourceconnector/arm-resourceconnector/src/lroImpl.ts b/sdk/resourceconnector/arm-resourceconnector/src/lroImpl.ts deleted file mode 100644 index a1dab276a1b7..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/src/lroImpl.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { AbortSignalLike } from "@azure/abort-controller"; -import { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: ( - path: string, - options?: { abortSignal?: AbortSignalLike } - ) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal - }); - } - }; -} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/models/index.ts b/sdk/resourceconnector/arm-resourceconnector/src/models/index.ts index 2e89be634b67..dd816df486d1 100644 --- a/sdk/resourceconnector/arm-resourceconnector/src/models/index.ts +++ b/sdk/resourceconnector/arm-resourceconnector/src/models/index.ts @@ -1,786 +1,49 @@ -/* - * 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; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** The Get Telemetry Config Result appliance. */ -export interface ApplianceGetTelemetryConfigResult { - /** - * Telemetry instrumentation key. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly telemetryInstrumentationKey?: string; -} - -/** The Appliances patchable resource definition. */ -export interface PatchableAppliance { - /** Resource tags */ - tags?: { [propertyName: string]: 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; -} - -/** 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; -} - -/** The List Cluster Keys Results appliance. */ -export interface ApplianceListKeysResults { - /** - * Map of artifacts that contains a list of ArtifactProfile used to upload artifacts such as logs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly artifactProfiles?: { [propertyName: string]: ArtifactProfile }; - /** - * 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, Private SSH Keys and Certificate when available. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly sshKeys?: { [propertyName: string]: SSHKey }; -} - -/** Appliance ArtifactProfile definition. */ -export interface ArtifactProfile { - /** - * Endpoint is the URL to upload artifacts to. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly endpoint?: string; -} - -/** Appliance SSHKey definition. */ -export interface SSHKey { - /** - * Certificate associated with the public key if the key is signed. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly certificate?: string; - /** - * Certificate creation timestamp (Unix). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly creationTimeStamp?: number; - /** - * Certificate expiration timestamp (Unix). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expirationTimeStamp?: number; - /** - * Private Key. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly privateKey?: string; - /** - * Public Key. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly publicKey?: 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 interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The geo-location where the resource lives */ - location: string; -} - -/** Appliances definition. */ -export interface Appliance extends TrackedResource { - /** Identity for the resource. */ - identity?: Identity; - /** 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. Can only be set once. */ - 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 = "SystemAssigned", - /** None */ - 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 = "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 = "VMWare", - /** HCI */ - HCI = "HCI", - /** Scvmm */ - Scvmm = "SCVMM", - /** KubeVirt */ - KubeVirt = "KubeVirt", - /** OpenStack */ - 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 = "WaitingForHeartbeat", - /** Validating */ - Validating = "Validating", - /** Connecting */ - Connecting = "Connecting", - /** Connected */ - Connected = "Connected", - /** Running */ - Running = "Running", - /** PreparingForUpgrade */ - PreparingForUpgrade = "PreparingForUpgrade", - /** UpgradePrerequisitesCompleted */ - UpgradePrerequisitesCompleted = "UpgradePrerequisitesCompleted", - /** PreUpgrade */ - PreUpgrade = "PreUpgrade", - /** UpgradingKvaio */ - UpgradingKvaio = "UpgradingKVAIO", - /** WaitingForKvaio */ - WaitingForKvaio = "WaitingForKVAIO", - /** ImagePending */ - ImagePending = "ImagePending", - /** ImageProvisioning */ - ImageProvisioning = "ImageProvisioning", - /** ImageProvisioned */ - ImageProvisioned = "ImageProvisioned", - /** ImageDownloading */ - ImageDownloading = "ImageDownloading", - /** ImageDownloaded */ - ImageDownloaded = "ImageDownloaded", - /** ImageDeprovisioning */ - ImageDeprovisioning = "ImageDeprovisioning", - /** ImageUnknown */ - ImageUnknown = "ImageUnknown", - /** UpdatingCloudOperator */ - UpdatingCloudOperator = "UpdatingCloudOperator", - /** WaitingForCloudOperator */ - WaitingForCloudOperator = "WaitingForCloudOperator", - /** UpdatingCapi */ - UpdatingCapi = "UpdatingCAPI", - /** UpdatingCluster */ - UpdatingCluster = "UpdatingCluster", - /** PostUpgrade */ - PostUpgrade = "PostUpgrade", - /** UpgradeComplete */ - UpgradeComplete = "UpgradeComplete", - /** UpgradeClusterExtensionFailedToDelete */ - UpgradeClusterExtensionFailedToDelete = "UpgradeClusterExtensionFailedToDelete", - /** UpgradeFailed */ - UpgradeFailed = "UpgradeFailed", - /** Offline */ - Offline = "Offline", - /** None */ - 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** \ - * **UpgradingKVAIO** \ - * **WaitingForKVAIO** \ - * **ImagePending** \ - * **ImageProvisioning** \ - * **ImageProvisioned** \ - * **ImageDownloading** \ - * **ImageDownloaded** \ - * **ImageDeprovisioning** \ - * **ImageUnknown** \ - * **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 = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key" -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link AccessProfileType} that the service accepts. */ -export enum KnownAccessProfileType { - /** ClusterUser */ - ClusterUser = "clusterUser", - /** ClusterCustomerUser */ - 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 ArtifactType} that the service accepts. */ -export enum KnownArtifactType { - /** LogsArtifactType */ - LogsArtifactType = "LogsArtifactType" -} - -/** - * Defines values for ArtifactType. \ - * {@link KnownArtifactType} can be used interchangeably with ArtifactType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **LogsArtifactType** - */ -export type ArtifactType = string; - -/** Known values of {@link SSHKeyType} that the service accepts. */ -export enum KnownSSHKeyType { - /** SSHCustomerUser */ - SSHCustomerUser = "SSHCustomerUser", - /** ManagementCAKey */ - ManagementCAKey = "ManagementCAKey", - /** LogsKey */ - LogsKey = "LogsKey", - /** ScopedAccessKey */ - ScopedAccessKey = "ScopedAccessKey" -} - -/** - * 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** \ - * **ManagementCAKey** \ - * **LogsKey** \ - * **ScopedAccessKey** - */ -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 AppliancesGetTelemetryConfigOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getTelemetryConfig operation. */ -export type AppliancesGetTelemetryConfigResponse = ApplianceGetTelemetryConfigResult; - -/** 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 AppliancesListClusterUserCredentialOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listClusterUserCredential operation. */ -export type AppliancesListClusterUserCredentialResponse = ApplianceListCredentialResults; - -/** Optional parameters. */ -export interface AppliancesListKeysOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listKeys operation. */ -export type AppliancesListKeysResponse = ApplianceListKeysResults; - -/** 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; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + Appliance, + ApplianceProperties, + KnownDistro, + Distro, + AppliancePropertiesInfrastructureConfig, + KnownProvider, + Provider, + KnownStatus, + Status, + Event, + NetworkProfile, + ProxyConfiguration, + DnsConfiguration, + GatewayConfiguration, + Identity, + KnownResourceIdentityType, + ResourceIdentityType, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + PatchableAppliance, + ApplianceListCredentialResults, + HybridConnectionConfig, + ApplianceCredentialKubeconfig, + KnownAccessProfileType, + AccessProfileType, + ApplianceListKeysResults, + ArtifactProfile, + SSHKey, + UpgradeGraph, + UpgradeGraphProperties, + SupportedVersion, + SupportedVersionMetadata, + SupportedVersionCatalogVersion, + SupportedVersionCatalogVersionData, + ApplianceOperation, + ApplianceOperationValueDisplay, + ApplianceGetTelemetryConfigResult, + KnownVersions, +} from "./models.js"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/models/mappers.ts b/sdk/resourceconnector/arm-resourceconnector/src/models/mappers.ts deleted file mode 100644 index 070c703e3ae0..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/src/models/mappers.ts +++ /dev/null @@ -1,811 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as 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 Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime" - } - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String" - } - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String" - } - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime" - } - } - } - } -}; - -export const ApplianceGetTelemetryConfigResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ApplianceGetTelemetryConfigResult", - modelProperties: { - telemetryInstrumentationKey: { - serializedName: "telemetryInstrumentationKey", - 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 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 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 ApplianceListKeysResults: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ApplianceListKeysResults", - modelProperties: { - artifactProfiles: { - serializedName: "artifactProfiles", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "Composite", className: "ArtifactProfile" } } - } - }, - 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 ArtifactProfile: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ArtifactProfile", - modelProperties: { - endpoint: { - serializedName: "endpoint", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const SSHKey: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SSHKey", - modelProperties: { - certificate: { - serializedName: "certificate", - readOnly: true, - type: { - name: "String" - } - }, - creationTimeStamp: { - serializedName: "creationTimeStamp", - readOnly: true, - type: { - name: "Number" - } - }, - expirationTimeStamp: { - serializedName: "expirationTimeStamp", - readOnly: true, - type: { - name: "Number" - } - }, - privateKey: { - serializedName: "privateKey", - readOnly: true, - type: { - name: "String" - } - }, - publicKey: { - serializedName: "publicKey", - 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" - } - }, - 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/models.ts b/sdk/resourceconnector/arm-resourceconnector/src/models/models.ts new file mode 100644 index 000000000000..c0c702f28513 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/models/models.ts @@ -0,0 +1,1030 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * This file contains only generated model types and their (de)serializers. + * Disable the following rules for internal models with '_' prefix and deserializers which require 'any' for raw JSON input. + */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/** Appliances definition. */ +export interface Appliance extends TrackedResource { + /** The set of properties specific to an Appliance */ + properties?: ApplianceProperties; + /** Identity for the resource. */ + identity?: Identity; +} + +export function applianceSerializer(item: Appliance): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : appliancePropertiesSerializer(item["properties"]), + identity: !item["identity"] ? item["identity"] : identitySerializer(item["identity"]), + }; +} + +export function applianceDeserializer(item: any): Appliance { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : appliancePropertiesDeserializer(item["properties"]), + identity: !item["identity"] ? item["identity"] : identityDeserializer(item["identity"]), + }; +} + +/** Properties for an appliance. */ +export interface ApplianceProperties { + /** 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. */ + readonly provisioningState?: string; + /** Certificates pair used to download MSI certificate from HIS. Can only be set once. */ + publicKey?: string; + /** Appliance’s health and state of connection to on-prem. This list of values is not exhaustive. */ + readonly status?: Status; + /** Version of the Appliance */ + version?: string; + /** A list of events that occurred on the Appliance to relay information to the user. */ + readonly events?: Event[]; + /** Contains network information about the Appliance */ + networkProfile?: NetworkProfile; +} + +export function appliancePropertiesSerializer(item: ApplianceProperties): any { + return { + distro: item["distro"], + infrastructureConfig: !item["infrastructureConfig"] + ? item["infrastructureConfig"] + : appliancePropertiesInfrastructureConfigSerializer(item["infrastructureConfig"]), + publicKey: item["publicKey"], + version: item["version"], + networkProfile: !item["networkProfile"] + ? item["networkProfile"] + : networkProfileSerializer(item["networkProfile"]), + }; +} + +export function appliancePropertiesDeserializer(item: any): ApplianceProperties { + return { + distro: item["distro"], + infrastructureConfig: !item["infrastructureConfig"] + ? item["infrastructureConfig"] + : appliancePropertiesInfrastructureConfigDeserializer(item["infrastructureConfig"]), + provisioningState: item["provisioningState"], + publicKey: item["publicKey"], + status: item["status"], + version: item["version"], + events: !item["events"] ? item["events"] : eventArrayDeserializer(item["events"]), + networkProfile: !item["networkProfile"] + ? item["networkProfile"] + : networkProfileDeserializer(item["networkProfile"]), + }; +} + +/** Represents a supported Fabric/Infra. (AKSEdge etc...). */ +export enum KnownDistro { + /** AKSEdge */ + AKSEdge = "AKSEdge", +} + +/** + * Represents a supported Fabric/Infra. (AKSEdge etc...). \ + * {@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; + +/** Contains infrastructure information about the Appliance */ +export interface AppliancePropertiesInfrastructureConfig { + /** Information about the connected appliance. */ + provider?: Provider; +} + +export function appliancePropertiesInfrastructureConfigSerializer( + item: AppliancePropertiesInfrastructureConfig, +): any { + return { provider: item["provider"] }; +} + +export function appliancePropertiesInfrastructureConfigDeserializer( + item: any, +): AppliancePropertiesInfrastructureConfig { + return { + provider: item["provider"], + }; +} + +/** Information about the connected appliance. */ +export enum KnownProvider { + /** VMWare */ + VMWare = "VMWare", + /** HCI */ + HCI = "HCI", + /** SCVMM */ + Scvmm = "SCVMM", +} + +/** + * Information about the connected appliance. \ + * {@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** + */ +export type Provider = string; + +/** Appliance’s health and state of connection to on-prem. This list of values is not exhaustive. */ +export enum KnownStatus { + /** WaitingForHeartbeat */ + WaitingForHeartbeat = "WaitingForHeartbeat", + /** Validating */ + Validating = "Validating", + /** Connecting */ + Connecting = "Connecting", + /** Connected */ + Connected = "Connected", + /** Running */ + Running = "Running", + /** PreparingForUpgrade */ + PreparingForUpgrade = "PreparingForUpgrade", + /** ETCDSnapshotFailed */ + EtcdSnapshotFailed = "ETCDSnapshotFailed", + /** UpgradePrerequisitesCompleted */ + UpgradePrerequisitesCompleted = "UpgradePrerequisitesCompleted", + /** ValidatingSFSConnectivity */ + ValidatingSFSConnectivity = "ValidatingSFSConnectivity", + /** ValidatingImageDownload */ + ValidatingImageDownload = "ValidatingImageDownload", + /** ValidatingImageUpload */ + ValidatingImageUpload = "ValidatingImageUpload", + /** ValidatingETCDHealth */ + ValidatingEtcdHealth = "ValidatingETCDHealth", + /** PreUpgrade */ + PreUpgrade = "PreUpgrade", + /** UpgradingKVAIO */ + UpgradingKvaio = "UpgradingKVAIO", + /** WaitingForKVAIO */ + WaitingForKvaio = "WaitingForKVAIO", + /** ImagePending */ + ImagePending = "ImagePending", + /** ImageProvisioning */ + ImageProvisioning = "ImageProvisioning", + /** ImageProvisioned */ + ImageProvisioned = "ImageProvisioned", + /** ImageDownloading */ + ImageDownloading = "ImageDownloading", + /** ImageDownloaded */ + ImageDownloaded = "ImageDownloaded", + /** ImageDeprovisioning */ + ImageDeprovisioning = "ImageDeprovisioning", + /** ImageUnknown */ + ImageUnknown = "ImageUnknown", + /** UpdatingCloudOperator */ + UpdatingCloudOperator = "UpdatingCloudOperator", + /** WaitingForCloudOperator */ + WaitingForCloudOperator = "WaitingForCloudOperator", + /** UpdatingCAPI */ + UpdatingCapi = "UpdatingCAPI", + /** UpdatingCluster */ + UpdatingCluster = "UpdatingCluster", + /** PostUpgrade */ + PostUpgrade = "PostUpgrade", + /** UpgradeComplete */ + UpgradeComplete = "UpgradeComplete", + /** UpgradeClusterExtensionFailedToDelete */ + UpgradeClusterExtensionFailedToDelete = "UpgradeClusterExtensionFailedToDelete", + /** UpgradeFailed */ + UpgradeFailed = "UpgradeFailed", + /** Offline */ + Offline = "Offline", + /** None */ + None = "None", + /** NetworkProxyUpdatePreparing */ + NetworkProxyUpdatePreparing = "NetworkProxyUpdatePreparing", + /** NetworkProxyUpdating */ + NetworkProxyUpdating = "NetworkProxyUpdating", + /** NetworkProxyUpdateComplete */ + NetworkProxyUpdateComplete = "NetworkProxyUpdateComplete", + /** NetworkProxyUpdateFailed */ + NetworkProxyUpdateFailed = "NetworkProxyUpdateFailed", + /** NetworkDNSUpdatePreparing */ + NetworkDNSUpdatePreparing = "NetworkDNSUpdatePreparing", + /** NetworkDNSUpdating */ + NetworkDNSUpdating = "NetworkDNSUpdating", + /** NetworkDNSUpdateComplete */ + NetworkDNSUpdateComplete = "NetworkDNSUpdateComplete", + /** NetworkDNSUpdateFailed */ + NetworkDNSUpdateFailed = "NetworkDNSUpdateFailed", + /** ArcGatewayUpdatePreparing */ + ArcGatewayUpdatePreparing = "ArcGatewayUpdatePreparing", + /** ArcGatewayUpdating */ + ArcGatewayUpdating = "ArcGatewayUpdating", + /** ArcGatewayUpdateComplete */ + ArcGatewayUpdateComplete = "ArcGatewayUpdateComplete", + /** ArcGatewayUpdateFailed */ + ArcGatewayUpdateFailed = "ArcGatewayUpdateFailed", +} + +/** + * Appliance’s health and state of connection to on-prem. This list of values is not exhaustive. \ + * {@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** \ + * **ETCDSnapshotFailed** \ + * **UpgradePrerequisitesCompleted** \ + * **ValidatingSFSConnectivity** \ + * **ValidatingImageDownload** \ + * **ValidatingImageUpload** \ + * **ValidatingETCDHealth** \ + * **PreUpgrade** \ + * **UpgradingKVAIO** \ + * **WaitingForKVAIO** \ + * **ImagePending** \ + * **ImageProvisioning** \ + * **ImageProvisioned** \ + * **ImageDownloading** \ + * **ImageDownloaded** \ + * **ImageDeprovisioning** \ + * **ImageUnknown** \ + * **UpdatingCloudOperator** \ + * **WaitingForCloudOperator** \ + * **UpdatingCAPI** \ + * **UpdatingCluster** \ + * **PostUpgrade** \ + * **UpgradeComplete** \ + * **UpgradeClusterExtensionFailedToDelete** \ + * **UpgradeFailed** \ + * **Offline** \ + * **None** \ + * **NetworkProxyUpdatePreparing** \ + * **NetworkProxyUpdating** \ + * **NetworkProxyUpdateComplete** \ + * **NetworkProxyUpdateFailed** \ + * **NetworkDNSUpdatePreparing** \ + * **NetworkDNSUpdating** \ + * **NetworkDNSUpdateComplete** \ + * **NetworkDNSUpdateFailed** \ + * **ArcGatewayUpdatePreparing** \ + * **ArcGatewayUpdating** \ + * **ArcGatewayUpdateComplete** \ + * **ArcGatewayUpdateFailed** + */ +export type Status = string; + +export function eventArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return eventDeserializer(item); + }); +} + +/** Event contains information about customer driven, platform driven, or unplanned events that occurred on the Appliance */ +export interface Event { + /** The type of event is used to classify how the event was initiated. */ + type?: string; + /** Code is used to break down the event further to identify why it occurred. */ + code?: string; + /** Status is used to represent the outcome of the event. */ + status?: string; + /** Message is intended to be actionable and should be used to inform the user of the event. */ + message?: string; + /** Severity is the classification of the event to relay the importance of the event. */ + severity?: string; + /** Timestamp is the time the event occurred. */ + timestamp?: Date; +} + +export function eventDeserializer(item: any): Event { + return { + type: item["type"], + code: item["code"], + status: item["status"], + message: item["message"], + severity: item["severity"], + timestamp: !item["timestamp"] ? item["timestamp"] : new Date(item["timestamp"]), + }; +} + +/** Contains network information about the Appliance */ +export interface NetworkProfile { + /** Contains proxy information about the Appliance */ + proxyConfiguration?: ProxyConfiguration; + /** Contains DNS information about the Appliance */ + dnsConfiguration?: DnsConfiguration; + /** Contains Arc Gateway information about the Appliance */ + gatewayConfiguration?: GatewayConfiguration; +} + +export function networkProfileSerializer(item: NetworkProfile): any { + return { + proxyConfiguration: !item["proxyConfiguration"] + ? item["proxyConfiguration"] + : proxyConfigurationSerializer(item["proxyConfiguration"]), + dnsConfiguration: !item["dnsConfiguration"] + ? item["dnsConfiguration"] + : dnsConfigurationSerializer(item["dnsConfiguration"]), + gatewayConfiguration: !item["gatewayConfiguration"] + ? item["gatewayConfiguration"] + : gatewayConfigurationSerializer(item["gatewayConfiguration"]), + }; +} + +export function networkProfileDeserializer(item: any): NetworkProfile { + return { + proxyConfiguration: !item["proxyConfiguration"] + ? item["proxyConfiguration"] + : proxyConfigurationDeserializer(item["proxyConfiguration"]), + dnsConfiguration: !item["dnsConfiguration"] + ? item["dnsConfiguration"] + : dnsConfigurationDeserializer(item["dnsConfiguration"]), + gatewayConfiguration: !item["gatewayConfiguration"] + ? item["gatewayConfiguration"] + : gatewayConfigurationDeserializer(item["gatewayConfiguration"]), + }; +} + +/** Contains proxy information about the Appliance */ +export interface ProxyConfiguration { + /** Version of the proxy configuration. */ + version?: string; +} + +export function proxyConfigurationSerializer(item: ProxyConfiguration): any { + return { version: item["version"] }; +} + +export function proxyConfigurationDeserializer(item: any): ProxyConfiguration { + return { + version: item["version"], + }; +} + +/** Contains DNS information about the Appliance */ +export interface DnsConfiguration { + /** Version of the DNS configuration. */ + version?: string; +} + +export function dnsConfigurationSerializer(item: DnsConfiguration): any { + return { version: item["version"] }; +} + +export function dnsConfigurationDeserializer(item: any): DnsConfiguration { + return { + version: item["version"], + }; +} + +/** Contains Arc Gateway information about the Appliance */ +export interface GatewayConfiguration { + /** Version of the Arc Gateway configuration. */ + version?: string; +} + +export function gatewayConfigurationSerializer(item: GatewayConfiguration): any { + return { version: item["version"] }; +} + +export function gatewayConfigurationDeserializer(item: any): GatewayConfiguration { + return { + version: item["version"], + }; +} + +/** Identity for the resource. */ +export interface Identity { + /** The principal ID of resource identity. */ + readonly principalId?: string; + /** The tenant ID of resource. */ + readonly tenantId?: string; + /** The identity type. */ + type?: ResourceIdentityType; +} + +export function identitySerializer(item: Identity): any { + return { type: item["type"] }; +} + +export function identityDeserializer(item: any): Identity { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + }; +} + +/** The identity type. */ +export enum KnownResourceIdentityType { + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** None */ + None = "None", +} + +/** + * The identity type. \ + * {@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; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** 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} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@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**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: any; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: item["info"], + }; +} + +/** The Appliances patchable resource definition. */ +export interface PatchableAppliance { + /** Resource tags */ + tags?: Record; +} + +export function patchableApplianceSerializer(item: PatchableAppliance): any { + return { tags: item["tags"] }; +} + +/** Paged collection of Appliance items */ +export interface _ApplianceListResult { + /** The Appliance items on this page */ + readonly value: Appliance[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _applianceListResultDeserializer(item: any): _ApplianceListResult { + return { + value: applianceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function applianceArraySerializer(result: Array): any[] { + return result.map((item) => { + return applianceSerializer(item); + }); +} + +export function applianceArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return applianceDeserializer(item); + }); +} + +/** The List Cluster User Credential appliance. */ +export interface ApplianceListCredentialResults { + /** Contains the REP (rendezvous endpoint) and “Listener” access token from notification service (NS). */ + readonly hybridConnectionConfig?: HybridConnectionConfig; + /** The list of appliance kubeconfigs. */ + readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; +} + +export function applianceListCredentialResultsDeserializer( + item: any, +): ApplianceListCredentialResults { + return { + hybridConnectionConfig: !item["hybridConnectionConfig"] + ? item["hybridConnectionConfig"] + : hybridConnectionConfigDeserializer(item["hybridConnectionConfig"]), + kubeconfigs: !item["kubeconfigs"] + ? item["kubeconfigs"] + : applianceCredentialKubeconfigArrayDeserializer(item["kubeconfigs"]), + }; +} + +/** Contains the REP (rendezvous endpoint) and “Listener” access token from notification service (NS). */ +export interface HybridConnectionConfig { + /** Timestamp when this token will be expired. */ + readonly expirationTime?: number; + /** Name of the connection */ + readonly hybridConnectionName?: string; + /** Name of the notification service. */ + readonly relay?: string; + /** Listener access token */ + readonly token?: string; +} + +export function hybridConnectionConfigDeserializer(item: any): HybridConnectionConfig { + return { + expirationTime: item["expirationTime"], + hybridConnectionName: item["hybridConnectionName"], + relay: item["relay"], + token: item["token"], + }; +} + +export function applianceCredentialKubeconfigArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return applianceCredentialKubeconfigDeserializer(item); + }); +} + +/** Cluster User Credential appliance. */ +export interface ApplianceCredentialKubeconfig { + /** Name which contains the role of the kubeconfig. */ + readonly name?: AccessProfileType; + /** Contains the kubeconfig value. */ + readonly value?: string; +} + +export function applianceCredentialKubeconfigDeserializer( + item: any, +): ApplianceCredentialKubeconfig { + return { + name: item["name"], + value: item["value"], + }; +} + +/** Name which contains the role of the kubeconfig. */ +export enum KnownAccessProfileType { + /** clusterUser */ + ClusterUser = "clusterUser", + /** clusterCustomerUser */ + ClusterCustomerUser = "clusterCustomerUser", +} + +/** + * Name which contains the role of the kubeconfig. \ + * {@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; + +/** The List Cluster Keys Results appliance. */ +export interface ApplianceListKeysResults { + /** Map of artifacts that contains a list of ArtifactProfile used to upload artifacts such as logs. */ + readonly artifactProfiles?: Record; + /** The list of appliance kubeconfigs. */ + readonly kubeconfigs?: ApplianceCredentialKubeconfig[]; + /** Map of Customer User Public, Private SSH Keys and Certificate when available. */ + readonly sshKeys?: Record; +} + +export function applianceListKeysResultsDeserializer(item: any): ApplianceListKeysResults { + return { + artifactProfiles: !item["artifactProfiles"] + ? item["artifactProfiles"] + : artifactProfileRecordDeserializer(item["artifactProfiles"]), + kubeconfigs: !item["kubeconfigs"] + ? item["kubeconfigs"] + : applianceCredentialKubeconfigArrayDeserializer(item["kubeconfigs"]), + sshKeys: !item["sshKeys"] ? item["sshKeys"] : sshKeyRecordDeserializer(item["sshKeys"]), + }; +} + +export function artifactProfileRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : artifactProfileDeserializer(item[key]); + }); + return result; +} + +/** Appliance ArtifactProfile definition. */ +export interface ArtifactProfile { + /** Endpoint is the URL to upload artifacts to. */ + readonly endpoint?: string; +} + +export function artifactProfileDeserializer(item: any): ArtifactProfile { + return { + endpoint: item["endpoint"], + }; +} + +export function sshKeyRecordDeserializer(item: Record): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : sshKeyDeserializer(item[key]); + }); + return result; +} + +/** Appliance SSHKey definition. */ +export interface SSHKey { + /** Certificate associated with the public key if the key is signed. */ + readonly certificate?: string; + /** Certificate creation timestamp (Unix). */ + readonly creationTimeStamp?: number; + /** Certificate expiration timestamp (Unix). */ + readonly expirationTimeStamp?: number; + /** Private Key. */ + readonly privateKey?: string; + /** Public Key. */ + readonly publicKey?: string; +} + +export function sshKeyDeserializer(item: any): SSHKey { + return { + certificate: item["certificate"], + creationTimeStamp: item["creationTimeStamp"], + expirationTimeStamp: item["expirationTimeStamp"], + privateKey: item["privateKey"], + publicKey: item["publicKey"], + }; +} + +/** The Upgrade Graph for appliance. */ +export interface UpgradeGraph { + /** The appliance resource path */ + readonly id?: string; + /** The release train name. */ + readonly name?: string; + /** The properties of supported version */ + properties?: UpgradeGraphProperties; +} + +export function upgradeGraphDeserializer(item: any): UpgradeGraph { + return { + id: item["id"], + name: item["name"], + properties: !item["properties"] + ? item["properties"] + : upgradeGraphPropertiesDeserializer(item["properties"]), + }; +} + +/** The Upgrade Graph Properties for appliance. */ +export interface UpgradeGraphProperties { + /** The current appliance version */ + readonly applianceVersion?: string; + /** This contains the current version and supported upgrade versions. */ + readonly supportedVersions?: SupportedVersion[]; +} + +export function upgradeGraphPropertiesDeserializer(item: any): UpgradeGraphProperties { + return { + applianceVersion: item["applianceVersion"], + supportedVersions: !item["supportedVersions"] + ? item["supportedVersions"] + : supportedVersionArrayDeserializer(item["supportedVersions"]), + }; +} + +export function supportedVersionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return supportedVersionDeserializer(item); + }); +} + +/** The SupportedVersion object for appliance. */ +export interface SupportedVersion { + /** This is the metadata of the supported newer version. */ + readonly metadata?: SupportedVersionMetadata; + /** The newer version available for upgrade. */ + readonly version?: string; +} + +export function supportedVersionDeserializer(item: any): SupportedVersion { + return { + metadata: !item["metadata"] + ? item["metadata"] + : supportedVersionMetadataDeserializer(item["metadata"]), + version: item["version"], + }; +} + +/** The SupportedVersionMetadata object for appliance. */ +export interface SupportedVersionMetadata { + /** The newer supported version catalog version. */ + readonly catalogVersion?: SupportedVersionCatalogVersion; +} + +export function supportedVersionMetadataDeserializer(item: any): SupportedVersionMetadata { + return { + catalogVersion: !item["catalogVersion"] + ? item["catalogVersion"] + : supportedVersionCatalogVersionDeserializer(item["catalogVersion"]), + }; +} + +/** The SupportedVersionCatalogVersion object for appliance. */ +export interface SupportedVersionCatalogVersion { + /** The newer supported version catalog version data. */ + readonly data?: SupportedVersionCatalogVersionData; + /** The catalog version name for the version available for upgrade. */ + readonly name?: string; + /** The catalog version namespace for the version available for upgrade. */ + readonly namespace?: string; +} + +export function supportedVersionCatalogVersionDeserializer( + item: any, +): SupportedVersionCatalogVersion { + return { + data: !item["data"] + ? item["data"] + : supportedVersionCatalogVersionDataDeserializer(item["data"]), + name: item["name"], + namespace: item["namespace"], + }; +} + +/** The SupportedVersionCatalogVersionData object for appliance. */ +export interface SupportedVersionCatalogVersionData { + /** The image audience name for the version available for upgrade. */ + readonly audience?: string; + /** The image catalog name for the version available for upgrade. */ + readonly catalog?: string; + /** The image offer name for the version available for upgrade. */ + readonly offer?: string; + /** The image version for the version available for upgrade. */ + readonly version?: string; +} + +export function supportedVersionCatalogVersionDataDeserializer( + item: any, +): SupportedVersionCatalogVersionData { + return { + audience: item["audience"], + catalog: item["catalog"], + offer: item["offer"], + version: item["version"], + }; +} + +/** Paged collection of ApplianceOperation items */ +export interface _ApplianceOperationsList { + /** The ApplianceOperation items on this page */ + value: ApplianceOperation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _applianceOperationsListDeserializer(item: any): _ApplianceOperationsList { + return { + value: applianceOperationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function applianceOperationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return applianceOperationDeserializer(item); + }); +} + +/** Appliances operation. */ +export interface ApplianceOperation { + /** Describes the properties of an Appliances Operation Value Display. */ + display?: ApplianceOperationValueDisplay; + /** Is this Operation a data plane operation */ + readonly isDataAction?: boolean; + /** The name of the compute operation. */ + readonly name?: string; + /** The origin of the compute operation. */ + readonly origin?: string; +} + +export function applianceOperationDeserializer(item: any): ApplianceOperation { + return { + display: !item["display"] + ? item["display"] + : applianceOperationValueDisplayDeserializer(item["display"]), + isDataAction: item["isDataAction"], + name: item["name"], + origin: item["origin"], + }; +} + +/** Describes the properties of an Appliances Operation Value Display. */ +export interface ApplianceOperationValueDisplay { + /** The description of the operation. */ + readonly description?: string; + /** The display name of the compute operation. */ + readonly operation?: string; + /** The resource provider for the operation. */ + readonly provider?: string; + /** The display name of the resource the operation applies to. */ + readonly resource?: string; +} + +export function applianceOperationValueDisplayDeserializer( + item: any, +): ApplianceOperationValueDisplay { + return { + description: item["description"], + operation: item["operation"], + provider: item["provider"], + resource: item["resource"], + }; +} + +/** The Get Telemetry Config Result appliance. */ +export interface ApplianceGetTelemetryConfigResult { + /** Telemetry instrumentation key. */ + readonly telemetryInstrumentationKey?: string; +} + +export function applianceGetTelemetryConfigResultDeserializer( + item: any, +): ApplianceGetTelemetryConfigResult { + return { + telemetryInstrumentationKey: item["telemetryInstrumentationKey"], + }; +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2022-10-27 API version. */ + V20221027 = "2022-10-27", + /** The 2025-03-01-preview API version. */ + V20250301Preview = "2025-03-01-preview", +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/models/parameters.ts b/sdk/resourceconnector/arm-resourceconnector/src/models/parameters.ts deleted file mode 100644 index 70a9f4d6764c..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/src/models/parameters.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - OperationParameter, - OperationURLParameter, - OperationQueryParameter -} from "@azure/core-client"; -import { - Appliance as ApplianceMapper, - PatchableAppliance as PatchableApplianceMapper -} from "../models/mappers.js"; - -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-10-27", - 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 deleted file mode 100644 index f1d6c1a852b1..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/src/operations/appliances.ts +++ /dev/null @@ -1,916 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Appliances } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { ResourceConnectorManagementClient } from "../resourceConnectorManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - ApplianceOperation, - AppliancesListOperationsNextOptionalParams, - AppliancesListOperationsOptionalParams, - AppliancesListOperationsResponse, - Appliance, - AppliancesListBySubscriptionNextOptionalParams, - AppliancesListBySubscriptionOptionalParams, - AppliancesListBySubscriptionResponse, - AppliancesListByResourceGroupNextOptionalParams, - AppliancesListByResourceGroupOptionalParams, - AppliancesListByResourceGroupResponse, - AppliancesGetTelemetryConfigOptionalParams, - AppliancesGetTelemetryConfigResponse, - AppliancesGetOptionalParams, - AppliancesGetResponse, - AppliancesCreateOrUpdateOptionalParams, - AppliancesCreateOrUpdateResponse, - AppliancesDeleteOptionalParams, - AppliancesUpdateOptionalParams, - AppliancesUpdateResponse, - AppliancesListClusterUserCredentialOptionalParams, - AppliancesListClusterUserCredentialResponse, - AppliancesListKeysOptionalParams, - AppliancesListKeysResponse, - AppliancesGetUpgradeGraphOptionalParams, - AppliancesGetUpgradeGraphResponse, - AppliancesListOperationsNextResponse, - AppliancesListBySubscriptionNextResponse, - AppliancesListByResourceGroupNextResponse -} from "../models/index.js"; - -/// -/** 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: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listOperationsPagingPage(options, settings); - } - }; - } - - private async *listOperationsPagingPage( - options?: AppliancesListOperationsOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: AppliancesListOperationsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listOperations(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listOperationsNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - 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: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listBySubscriptionPagingPage(options, settings); - } - }; - } - - private async *listBySubscriptionPagingPage( - options?: AppliancesListBySubscriptionOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: AppliancesListBySubscriptionResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listBySubscription(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listBySubscriptionNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - 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: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage( - resourceGroupName, - options, - settings - ); - } - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: AppliancesListByResourceGroupOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: AppliancesListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext( - resourceGroupName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - 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 the telemetry config. - * @param options The options parameters. - */ - getTelemetryConfig( - options?: AppliancesGetTelemetryConfigOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { options }, - getTelemetryConfigOperationSpec - ); - } - - /** - * 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< - SimplePollerLike< - OperationState, - AppliancesCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, resourceName, parameters, options }, - spec: createOrUpdateOperationSpec - }); - const poller = await createHttpPoller< - AppliancesCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "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 sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, resourceName, options }, - spec: deleteOperationSpec - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "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 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 - ); - } - - /** - * Returns the cluster customer 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. - */ - listKeys( - resourceGroupName: string, - resourceName: string, - options?: AppliancesListKeysOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - listKeysOperationSpec - ); - } - - /** - * 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 getTelemetryConfigOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/telemetryconfig", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ApplianceGetTelemetryConfigResult - }, - 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 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 listKeysOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}/listkeys", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.ApplianceListKeysResults - }, - 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 - } - }, - 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 - } - }, - 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 - } - }, - 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 deleted file mode 100644 index 39b1e462f938..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/src/operations/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./appliances.js"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/appliances.ts b/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/appliances.ts deleted file mode 100644 index 88a9784a8328..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/appliances.ts +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - ApplianceOperation, - AppliancesListOperationsOptionalParams, - Appliance, - AppliancesListBySubscriptionOptionalParams, - AppliancesListByResourceGroupOptionalParams, - AppliancesGetTelemetryConfigOptionalParams, - AppliancesGetTelemetryConfigResponse, - AppliancesGetOptionalParams, - AppliancesGetResponse, - AppliancesCreateOrUpdateOptionalParams, - AppliancesCreateOrUpdateResponse, - AppliancesDeleteOptionalParams, - AppliancesUpdateOptionalParams, - AppliancesUpdateResponse, - AppliancesListClusterUserCredentialOptionalParams, - AppliancesListClusterUserCredentialResponse, - AppliancesListKeysOptionalParams, - AppliancesListKeysResponse, - AppliancesGetUpgradeGraphOptionalParams, - AppliancesGetUpgradeGraphResponse -} from "../models/index.js"; - -/// -/** 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 telemetry config. - * @param options The options parameters. - */ - getTelemetryConfig( - options?: AppliancesGetTelemetryConfigOptionalParams - ): Promise; - /** - * 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< - SimplePollerLike< - OperationState, - 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 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; - /** - * Returns the cluster customer 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. - */ - listKeys( - resourceGroupName: string, - resourceName: string, - options?: AppliancesListKeysOptionalParams - ): 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 deleted file mode 100644 index 39b1e462f938..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./appliances.js"; diff --git a/sdk/resourceconnector/arm-resourceconnector/src/pagingHelper.ts b/sdk/resourceconnector/arm-resourceconnector/src/pagingHelper.ts deleted file mode 100644 index 269a2b9814b5..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/src/pagingHelper.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/resourceConnectorManagementClient.ts b/sdk/resourceconnector/arm-resourceconnector/src/resourceConnectorManagementClient.ts index 5dd29100fec9..054016d17e48 100644 --- a/sdk/resourceconnector/arm-resourceconnector/src/resourceConnectorManagementClient.ts +++ b/sdk/resourceconnector/arm-resourceconnector/src/resourceConnectorManagementClient.ts @@ -1,156 +1,41 @@ -/* - * 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/index.js"; -import { Appliances } from "./operationsInterfaces/index.js"; -import { ResourceConnectorManagementClientOptionalParams } from "./models/index.js"; - -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 - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + ResourceConnectorManagementContext, + ResourceConnectorManagementClientOptionalParams, +} from "./api/index.js"; +import { createResourceConnectorManagement } from "./api/index.js"; +import type { AppliancesOperations } from "./classic/appliances/index.js"; +import { _getAppliancesOperations } from "./classic/appliances/index.js"; +import type { TokenCredential } from "@azure/core-auth"; +import type { Pipeline } from "@azure/core-rest-pipeline"; + +export { ResourceConnectorManagementClientOptionalParams } from "./api/resourceConnectorManagementContext.js"; + +export class ResourceConnectorManagementClient { + private _client: ResourceConnectorManagementContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** The appliances Rest API spec. */ constructor( - credentials: coreAuth.TokenCredential, + credential: TokenCredential, subscriptionId: string, - options?: ResourceConnectorManagementClientOptionalParams - ); - constructor( - credentials: coreAuth.TokenCredential, - options?: ResourceConnectorManagementClientOptionalParams - ); - constructor( - credentials: coreAuth.TokenCredential, - subscriptionIdOrOptions?: - | ResourceConnectorManagementClientOptionalParams - | string, - options?: ResourceConnectorManagementClientOptionalParams + options: ResourceConnectorManagementClientOptionalParams = {}, ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } - - let subscriptionId: string | undefined; - - if (typeof subscriptionIdOrOptions === "string") { - subscriptionId = subscriptionIdOrOptions; - } else if (typeof subscriptionIdOrOptions === "object") { - options = subscriptionIdOrOptions; - } - - // 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`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createResourceConnectorManagement(credential, subscriptionId, { ...options, - userAgentOptions: { - userAgentPrefix - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com" - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.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-10-27"; - 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 "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - } - }; - this.pipeline.addPolicy(apiVersionPolicy); + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.appliances = _getAppliancesOperations(this._client); } - appliances: Appliances; + /** The operation groups for appliances */ + public readonly appliances: AppliancesOperations; } diff --git a/sdk/resourceconnector/arm-resourceconnector/src/restorePollerHelpers.ts b/sdk/resourceconnector/arm-resourceconnector/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..dfd6ef2f5d0a --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/restorePollerHelpers.ts @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ResourceConnectorManagementClient } from "./resourceConnectorManagementClient.js"; +import { _$deleteDeserialize, _createOrUpdateDeserialize } from "./api/appliances/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import type { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { PollerLike, OperationState, ResourceLocationConfig } from "@azure/core-lro"; +import { deserializeState } from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: ResourceConnectorManagementClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: (result: PathUncheckedResponse) => Promise; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}": + { + deserializer: _$deleteDeserialize, + expectedStatuses: ["202", "204", "200", "201"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}": + { + deserializer: _createOrUpdateDeserialize, + expectedStatuses: ["200", "201", "202"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/cloudSettingHelpers.ts b/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 000000000000..613112c6e397 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * An enum to describe Azure Cloud environments. + * @enum {string} + */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT", +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +/** + * Gets the Azure Resource Manager endpoint URL for the specified cloud setting. + * @param cloudSetting - The Azure cloud environment setting. Use one of the AzureClouds enum values. + * @returns The ARM endpoint URL for the specified cloud, or undefined if cloudSetting is undefined. + * @throws {Error} Throws an error if an unknown cloud setting is provided. + */ +export function getArmEndpoint(cloudSetting?: AzureSupportedClouds): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/", + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.`, + ); + } +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/pagingHelpers.ts b/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..6f219e3c88cf --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; + nextLinkMethod?: "GET" | "POST"; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const nextLinkMethod = options.nextLinkMethod ?? "GET"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : nextLinkMethod === "POST" + ? await client.pathUnchecked(pageLink).post() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/pollingHelpers.ts b/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..63b3c201e5a8 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + OperationResponse, +} from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/urlTemplate.ts b/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..c7109898692a --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/src/static-helpers/urlTemplate.ts @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// --------------------- +// interfaces +// --------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string): string { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string): string { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string): string { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any): boolean { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false): string { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions): string { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + if (named && val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions): string | undefined { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + const result = template.replace(/\{([^{}]+)\}|([^{}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + op = expr[0]; + expr = expr.slice(1); + } + const varList = expr.split(/,/g); + const result = []; + for (const varSpec of varList) { + const varMatch = /([^:*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: result.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + result.push(varValue); + } + } + return result.join(""); + }); + + return normalizeUnreserved(result); +} + +/** + * Normalize an expanded URI by decoding percent-encoded unreserved characters. + * RFC 3986 unreserved: "-" / "." / "~" + */ +function normalizeUnreserved(uri: string): string { + return uri.replace(/%([0-9A-Fa-f]{2})/g, (match, hex) => { + const char = String.fromCharCode(parseInt(hex, 16)); + // Decode only if it's unreserved + if (/[\-.~]/.test(char)) { + return char; + } + return match; // leave other encodings intact + }); +} diff --git a/sdk/resourceconnector/arm-resourceconnector/test/public/sampleTest.spec.ts b/sdk/resourceconnector/arm-resourceconnector/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..19cf10ee4956 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/test/public/sampleTest.spec.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// import { Recorder } from "@azure-tools/test-recorder"; +// import { createRecorder } from "./utils/recordedClient.js"; +import { + assert, + // beforeEach, + // afterEach, + it, + describe, +} from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + // beforeEach(async function(ctx) { + // recorder = await createRecorder(ctx); + // }); + + // afterEach(async function() { + // await recorder.stop(); + // ); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/resourceconnector/arm-resourceconnector/test/public/utils/recordedClient.ts b/sdk/resourceconnector/arm-resourceconnector/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..285e4643c45e --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/test/public/utils/recordedClient.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; +import { Recorder } from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder(context: VitestTestContext): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/sdk/resourceconnector/arm-resourceconnector/test/resourceconnnector__operations_test.spec.ts b/sdk/resourceconnector/arm-resourceconnector/test/resourceconnnector__operations_test.spec.ts deleted file mode 100644 index b009f848dab3..000000000000 --- a/sdk/resourceconnector/arm-resourceconnector/test/resourceconnnector__operations_test.spec.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { env, Recorder, RecorderStartOptions, isPlaybackMode } from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { ResourceConnectorManagementClient } from "../src/resourceConnectorManagementClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -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, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - "AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section - ], -}; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("ResourceConnector test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: ResourceConnectorManagementClient; - let location: string; - let resourceGroup: string; - let resourcename: string; - - beforeEach(async (ctx) => { - recorder = new Recorder(ctx); - await recorder.start(recorderOptions); - subscriptionId = env.SUBSCRIPTION_ID || ""; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new ResourceConnectorManagementClient( - credential, - subscriptionId, - recorder.configureClientOptions({}), - ); - location = "eastus"; - resourceGroup = "czwjstest"; - resourcename = "resourcetest"; - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("appliances create test", async () => { - const res = await client.appliances.beginCreateOrUpdateAndWait( - resourceGroup, - resourcename, - { - identity: { type: "SystemAssigned" }, - distro: "AKSEdge", - infrastructureConfig: { provider: "VMWare" }, - location, - }, - testPollingOptions, - ); - assert.equal(res.name, resourcename); - }); - - it("appliances get test", async () => { - const res = await client.appliances.get(resourceGroup, resourcename); - assert.equal(res.name, resourcename); - }); - - it("appliances list test", async () => { - const resArray = new Array(); - for await (let item of client.appliances.listByResourceGroup(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("appliances delete test", async () => { - const resArray = new Array(); - await client.appliances.beginDeleteAndWait(resourceGroup, resourcename, testPollingOptions); - for await (let item of client.appliances.listByResourceGroup(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); -}); diff --git a/sdk/resourceconnector/arm-resourceconnector/test/snippets.spec.ts b/sdk/resourceconnector/arm-resourceconnector/test/snippets.spec.ts index 2b816032497c..9dc0bdcd12ed 100644 --- a/sdk/resourceconnector/arm-resourceconnector/test/snippets.spec.ts +++ b/sdk/resourceconnector/arm-resourceconnector/test/snippets.spec.ts @@ -16,11 +16,11 @@ describe("snippets", () => { }); it("ReadmeSampleCreateClient_Browser", async () => { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new ResourceConnectorManagementClient(credential, subscriptionId); }); diff --git a/sdk/resourceconnector/arm-resourceconnector/tsconfig.json b/sdk/resourceconnector/arm-resourceconnector/tsconfig.json index d466f1460665..0e57dbd186e5 100644 --- a/sdk/resourceconnector/arm-resourceconnector/tsconfig.json +++ b/sdk/resourceconnector/arm-resourceconnector/tsconfig.json @@ -12,6 +12,5 @@ { "path": "./tsconfig.snippets.json" } - ], - "files": [] + ] } diff --git a/sdk/resourceconnector/arm-resourceconnector/tsconfig.samples.json b/sdk/resourceconnector/arm-resourceconnector/tsconfig.samples.json index 2abb55b19c03..008ae2883210 100644 --- a/sdk/resourceconnector/arm-resourceconnector/tsconfig.samples.json +++ b/sdk/resourceconnector/arm-resourceconnector/tsconfig.samples.json @@ -2,9 +2,7 @@ "extends": "../../../tsconfig.samples.base.json", "compilerOptions": { "paths": { - "@azure/arm-resourceconnector": [ - "./dist/esm" - ] + "@azure/arm-resourceconnector": ["./dist/esm"] } } } diff --git a/sdk/resourceconnector/arm-resourceconnector/tsp-location.yaml b/sdk/resourceconnector/arm-resourceconnector/tsp-location.yaml new file mode 100644 index 000000000000..af1efb73b233 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/ResourceConnector +commit: e96c24570a484cff13d153fb472f812878866a39 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourceconnector/arm-resourceconnector/vitest.config.ts b/sdk/resourceconnector/arm-resourceconnector/vitest.config.ts index cc5cd85d4131..0dfa15cc4498 100644 --- a/sdk/resourceconnector/arm-resourceconnector/vitest.config.ts +++ b/sdk/resourceconnector/arm-resourceconnector/vitest.config.ts @@ -1,4 +1,3 @@ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/sdk/resourceconnector/arm-resourceconnector/vitest.esm.config.ts b/sdk/resourceconnector/arm-resourceconnector/vitest.esm.config.ts new file mode 100644 index 000000000000..5e9735e9b144 --- /dev/null +++ b/sdk/resourceconnector/arm-resourceconnector/vitest.esm.config.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { mergeConfig } from "vitest/config"; +import vitestConfig from "./vitest.config.ts"; +import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; + +export default mergeConfig(vitestConfig, vitestEsmConfig); diff --git a/sdk/resourceconnector/ci.mgmt.yml b/sdk/resourceconnector/ci.mgmt.yml index c21468300aba..0f219ab9f4ff 100644 --- a/sdk/resourceconnector/ci.mgmt.yml +++ b/sdk/resourceconnector/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,7 +13,6 @@ trigger: include: - sdk/resourceconnector/arm-resourceconnector - sdk/resourceconnector/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/resourceconnector/arm-resourceconnector - sdk/resourceconnector/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-resourceconnector safeName: azurearmresourceconnector - \ No newline at end of file