From c2f77d18682f80ff6678671cb3d50e046a6dd360 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 10 Apr 2025 22:22:27 +0000 Subject: [PATCH] CodeGen from PR 33838 in Azure/azure-rest-api-specs Merge 4535c5e6496038f9201fc8efb646a0f72f52d8b0 into afe8ef87df6112dc9db1248b61e46b8ac7f3a709 --- common/config/rush/pnpm-lock.yaml | 45 +- rush.json | 18 +- .../LICENSE | 21 + .../README.md | 23 + .../api-extractor.json | 18 + .../package.json | 50 + .../rollup.config.js | 117 + ...rofileOperationsGenerateUpdateRunSample.ts | 30 + ...autoUpgradeProfilesCreateOrUpdateSample.ts | 66 + .../autoUpgradeProfilesDeleteSample.ts | 53 + .../autoUpgradeProfilesGetSample.ts | 54 + .../autoUpgradeProfilesListByFleetSample.ts | 60 + .../samples-dev/fleetMembersCreateSample.ts | 63 + .../samples-dev/fleetMembersDeleteSample.ts | 46 + .../samples-dev/fleetMembersGetSample.ts | 46 + .../fleetMembersListByFleetSample.ts | 57 + .../fleetMembersUpdateAsyncSample.ts | 57 + ...eetUpdateStrategiesCreateOrUpdateSample.ts | 81 + .../fleetUpdateStrategiesDeleteSample.ts | 46 + .../fleetUpdateStrategiesGetSample.ts | 54 + .../fleetUpdateStrategiesListByFleetSample.ts | 60 + .../samples-dev/fleetsCreateSample.ts | 80 + .../samples-dev/fleetsDeleteSample.ts | 46 + .../samples-dev/fleetsGetSample.ts | 46 + .../fleetsListByResourceGroupSample.ts | 54 + .../fleetsListBySubscriptionSample.ts | 54 + .../fleetsListCredentialsSample.ts | 46 + .../samples-dev/fleetsUpdateAsyncSample.ts | 59 + .../samples-dev/operationsListSample.ts | 77 + .../updateRunsCreateOrUpdateSample.ts | 99 + .../samples-dev/updateRunsDeleteSample.ts | 46 + .../samples-dev/updateRunsGetSample.ts | 46 + .../updateRunsListByFleetSample.ts | 57 + .../samples-dev/updateRunsSkipSample.ts | 62 + .../samples-dev/updateRunsStartSample.ts | 48 + .../samples-dev/updateRunsStopSample.ts | 48 + .../api/autoUpgradeProfileOperations/index.ts | 4 + .../operations.ts | 89 + .../autoUpgradeProfileOperations/options.ts | 10 + .../src/api/autoUpgradeProfiles/index.ts | 9 + .../src/api/autoUpgradeProfiles/operations.ts | 326 +++ .../src/api/autoUpgradeProfiles/options.ts | 31 + .../src/api/containerServiceContext.ts | 69 + .../src/api/fleetMembers/index.ts | 16 + .../src/api/fleetMembers/operations.ts | 390 ++++ .../src/api/fleetMembers/options.ts | 37 + .../src/api/fleetUpdateStrategies/index.ts | 9 + .../api/fleetUpdateStrategies/operations.ts | 326 +++ .../src/api/fleetUpdateStrategies/options.ts | 31 + .../src/api/fleets/index.ts | 20 + .../src/api/fleets/operations.ts | 469 ++++ .../src/api/fleets/options.ts | 43 + .../src/api/index.ts | 7 + .../src/api/operations/index.ts | 4 + .../src/api/operations/operations.ts | 72 + .../src/api/operations/options.ts | 6 + .../src/api/updateRuns/index.ts | 20 + .../src/api/updateRuns/operations.ts | 520 +++++ .../src/api/updateRuns/options.ts | 52 + .../autoUpgradeProfileOperations/index.ts | 42 + .../src/classic/autoUpgradeProfiles/index.ts | 116 + .../src/classic/fleetMembers/index.ts | 125 ++ .../classic/fleetUpdateStrategies/index.ts | 110 + .../src/classic/fleets/index.ts | 124 ++ .../src/classic/index.ts | 9 + .../src/classic/operations/index.ts | 29 + .../src/classic/updateRuns/index.ts | 147 ++ .../src/containerServiceClient.ts | 86 + .../src/index.ts | 144 ++ .../src/models/index.ts | 86 + .../src/models/models.ts | 1942 +++++++++++++++++ .../src/restorePollerHelpers.ts | 244 +++ .../src/static-helpers/pagingHelpers.ts | 273 +++ .../src/static-helpers/pollingHelpers.ts | 136 ++ .../src/static-helpers/urlTemplate.ts | 199 ++ .../tsconfig.json | 26 + .../tsp-location.yaml | 4 + 77 files changed, 8324 insertions(+), 11 deletions(-) create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/LICENSE create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/README.md create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/api-extractor.json create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/package.json create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/rollup.config.js create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfileOperationsGenerateUpdateRunSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesCreateOrUpdateSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesDeleteSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesGetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesListByFleetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersCreateSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersDeleteSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersGetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersListByFleetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersUpdateAsyncSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesCreateOrUpdateSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesDeleteSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesGetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesListByFleetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsCreateSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsDeleteSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsGetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListByResourceGroupSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListBySubscriptionSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListCredentialsSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsUpdateAsyncSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/operationsListSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsCreateOrUpdateSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsDeleteSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsGetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsListByFleetSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsSkipSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsStartSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsStopSample.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/operations.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/options.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/operations.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/options.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/containerServiceContext.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/operations.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/options.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/operations.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/options.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/operations.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/options.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/operations.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/options.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/operations.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/options.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/autoUpgradeProfileOperations/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/autoUpgradeProfiles/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleetMembers/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleetUpdateStrategies/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleets/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/operations/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/updateRuns/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/containerServiceClient.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/models/index.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/models/models.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/restorePollerHelpers.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/pagingHelpers.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/pollingHelpers.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/urlTemplate.ts create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/tsconfig.json create mode 100644 sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/tsp-location.yaml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 40a7dd00d89b..8448b61dc243 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -841,6 +841,9 @@ importers: '@rush-temp/attestation': specifier: file:./projects/attestation.tgz version: file:projects/attestation.tgz(@types/debug@4.1.12)(tsx@4.19.3)(vite@6.2.6(@types/node@22.7.9)(tsx@4.19.3)(yaml@2.7.1))(yaml@2.7.1) + '@rush-temp/azure-resourcemanager-containerservicefleet': + specifier: file:./projects/azure-resourcemanager-containerservicefleet.tgz + version: file:projects/azure-resourcemanager-containerservicefleet.tgz '@rush-temp/batch': specifier: file:./projects/batch.tgz version: file:projects/batch.tgz(@types/debug@4.1.12)(tsx@4.19.3)(vite@6.2.6(@types/node@22.7.9)(tsx@4.19.3)(yaml@2.7.1))(yaml@2.7.1) @@ -3454,6 +3457,10 @@ packages: resolution: {integrity: sha512-MYUYjG90tY6X1qaJyrFH7qd4ndfKpVQhLUYibmqtoSkjFvs+uR6lh1K75cFvzmNhe5D9YAWpKRfQwLfMC2rtMQ==, tarball: file:projects/attestation.tgz} version: 0.0.0 + '@rush-temp/azure-resourcemanager-containerservicefleet@file:projects/azure-resourcemanager-containerservicefleet.tgz': + resolution: {integrity: sha512-uvK0NbfC0MFXySd6ami8EoUDz/2/0TMob/n8ktduWIhTzgaRuZp4ROCgPIK7FUQVggvH5YRL4d5lQkGg07rQ0A==, tarball: file:projects/azure-resourcemanager-containerservicefleet.tgz} + version: 0.0.0 + '@rush-temp/batch@file:projects/batch.tgz': resolution: {integrity: sha512-0lJBMO9HJ5ljwFRJ/NubrZC8cJgU+L0vfcTknTtZzzP0NCnG+KnvfxKZ/0qvtnysbFYyE5E9xaEBOVQfNk6BMA==, tarball: file:projects/batch.tgz} version: 0.0.0 @@ -3475,7 +3482,7 @@ packages: version: 0.0.0 '@rush-temp/communication-email@file:projects/communication-email.tgz': - resolution: {integrity: sha512-ceM+5ZMhdqmXlCJVgKjyCYNggf9HTdd+UNKVAGv+lMWYIuLGug5G1+f58i23572HLLR2jjrDtJdrbdp4Jfx1fA==, tarball: file:projects/communication-email.tgz} + resolution: {integrity: sha512-5FTv0qLqjdh3DQFAXu8jkUb7F1qwm8xp3J0ol6Ol5gs+DTgBb18YbpzvKgLTI/+DrRgD9BDX4h2s9gcHaD4FUQ==, tarball: file:projects/communication-email.tgz} version: 0.0.0 '@rush-temp/communication-identity@file:projects/communication-identity.tgz': @@ -4329,6 +4336,10 @@ packages: resolution: {integrity: sha512-AjOC3zfnxd6S4Eiy3jwktJPclqhFHNyd8L6Gycf9WUPoKZpgM5PjkxY1X7uSy61xVpiJDhhk7XT2NVsN3ALTWg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typespec/ts-http-runtime@0.1.0': + resolution: {integrity: sha512-0NspintCRrSIIZBUtVfWjJ5TpOjpP0mNsJXZOqzuxdY/q2yCr0amyUCEw+WLhRykP39XMNMG0f1F9LbC2+c+Rw==} + engines: {node: '>=18.0.0'} + '@vitest/browser@3.1.1': resolution: {integrity: sha512-A+A69mMtrj1RPh96LfXGc309KSXhy2MslvyL+cp9+Y5EVdoJD4KfXDx/3SSlRGN70+hIoJ3RRbTidTvj18PZ/A==} peerDependencies: @@ -18357,6 +18368,21 @@ snapshots: - webdriverio - yaml + '@rush-temp/azure-resourcemanager-containerservicefleet@file:projects/azure-resourcemanager-containerservicefleet.tgz': + dependencies: + '@microsoft/api-extractor': 7.52.3(@types/node@18.19.86) + '@types/node': 18.19.86 + '@typespec/ts-http-runtime': 0.1.0 + eslint: 9.24.0 + mkdirp: 3.0.1 + rimraf: 5.0.10 + tshy: 2.0.1 + tslib: 2.8.1 + typescript: 5.8.3 + transitivePeerDependencies: + - jiti + - supports-color + '@rush-temp/batch@file:projects/batch.tgz(@types/debug@4.1.12)(tsx@4.19.3)(vite@6.2.6(@types/node@22.7.9)(tsx@4.19.3)(yaml@2.7.1))(yaml@2.7.1)': dependencies: '@types/node': 18.19.86 @@ -18547,7 +18573,6 @@ snapshots: '@rush-temp/communication-email@file:projects/communication-email.tgz(@types/debug@4.1.12)(tsx@4.19.3)(vite@6.2.6(@types/node@22.7.9)(tsx@4.19.3)(yaml@2.7.1))(yaml@2.7.1)': dependencies: - '@azure-tools/test-credential': 1.3.1 '@azure/communication-common': 2.3.1 '@azure/core-lro': 2.7.2 '@types/node': 18.19.86 @@ -22988,7 +23013,7 @@ snapshots: '@types/express-serve-static-core@4.19.6': dependencies: - '@types/node': 18.19.86 + '@types/node': 22.7.9 '@types/qs': 6.9.18 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -23003,7 +23028,7 @@ snapshots: '@types/fs-extra@11.0.4': dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 18.19.86 + '@types/node': 22.7.9 '@types/fs-extra@8.1.5': dependencies: @@ -23029,7 +23054,7 @@ snapshots: '@types/jsonfile@6.1.4': dependencies: - '@types/node': 18.19.86 + '@types/node': 22.7.9 '@types/jsonwebtoken@9.0.9': dependencies: @@ -23109,7 +23134,7 @@ snapshots: '@types/readdir-glob@1.1.5': dependencies: - '@types/node': 18.19.86 + '@types/node': 22.7.9 '@types/resolve@1.20.2': {} @@ -23257,6 +23282,14 @@ snapshots: '@typescript-eslint/types': 8.26.1 eslint-visitor-keys: 4.2.0 + '@typespec/ts-http-runtime@0.1.0': + dependencies: + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + tslib: 2.8.1 + transitivePeerDependencies: + - supports-color + '@vitest/browser@3.1.1(playwright@1.51.1)(vite@6.2.6(@types/node@22.7.9)(tsx@4.19.3)(yaml@2.7.1))(vitest@3.1.1)': dependencies: '@testing-library/dom': 10.4.0 diff --git a/rush.json b/rush.json index db0ce6864009..97b1c5c76c6d 100644 --- a/rush.json +++ b/rush.json @@ -1,8 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ -{ + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -556,7 +555,9 @@ "projectFolder": "common/tools/dev-tool", "versionPolicyName": "utility", // Add Identity to decoupledLocalDependencies so that dev-tool uses the package from npm, avoiding a cyclic dependency. - "decoupledLocalDependencies": ["@azure/identity"] + "decoupledLocalDependencies": [ + "@azure/identity" + ] }, { "packageName": "@azure/eventgrid", @@ -596,7 +597,9 @@ { "packageName": "@azure/identity", "projectFolder": "sdk/identity/identity", - "decoupledLocalDependencies": ["@azure/keyvault-keys"], + "decoupledLocalDependencies": [ + "@azure/keyvault-keys" + ], "versionPolicyName": "client" }, { @@ -2338,6 +2341,11 @@ "packageName": "@azure/arm-weightsandbiases", "projectFolder": "sdk/liftrweightsandbiases/arm-weightsandbiases", "versionPolicyName": "management" + }, + { + "packageName": "azure-resourcemanager-containerservicefleet", + "projectFolder": "sdk/containerservicefleet/azure-resourcemanager-containerservicefleet", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/LICENSE b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/LICENSE new file mode 100644 index 000000000000..63447fd8bbbf --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/README.md b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/README.md new file mode 100644 index 000000000000..d6f92bfa9ee2 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/README.md @@ -0,0 +1,23 @@ +# ContainerServiceFleet client library for JavaScript + +Azure Kubernetes Fleet Manager api client. + +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet) +- [Package (NPM)](https://www.npmjs.com/package/azure-resourcemanager-containerservicefleet) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples) + +## Getting started + +### Currently supported environments + +- LTS versions of Node.js + +### Install the `azure-resourcemanager-containerservicefleet` package + +Install the ContainerServiceFleet client library for JavaScript with `npm`: + +```bash +npm install azure-resourcemanager-containerservicefleet +``` diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/api-extractor.json b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/api-extractor.json new file mode 100644 index 000000000000..518b3b4966f8 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "dist/esm/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "dist/azure-resourcemanager-containerservicefleet.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/package.json b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/package.json new file mode 100644 index 000000000000..38ee04a68076 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/package.json @@ -0,0 +1,50 @@ +{ + "name": "azure-resourcemanager-containerservicefleet", + "version": "1.0.0-beta.1", + "description": "A generated SDK for ContainerServiceClient.", + "engines": { + "node": ">=18.0.0" + }, + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/autoUpgradeProfileOperations": "src/api/autoUpgradeProfileOperations/index.ts", + "./api/autoUpgradeProfiles": "src/api/autoUpgradeProfiles/index.ts", + "./api/fleetUpdateStrategies": "src/api/fleetUpdateStrategies/index.ts", + "./api/updateRuns": "src/api/updateRuns/index.ts", + "./api/fleetMembers": "src/api/fleetMembers/index.ts", + "./api/fleets": "src/api/fleets/index.ts", + "./api/operations": "src/api/operations/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": ["esm", "commonjs"], + "esmDialects": ["browser", "react-native"], + "selfLink": false + }, + "type": "module", + "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src", + "lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]", + "build": "npm run clean && tshy && npm run extract-api" + }, + "devDependencies": { + "@types/node": "^18.0.0", + "eslint": "^9.9.0", + "typescript": "~5.8.2", + "tshy": "^2.0.0", + "@microsoft/api-extractor": "^7.40.3", + "rimraf": "^5.0.5", + "mkdirp": "^3.0.1" + }, + "dependencies": { + "tslib": "^2.6.2", + "@typespec/ts-http-runtime": "0.1.0" + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/rollup.config.js b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/rollup.config.js new file mode 100644 index 000000000000..a4e767e9f6b2 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/rollup.config.js @@ -0,0 +1,117 @@ +// Licensed under the MIT License. + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && + warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"], + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true, + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"], + }), + cjs(), + json(), + sourcemaps(), + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false, + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false, +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}), + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies), + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()], + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfileOperationsGenerateUpdateRunSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfileOperationsGenerateUpdateRunSample.ts new file mode 100644 index 000000000000..679941cb5a4c --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfileOperationsGenerateUpdateRunSample.ts @@ -0,0 +1,30 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to generates an update run for a given auto upgrade profile. + * + * @summary generates an update run for a given auto upgrade profile. + * x-ms-original-file: 2025-03-01/AutoUpgradeProfileOperations_GenerateUpdateRun_MaximumSet_Gen.json + */ +async function autoUpgradeProfileOperationsGenerateUpdateRunMaximumSet(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.autoUpgradeProfileOperations.generateUpdateRun( + "rgfleets", + "fleet1", + "aup1", + ); +} + +async function main(): Promise { + await autoUpgradeProfileOperationsGenerateUpdateRunMaximumSet(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesCreateOrUpdateSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..93b8d9cfb7e7 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesCreateOrUpdateSample.ts @@ -0,0 +1,66 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to create a AutoUpgradeProfile + * + * @summary create a AutoUpgradeProfile + * x-ms-original-file: 2025-03-01/AutoUpgradeProfiles_CreateOrUpdate.json + */ +async function createAnAutoUpgradeProfile(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.autoUpgradeProfiles.createOrUpdate( + "rg1", + "fleet1", + "autoupgradeprofile1", + { properties: { channel: "Stable" } }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to create a AutoUpgradeProfile + * + * @summary create a AutoUpgradeProfile + * x-ms-original-file: 2025-03-01/AutoUpgradeProfiles_CreateOrUpdate_MaximumSet_Gen.json + */ +async function createAnAutoUpgradeProfileGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.autoUpgradeProfiles.createOrUpdate( + "rgfleets", + "fleet1", + "autoupgradeprofile1", + { + properties: { + channel: "Stable", + updateStrategyId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/updateStrategies/strategy1", + nodeImageSelection: { type: "Latest" }, + disabled: true, + autoUpgradeProfileStatus: { lastTriggerError: {} }, + }, + }, + { ifMatch: "teikqmg", ifNoneMatch: "ghfmmyrekxincsxklbldnvhqd" }, + ); + console.log(result); +} + +async function main(): Promise { + await createAnAutoUpgradeProfile(); + await createAnAutoUpgradeProfileGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesDeleteSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesDeleteSample.ts new file mode 100644 index 000000000000..12f7f134ef80 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesDeleteSample.ts @@ -0,0 +1,53 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to delete a AutoUpgradeProfile + * + * @summary delete a AutoUpgradeProfile + * x-ms-original-file: 2025-03-01/AutoUpgradeProfiles_Delete.json + */ +async function deleteAnAutoUpgradeProfileResource(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.autoUpgradeProfiles.delete( + "rg1", + "fleet1", + "autoupgradeprofile1", + ); +} + +/** + * This sample demonstrates how to delete a AutoUpgradeProfile + * + * @summary delete a AutoUpgradeProfile + * x-ms-original-file: 2025-03-01/AutoUpgradeProfiles_Delete_MaximumSet_Gen.json + */ +async function deleteAnAutoUpgradeProfileResourceGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.autoUpgradeProfiles.delete( + "rgfleets", + "fleet1", + "autoupgradeprofile1", + { ifMatch: "qmdsmmawj" }, + ); +} + +async function main(): Promise { + await deleteAnAutoUpgradeProfileResource(); + await deleteAnAutoUpgradeProfileResourceGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesGetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesGetSample.ts new file mode 100644 index 000000000000..d4b175d5a9e7 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesGetSample.ts @@ -0,0 +1,54 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to get a AutoUpgradeProfile + * + * @summary get a AutoUpgradeProfile + * x-ms-original-file: 2025-03-01/AutoUpgradeProfiles_Get.json + */ +async function getsAnAutoUpgradeProfileResource(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.autoUpgradeProfiles.get( + "rg1", + "fleet1", + "autoupgradeprofile1", + ); + console.log(result); +} + +/** + * This sample demonstrates how to get a AutoUpgradeProfile + * + * @summary get a AutoUpgradeProfile + * x-ms-original-file: 2025-03-01/AutoUpgradeProfiles_Get_MaximumSet_Gen.json + */ +async function getsAnAutoUpgradeProfileResourceGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.autoUpgradeProfiles.get( + "rgfleets", + "fleet1", + "autoupgradeprofile1", + ); + console.log(result); +} + +async function main(): Promise { + await getsAnAutoUpgradeProfileResource(); + await getsAnAutoUpgradeProfileResourceGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesListByFleetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesListByFleetSample.ts new file mode 100644 index 000000000000..08ee7143abd7 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/autoUpgradeProfilesListByFleetSample.ts @@ -0,0 +1,60 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to list AutoUpgradeProfile resources by Fleet + * + * @summary list AutoUpgradeProfile resources by Fleet + * x-ms-original-file: 2025-03-01/AutoUpgradeProfiles_ListByFleet.json + */ +async function listsTheAutoUpgradeProfileResourcesByFleet(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.autoUpgradeProfiles.listByFleet( + "rg1", + "fleet1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to list AutoUpgradeProfile resources by Fleet + * + * @summary list AutoUpgradeProfile resources by Fleet + * x-ms-original-file: 2025-03-01/AutoUpgradeProfiles_ListByFleet_MaximumSet_Gen.json + */ +async function listsTheAutoUpgradeProfileResourcesByFleetGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.autoUpgradeProfiles.listByFleet( + "rgfleets", + "fleet1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsTheAutoUpgradeProfileResourcesByFleet(); + await listsTheAutoUpgradeProfileResourcesByFleetGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersCreateSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersCreateSample.ts new file mode 100644 index 000000000000..76fd56adf623 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersCreateSample.ts @@ -0,0 +1,63 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to create a FleetMember + * + * @summary create a FleetMember + * x-ms-original-file: 2025-03-01/FleetMembers_Create.json + */ +async function createsAFleetMemberResourceWithALongRunningOperation(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetMembers.create("rg1", "fleet1", "member-1", { + properties: { + clusterResourceId: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1", + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create a FleetMember + * + * @summary create a FleetMember + * x-ms-original-file: 2025-03-01/FleetMembers_Create_MaximumSet_Gen.json + */ +async function createsAFleetMemberResourceWithALongRunningOperationGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetMembers.create( + "rgfleets", + "fleet1", + "fleet1", + { + properties: { + clusterResourceId: + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1", + group: "fleet1", + }, + }, + { ifMatch: "amkttadbw", ifNoneMatch: "zoljoccbcg" }, + ); + console.log(result); +} + +async function main(): Promise { + await createsAFleetMemberResourceWithALongRunningOperation(); + await createsAFleetMemberResourceWithALongRunningOperationGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersDeleteSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersDeleteSample.ts new file mode 100644 index 000000000000..90e5ede527e9 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersDeleteSample.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to delete a FleetMember + * + * @summary delete a FleetMember + * x-ms-original-file: 2025-03-01/FleetMembers_Delete.json + */ +async function deletesAFleetMemberResourceAsynchronouslyWithALongRunningOperation(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.fleetMembers.delete("rg1", "fleet1", "member-1"); +} + +/** + * This sample demonstrates how to delete a FleetMember + * + * @summary delete a FleetMember + * x-ms-original-file: 2025-03-01/FleetMembers_Delete_MaximumSet_Gen.json + */ +async function deletesAFleetMemberResourceAsynchronouslyWithALongRunningOperationGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.fleetMembers.delete("rgfleets", "fleet1", "fleet1", { + ifMatch: "klroqfozx", + }); +} + +async function main(): Promise { + await deletesAFleetMemberResourceAsynchronouslyWithALongRunningOperation(); + await deletesAFleetMemberResourceAsynchronouslyWithALongRunningOperationGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersGetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersGetSample.ts new file mode 100644 index 000000000000..92790acf4544 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersGetSample.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to get a FleetMember + * + * @summary get a FleetMember + * x-ms-original-file: 2025-03-01/FleetMembers_Get.json + */ +async function getsAFleetMemberResource(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetMembers.get("rg1", "fleet1", "member-1"); + console.log(result); +} + +/** + * This sample demonstrates how to get a FleetMember + * + * @summary get a FleetMember + * x-ms-original-file: 2025-03-01/FleetMembers_Get_MaximumSet_Gen.json + */ +async function getsAFleetMemberResourceGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetMembers.get("rgfleets", "fleet1", "fleet1"); + console.log(result); +} + +async function main(): Promise { + await getsAFleetMemberResource(); + await getsAFleetMemberResourceGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersListByFleetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersListByFleetSample.ts new file mode 100644 index 000000000000..fcdcee34451c --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersListByFleetSample.ts @@ -0,0 +1,57 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to list FleetMember resources by Fleet + * + * @summary list FleetMember resources by Fleet + * x-ms-original-file: 2025-03-01/FleetMembers_ListByFleet.json + */ +async function listsTheMembersOfAFleet(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.fleetMembers.listByFleet("rg1", "fleet1")) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to list FleetMember resources by Fleet + * + * @summary list FleetMember resources by Fleet + * x-ms-original-file: 2025-03-01/FleetMembers_ListByFleet_MaximumSet_Gen.json + */ +async function listsTheMembersOfAFleetGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.fleetMembers.listByFleet( + "rgfleets", + "fleet1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsTheMembersOfAFleet(); + await listsTheMembersOfAFleetGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersUpdateAsyncSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersUpdateAsyncSample.ts new file mode 100644 index 000000000000..d1f49bde7739 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetMembersUpdateAsyncSample.ts @@ -0,0 +1,57 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to update a FleetMember + * + * @summary update a FleetMember + * x-ms-original-file: 2025-03-01/FleetMembers_Update.json + */ +async function updatesAFleetMemberResourceSynchronously(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetMembers.updateAsync( + "rg1", + "fleet1", + "member-1", + { properties: { group: "staging" } }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to update a FleetMember + * + * @summary update a FleetMember + * x-ms-original-file: 2025-03-01/FleetMembers_Update_MaximumSet_Gen.json + */ +async function updatesAFleetMemberResourceSynchronouslyGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetMembers.updateAsync( + "rgfleets", + "fleet1", + "fleet1", + { properties: { group: "staging" } }, + { ifMatch: "bjyjzzxvbs" }, + ); + console.log(result); +} + +async function main(): Promise { + await updatesAFleetMemberResourceSynchronously(); + await updatesAFleetMemberResourceSynchronouslyGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesCreateOrUpdateSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..193c1bb103d0 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesCreateOrUpdateSample.ts @@ -0,0 +1,81 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to create a FleetUpdateStrategy + * + * @summary create a FleetUpdateStrategy + * x-ms-original-file: 2025-03-01/FleetUpdateStrategies_CreateOrUpdate_MaximumSet_Gen.json + */ +async function createAFleetUpdateStrategyGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetUpdateStrategies.createOrUpdate( + "rgfleets", + "fleet1", + "fleet1", + { + properties: { + strategy: { + stages: [ + { + name: "stage1", + groups: [{ name: "group-a" }], + afterStageWaitInSeconds: 3600, + }, + ], + }, + }, + }, + { ifMatch: "bttptpmhheves", ifNoneMatch: "tlx" }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to create a FleetUpdateStrategy + * + * @summary create a FleetUpdateStrategy + * x-ms-original-file: 2025-03-01/UpdateStrategies_CreateOrUpdate.json + */ +async function createAFleetUpdateStrategy(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetUpdateStrategies.createOrUpdate( + "rg1", + "fleet1", + "strartegy1", + { + properties: { + strategy: { + stages: [ + { + name: "stage1", + groups: [{ name: "group-a" }], + afterStageWaitInSeconds: 3600, + }, + ], + }, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await createAFleetUpdateStrategyGeneratedByMaximumSetRule(); + await createAFleetUpdateStrategy(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesDeleteSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesDeleteSample.ts new file mode 100644 index 000000000000..f63d00c679d4 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesDeleteSample.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to delete a FleetUpdateStrategy + * + * @summary delete a FleetUpdateStrategy + * x-ms-original-file: 2025-03-01/FleetUpdateStrategies_Delete_MaximumSet_Gen.json + */ +async function deleteAFleetUpdateStrategyResourceGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.fleetUpdateStrategies.delete("rgfleets", "fleet1", "fleet1", { + ifMatch: "saqprswlk", + }); +} + +/** + * This sample demonstrates how to delete a FleetUpdateStrategy + * + * @summary delete a FleetUpdateStrategy + * x-ms-original-file: 2025-03-01/UpdateStrategies_Delete.json + */ +async function deleteAFleetUpdateStrategyResource(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.fleetUpdateStrategies.delete("rg1", "fleet1", "strategy1"); +} + +async function main(): Promise { + await deleteAFleetUpdateStrategyResourceGeneratedByMaximumSetRule(); + await deleteAFleetUpdateStrategyResource(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesGetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesGetSample.ts new file mode 100644 index 000000000000..196f91fe3308 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesGetSample.ts @@ -0,0 +1,54 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to get a FleetUpdateStrategy + * + * @summary get a FleetUpdateStrategy + * x-ms-original-file: 2025-03-01/FleetUpdateStrategies_Get_MaximumSet_Gen.json + */ +async function getAFleetUpdateStrategyResourceGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetUpdateStrategies.get( + "rgfleets", + "fleet1", + "fleet1", + ); + console.log(result); +} + +/** + * This sample demonstrates how to get a FleetUpdateStrategy + * + * @summary get a FleetUpdateStrategy + * x-ms-original-file: 2025-03-01/UpdateStrategies_Get.json + */ +async function getAFleetUpdateStrategyResource(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleetUpdateStrategies.get( + "rg1", + "fleet1", + "strategy1", + ); + console.log(result); +} + +async function main(): Promise { + await getAFleetUpdateStrategyResourceGeneratedByMaximumSetRule(); + await getAFleetUpdateStrategyResource(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesListByFleetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesListByFleetSample.ts new file mode 100644 index 000000000000..9733212bf2fd --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetUpdateStrategiesListByFleetSample.ts @@ -0,0 +1,60 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to list FleetUpdateStrategy resources by Fleet + * + * @summary list FleetUpdateStrategy resources by Fleet + * x-ms-original-file: 2025-03-01/FleetUpdateStrategies_ListByFleet_MaximumSet_Gen.json + */ +async function listTheFleetUpdateStrategyResourcesByFleetGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.fleetUpdateStrategies.listByFleet( + "rgfleets", + "fleet1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to list FleetUpdateStrategy resources by Fleet + * + * @summary list FleetUpdateStrategy resources by Fleet + * x-ms-original-file: 2025-03-01/UpdateStrategies_ListByFleet.json + */ +async function listTheFleetUpdateStrategyResourcesByFleet(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.fleetUpdateStrategies.listByFleet( + "rg1", + "fleet1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listTheFleetUpdateStrategyResourcesByFleetGeneratedByMaximumSetRule(); + await listTheFleetUpdateStrategyResourcesByFleet(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsCreateSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsCreateSample.ts new file mode 100644 index 000000000000..490078adc8c2 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsCreateSample.ts @@ -0,0 +1,80 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to creates or updates a Fleet. + * + * @summary creates or updates a Fleet. + * x-ms-original-file: 2025-03-01/Fleets_CreateOrUpdate.json + */ +async function createsAFleetResourceWithALongRunningOperation(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleets.create("rg1", "fleet1", { + tags: { tier: "production", archv2: "" }, + location: "East US", + properties: { + hubProfile: { + dnsPrefix: "dnsprefix1", + agentProfile: { vmSize: "Standard_DS1" }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a Fleet. + * + * @summary creates or updates a Fleet. + * x-ms-original-file: 2025-03-01/Fleets_CreateOrUpdate_MaximumSet_Gen.json + */ +async function createsAFleetResourceWithALongRunningOperationGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleets.create( + "rgfleets", + "fleet1", + { + tags: {}, + location: "East US", + properties: { + hubProfile: { + dnsPrefix: "dnsprefix1", + agentProfile: { + vmSize: "Standard_DS1", + subnetId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1", + }, + apiServerAccessProfile: { + enablePrivateCluster: true, + enableVnetIntegration: true, + subnetId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1", + }, + }, + }, + identity: { type: "None", userAssignedIdentities: { key126: {} } }, + }, + { ifMatch: "jzlrwaylijhsnzp", ifNoneMatch: "cqpzdjshmggwolagomzxfy" }, + ); + console.log(result); +} + +async function main(): Promise { + await createsAFleetResourceWithALongRunningOperation(); + await createsAFleetResourceWithALongRunningOperationGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsDeleteSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsDeleteSample.ts new file mode 100644 index 000000000000..7cd8216f9828 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsDeleteSample.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to delete a Fleet + * + * @summary delete a Fleet + * x-ms-original-file: 2025-03-01/Fleets_Delete.json + */ +async function deletesAFleetResourceAsynchronouslyWithALongRunningOperation(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.fleets.delete("rg1", "fleet1"); +} + +/** + * This sample demonstrates how to delete a Fleet + * + * @summary delete a Fleet + * x-ms-original-file: 2025-03-01/Fleets_Delete_MaximumSet_Gen.json + */ +async function deletesAFleetResourceAsynchronouslyWithALongRunningOperationGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.fleets.delete("rgfleets", "fleet1", { + ifMatch: "crsgokrdxddjsvqxpplerummnmzav", + }); +} + +async function main(): Promise { + await deletesAFleetResourceAsynchronouslyWithALongRunningOperation(); + await deletesAFleetResourceAsynchronouslyWithALongRunningOperationGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsGetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsGetSample.ts new file mode 100644 index 000000000000..ed8563c3ab5b --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsGetSample.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to gets a Fleet. + * + * @summary gets a Fleet. + * x-ms-original-file: 2025-03-01/Fleets_Get.json + */ +async function getsAFleetResource(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleets.get("rg1", "fleet1"); + console.log(result); +} + +/** + * This sample demonstrates how to gets a Fleet. + * + * @summary gets a Fleet. + * x-ms-original-file: 2025-03-01/Fleets_Get_MaximumSet_Gen.json + */ +async function getsAFleetResourceGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleets.get("rgfleets", "fleet1"); + console.log(result); +} + +async function main(): Promise { + await getsAFleetResource(); + await getsAFleetResourceGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListByResourceGroupSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListByResourceGroupSample.ts new file mode 100644 index 000000000000..5f8ca82f5ed8 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListByResourceGroupSample.ts @@ -0,0 +1,54 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to lists fleets in the specified subscription and resource group. + * + * @summary lists fleets in the specified subscription and resource group. + * x-ms-original-file: 2025-03-01/Fleets_ListByResourceGroup.json + */ +async function listsTheFleetResourcesInAResourceGroup(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.fleets.listByResourceGroup("rg1")) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists fleets in the specified subscription and resource group. + * + * @summary lists fleets in the specified subscription and resource group. + * x-ms-original-file: 2025-03-01/Fleets_ListByResourceGroup_MaximumSet_Gen.json + */ +async function listsTheFleetResourcesInAResourceGroupGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.fleets.listByResourceGroup("rgfleets")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsTheFleetResourcesInAResourceGroup(); + await listsTheFleetResourcesInAResourceGroupGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListBySubscriptionSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListBySubscriptionSample.ts new file mode 100644 index 000000000000..40b1dd49680f --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListBySubscriptionSample.ts @@ -0,0 +1,54 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to lists fleets in the specified subscription. + * + * @summary lists fleets in the specified subscription. + * x-ms-original-file: 2025-03-01/Fleets_ListBySub.json + */ +async function listsTheFleetResourcesInASubscription(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.fleets.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists fleets in the specified subscription. + * + * @summary lists fleets in the specified subscription. + * x-ms-original-file: 2025-03-01/Fleets_ListBySubscription_MaximumSet_Gen.json + */ +async function listsTheFleetResourcesInASubscriptionGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.fleets.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsTheFleetResourcesInASubscription(); + await listsTheFleetResourcesInASubscriptionGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListCredentialsSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListCredentialsSample.ts new file mode 100644 index 000000000000..f47fa80a42ac --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsListCredentialsSample.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to lists the user credentials of a Fleet. + * + * @summary lists the user credentials of a Fleet. + * x-ms-original-file: 2025-03-01/Fleets_ListCredentialsResult.json + */ +async function listsTheUserCredentialsOfAFleet(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleets.listCredentials("rg1", "fleet"); + console.log(result); +} + +/** + * This sample demonstrates how to lists the user credentials of a Fleet. + * + * @summary lists the user credentials of a Fleet. + * x-ms-original-file: 2025-03-01/Fleets_ListCredentials_MaximumSet_Gen.json + */ +async function listsTheUserCredentialsOfAFleetGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleets.listCredentials("rgfleets", "fleet1"); + console.log(result); +} + +async function main(): Promise { + await listsTheUserCredentialsOfAFleet(); + await listsTheUserCredentialsOfAFleetGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsUpdateAsyncSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsUpdateAsyncSample.ts new file mode 100644 index 000000000000..618df9f8221f --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/fleetsUpdateAsyncSample.ts @@ -0,0 +1,59 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to update a Fleet + * + * @summary update a Fleet + * x-ms-original-file: 2025-03-01/Fleets_PatchTags.json + */ +async function updateAFleet(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleets.updateAsync( + "rg1", + "fleet1", + { tags: { tier: "secure", env: "prod" } }, + { ifMatch: "dfjkwelr7384" }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to update a Fleet + * + * @summary update a Fleet + * x-ms-original-file: 2025-03-01/Fleets_Update_MaximumSet_Gen.json + */ +async function updateAFleetGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.fleets.updateAsync( + "rgfleets", + "fleet1", + { + tags: {}, + identity: { type: "None", userAssignedIdentities: { key126: {} } }, + }, + { ifMatch: "lgoeir" }, + ); + console.log(result); +} + +async function main(): Promise { + await updateAFleet(); + await updateAFleetGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/operationsListSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..53be74677ad7 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/operationsListSample.ts @@ -0,0 +1,77 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01/Operations_List.json + */ +async function listTheOperationsForTheProvider(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01/Operations_List_MaximumSet_Gen.json + */ +async function listTheOperationsForTheProviderGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01/Operations_List_MinimumSet_Gen.json + */ +async function listTheOperationsForTheProviderGeneratedByMinimumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listTheOperationsForTheProvider(); + await listTheOperationsForTheProviderGeneratedByMaximumSetRule(); + await listTheOperationsForTheProviderGeneratedByMinimumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsCreateOrUpdateSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..e30a6ee18bbf --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsCreateOrUpdateSample.ts @@ -0,0 +1,99 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to create a UpdateRun + * + * @summary create a UpdateRun + * x-ms-original-file: 2025-03-01/UpdateRuns_CreateOrUpdate.json + */ +async function createAnUpdateRun(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.createOrUpdate( + "rg1", + "fleet1", + "run1", + { + properties: { + updateStrategyId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1", + strategy: { + stages: [ + { + name: "stage1", + groups: [{ name: "group-a" }], + afterStageWaitInSeconds: 3600, + }, + ], + }, + managedClusterUpdate: { + upgrade: { type: "Full", kubernetesVersion: "1.26.1" }, + nodeImageSelection: { type: "Latest" }, + }, + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to create a UpdateRun + * + * @summary create a UpdateRun + * x-ms-original-file: 2025-03-01/UpdateRuns_CreateOrUpdate_MaximumSet_Gen.json + */ +async function createAnUpdateRunGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.createOrUpdate( + "rgfleets", + "fleet1", + "fleet1", + { + properties: { + updateStrategyId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1", + strategy: { + stages: [ + { + name: "stage1", + groups: [{ name: "group-a" }], + afterStageWaitInSeconds: 3600, + }, + ], + }, + managedClusterUpdate: { + upgrade: { type: "Full", kubernetesVersion: "1.26.1" }, + nodeImageSelection: { type: "Latest", customNodeImageVersions: [{}] }, + }, + status: { + status: { state: "NotStarted", error: {} }, + nodeImageSelection: {}, + }, + autoUpgradeProfileId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1", + }, + }, + { ifMatch: "wyolpuaxgybeygcbz", ifNoneMatch: "rwrhonlormgshamadufoo" }, + ); + console.log(result); +} + +async function main(): Promise { + await createAnUpdateRun(); + await createAnUpdateRunGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsDeleteSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsDeleteSample.ts new file mode 100644 index 000000000000..da17e1fbf2cc --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsDeleteSample.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to delete a UpdateRun + * + * @summary delete a UpdateRun + * x-ms-original-file: 2025-03-01/UpdateRuns_Delete.json + */ +async function deleteAnUpdateRunResource(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.updateRuns.delete("rg1", "fleet1", "run1"); +} + +/** + * This sample demonstrates how to delete a UpdateRun + * + * @summary delete a UpdateRun + * x-ms-original-file: 2025-03-01/UpdateRuns_Delete_MaximumSet_Gen.json + */ +async function deleteAnUpdateRunResourceGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + await client.updateRuns.delete("rgfleets", "fleet1", "fleet1", { + ifMatch: "xnbwucfeufeagpa", + }); +} + +async function main(): Promise { + await deleteAnUpdateRunResource(); + await deleteAnUpdateRunResourceGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsGetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsGetSample.ts new file mode 100644 index 000000000000..c4b9d1580c99 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsGetSample.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to get a UpdateRun + * + * @summary get a UpdateRun + * x-ms-original-file: 2025-03-01/UpdateRuns_Get.json + */ +async function getsAnUpdateRunResource(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.get("rg1", "fleet1", "run1"); + console.log(result); +} + +/** + * This sample demonstrates how to get a UpdateRun + * + * @summary get a UpdateRun + * x-ms-original-file: 2025-03-01/UpdateRuns_Get_MaximumSet_Gen.json + */ +async function getsAnUpdateRunResourceGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.get("rgfleets", "fleet1", "fleet1"); + console.log(result); +} + +async function main(): Promise { + await getsAnUpdateRunResource(); + await getsAnUpdateRunResourceGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsListByFleetSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsListByFleetSample.ts new file mode 100644 index 000000000000..433f1e268f43 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsListByFleetSample.ts @@ -0,0 +1,57 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to list UpdateRun resources by Fleet + * + * @summary list UpdateRun resources by Fleet + * x-ms-original-file: 2025-03-01/UpdateRuns_ListByFleet.json + */ +async function listsTheUpdateRunResourcesByFleet(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.updateRuns.listByFleet("rg1", "fleet1")) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to list UpdateRun resources by Fleet + * + * @summary list UpdateRun resources by Fleet + * x-ms-original-file: 2025-03-01/UpdateRuns_ListByFleet_MaximumSet_Gen.json + */ +async function listsTheUpdateRunResourcesByFleetGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.updateRuns.listByFleet( + "rgfleets", + "fleet1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsTheUpdateRunResourcesByFleet(); + await listsTheUpdateRunResourcesByFleetGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsSkipSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsSkipSample.ts new file mode 100644 index 000000000000..ff3e82827a11 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsSkipSample.ts @@ -0,0 +1,62 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + * + * @summary skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + * x-ms-original-file: 2025-03-01/UpdateRuns_Skip.json + */ +async function skipsOneOrMoreMemberOrGroupOrStageOrAfterStageWaitSOfAnUpdateRun(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.skip("rg1", "fleet1", "run1", { + targets: [ + { type: "Member", name: "member-one" }, + { type: "AfterStageWait", name: "stage1" }, + ], + }); + console.log(result); +} + +/** + * This sample demonstrates how to skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + * + * @summary skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + * x-ms-original-file: 2025-03-01/UpdateRuns_Skip_MaximumSet_Gen.json + */ +async function skipsOneOrMoreMemberOrGroupOrStageOrAfterStageWaitSOfAnUpdateRunGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.skip( + "rgfleets", + "fleet1", + "fleet1", + { + targets: [ + { type: "Member", name: "member-one" }, + { type: "AfterStageWait", name: "stage1" }, + ], + }, + { ifMatch: "rncfubdzrhcihvpqflbsjvoau" }, + ); + console.log(result); +} + +async function main(): Promise { + await skipsOneOrMoreMemberOrGroupOrStageOrAfterStageWaitSOfAnUpdateRun(); + await skipsOneOrMoreMemberOrGroupOrStageOrAfterStageWaitSOfAnUpdateRunGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsStartSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsStartSample.ts new file mode 100644 index 000000000000..8f476a6cafb3 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsStartSample.ts @@ -0,0 +1,48 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to starts an UpdateRun. + * + * @summary starts an UpdateRun. + * x-ms-original-file: 2025-03-01/UpdateRuns_Start.json + */ +async function startsAnUpdateRun(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.start("rg1", "fleet1", "run1"); + console.log(result); +} + +/** + * This sample demonstrates how to starts an UpdateRun. + * + * @summary starts an UpdateRun. + * x-ms-original-file: 2025-03-01/UpdateRuns_Start_MaximumSet_Gen.json + */ +async function startsAnUpdateRunGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.start("rgfleets", "fleet1", "fleet1", { + ifMatch: "bvhjlqeindkmljbbiypbqiaqgtkhlu", + }); + console.log(result); +} + +async function main(): Promise { + await startsAnUpdateRun(); + await startsAnUpdateRunGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsStopSample.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsStopSample.ts new file mode 100644 index 000000000000..df3287ff2f9b --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/samples-dev/updateRunsStopSample.ts @@ -0,0 +1,48 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "azure-resourcemanager-containerservicefleet"; + +/** + * This sample demonstrates how to stops an UpdateRun. + * + * @summary stops an UpdateRun. + * x-ms-original-file: 2025-03-01/UpdateRuns_Stop.json + */ +async function stopsAnUpdateRun(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.stop("rg1", "fleet1", "run1"); + console.log(result); +} + +/** + * This sample demonstrates how to stops an UpdateRun. + * + * @summary stops an UpdateRun. + * x-ms-original-file: 2025-03-01/UpdateRuns_Stop_MaximumSet_Gen.json + */ +async function stopsAnUpdateRunGeneratedByMaximumSetRule(): Promise { + const credential = { + getToken: async () => { + return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: now() }; + }, + }; + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ContainerServiceClient(credential, subscriptionId); + const result = await client.updateRuns.stop("rgfleets", "fleet1", "fleet1", { + ifMatch: "jb", + }); + console.log(result); +} + +async function main(): Promise { + await stopsAnUpdateRun(); + await stopsAnUpdateRunGeneratedByMaximumSetRule(); +} + +main().catch(console.error); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/index.ts new file mode 100644 index 000000000000..18d913003e2d --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/index.ts @@ -0,0 +1,4 @@ +// Licensed under the MIT License. + +export { generateUpdateRun } from "./operations.js"; +export { AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams } from "./options.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/operations.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/operations.ts new file mode 100644 index 000000000000..8f09614cc795 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/operations.ts @@ -0,0 +1,89 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext as Client } from "../index.js"; +import { errorResponseDeserializer } from "../../models/models.js"; +import { AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams } from "./options.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _generateUpdateRunSend( + context: Client, + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options: AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}/generateUpdateRun{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + autoUpgradeProfileName: autoUpgradeProfileName, + "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 _generateUpdateRunDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Generates an update run for a given auto upgrade profile. */ +export function generateUpdateRun( + context: Client, + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options: AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams = { + requestOptions: {}, + }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void> { + return getLongRunningPoller( + context, + _generateUpdateRunDeserialize, + ["202", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _generateUpdateRunSend( + context, + resourceGroupName, + fleetName, + autoUpgradeProfileName, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/options.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/options.ts new file mode 100644 index 000000000000..d328368457a1 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfileOperations/options.ts @@ -0,0 +1,10 @@ +// Licensed under the MIT License. + +import { OperationOptions } from "@typespec/ts-http-runtime"; + +/** Optional parameters. */ +export interface AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/index.ts new file mode 100644 index 000000000000..86dca7403597 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/index.ts @@ -0,0 +1,9 @@ +// Licensed under the MIT License. + +export { listByFleet, $delete, createOrUpdate, get } from "./operations.js"; +export { + AutoUpgradeProfilesListByFleetOptionalParams, + AutoUpgradeProfilesDeleteOptionalParams, + AutoUpgradeProfilesCreateOrUpdateOptionalParams, + AutoUpgradeProfilesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/operations.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/operations.ts new file mode 100644 index 000000000000..350c95bb8aac --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/operations.ts @@ -0,0 +1,326 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + AutoUpgradeProfile, + autoUpgradeProfileSerializer, + autoUpgradeProfileDeserializer, + _AutoUpgradeProfileListResult, + _autoUpgradeProfileListResultDeserializer, +} from "../../models/models.js"; +import { + AutoUpgradeProfilesListByFleetOptionalParams, + AutoUpgradeProfilesDeleteOptionalParams, + AutoUpgradeProfilesCreateOrUpdateOptionalParams, + AutoUpgradeProfilesGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _listByFleetSend( + context: Client, + resourceGroupName: string, + fleetName: string, + options: AutoUpgradeProfilesListByFleetOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "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 _listByFleetDeserialize( + result: PathUncheckedResponse, +): Promise<_AutoUpgradeProfileListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _autoUpgradeProfileListResultDeserializer(result.body); +} + +/** List AutoUpgradeProfile resources by Fleet */ +export function listByFleet( + context: Client, + resourceGroupName: string, + fleetName: string, + options: AutoUpgradeProfilesListByFleetOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByFleetSend(context, resourceGroupName, fleetName, options), + _listByFleetDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options: AutoUpgradeProfilesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + autoUpgradeProfileName: autoUpgradeProfileName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a AutoUpgradeProfile */ +/** + * @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, + fleetName: string, + autoUpgradeProfileName: string, + options: AutoUpgradeProfilesDeleteOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + fleetName, + autoUpgradeProfileName, + options, + ), + resourceLocationConfig: "location", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + resource: AutoUpgradeProfile, + options: AutoUpgradeProfilesCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + autoUpgradeProfileName: autoUpgradeProfileName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "If-None-Match": options?.ifNoneMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: autoUpgradeProfileSerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return autoUpgradeProfileDeserializer(result.body); +} + +/** Create a AutoUpgradeProfile */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + resource: AutoUpgradeProfile, + options: AutoUpgradeProfilesCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): __PLACEHOLDER_o122__< + __PLACEHOLDER_o123__, + AutoUpgradeProfile +> { + return getLongRunningPoller( + context, + _createOrUpdateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + fleetName, + autoUpgradeProfileName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as __PLACEHOLDER_o122__< + __PLACEHOLDER_o123__, + AutoUpgradeProfile + >; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options: AutoUpgradeProfilesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + autoUpgradeProfileName: autoUpgradeProfileName, + "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 autoUpgradeProfileDeserializer(result.body); +} + +/** Get a AutoUpgradeProfile */ +export async function get( + context: Client, + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options: AutoUpgradeProfilesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + fleetName, + autoUpgradeProfileName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/options.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/options.ts new file mode 100644 index 000000000000..b3771bb49af0 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/autoUpgradeProfiles/options.ts @@ -0,0 +1,31 @@ +// Licensed under the MIT License. + +import { OperationOptions } from "@typespec/ts-http-runtime"; + +/** Optional parameters. */ +export interface AutoUpgradeProfilesListByFleetOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AutoUpgradeProfilesDeleteOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface AutoUpgradeProfilesCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; + /** The request should only proceed if no entity matches this string. */ + ifNoneMatch?: string; +} + +/** Optional parameters. */ +export interface AutoUpgradeProfilesGetOptionalParams + extends OperationOptions {} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/containerServiceContext.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/containerServiceContext.ts new file mode 100644 index 000000000000..394370dc4619 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/containerServiceContext.ts @@ -0,0 +1,69 @@ +// Licensed under the MIT License. + +import { KnownVersions } from "../models/models.js"; +import { + Client, + ClientOptions, + getClient, + TokenCredential, +} from "@typespec/ts-http-runtime"; + +/** Azure Kubernetes Fleet Manager api client. */ +export interface ContainerServiceContext 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 ContainerServiceClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Azure Kubernetes Fleet Manager api client. */ +export function createContainerService( + credential: TokenCredential, + subscriptionId: string, + options: ContainerServiceClientOptionalParams = {}, +): ContainerServiceContext { + const endpointUrl = options.endpoint ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-azure-resourcemanager-containerservicefleet/1.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + 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"; + 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 ContainerServiceContext; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/index.ts new file mode 100644 index 000000000000..292bea9fd9f5 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/index.ts @@ -0,0 +1,16 @@ +// Licensed under the MIT License. + +export { + listByFleet, + $delete, + updateAsync, + create, + get, +} from "./operations.js"; +export { + FleetMembersListByFleetOptionalParams, + FleetMembersDeleteOptionalParams, + FleetMembersUpdateAsyncOptionalParams, + FleetMembersCreateOptionalParams, + FleetMembersGetOptionalParams, +} from "./options.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/operations.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/operations.ts new file mode 100644 index 000000000000..599360e2752c --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/operations.ts @@ -0,0 +1,390 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + FleetMember, + fleetMemberSerializer, + fleetMemberDeserializer, + FleetMemberUpdate, + fleetMemberUpdateSerializer, + _FleetMemberListResult, + _fleetMemberListResultDeserializer, +} from "../../models/models.js"; +import { + FleetMembersListByFleetOptionalParams, + FleetMembersDeleteOptionalParams, + FleetMembersUpdateAsyncOptionalParams, + FleetMembersCreateOptionalParams, + FleetMembersGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _listByFleetSend( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetMembersListByFleetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "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 _listByFleetDeserialize( + result: PathUncheckedResponse, +): Promise<_FleetMemberListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _fleetMemberListResultDeserializer(result.body); +} + +/** List FleetMember resources by Fleet */ +export function listByFleet( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetMembersListByFleetOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByFleetSend(context, resourceGroupName, fleetName, options), + _listByFleetDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options: FleetMembersDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + fleetMemberName: fleetMemberName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a FleetMember */ +/** + * @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, + fleetName: string, + fleetMemberName: string, + options: FleetMembersDeleteOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + fleetName, + fleetMemberName, + options, + ), + resourceLocationConfig: "location", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; +} + +export function _updateAsyncSend( + context: Client, + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + properties: FleetMemberUpdate, + options: FleetMembersUpdateAsyncOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + fleetMemberName: fleetMemberName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: fleetMemberUpdateSerializer(properties), + }); +} + +export async function _updateAsyncDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return fleetMemberDeserializer(result.body); +} + +/** Update a FleetMember */ +export function updateAsync( + context: Client, + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + properties: FleetMemberUpdate, + options: FleetMembersUpdateAsyncOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, FleetMember> { + return getLongRunningPoller( + context, + _updateAsyncDeserialize, + ["200", "202"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateAsyncSend( + context, + resourceGroupName, + fleetName, + fleetMemberName, + properties, + options, + ), + resourceLocationConfig: "location", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, FleetMember>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + resource: FleetMember, + options: FleetMembersCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + fleetMemberName: fleetMemberName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "If-None-Match": options?.ifNoneMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: fleetMemberSerializer(resource), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return fleetMemberDeserializer(result.body); +} + +/** Create a FleetMember */ +export function create( + context: Client, + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + resource: FleetMember, + options: FleetMembersCreateOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, FleetMember> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend( + context, + resourceGroupName, + fleetName, + fleetMemberName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, FleetMember>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options: FleetMembersGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + fleetMemberName: fleetMemberName, + "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 fleetMemberDeserializer(result.body); +} + +/** Get a FleetMember */ +export async function get( + context: Client, + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options: FleetMembersGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + fleetName, + fleetMemberName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/options.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/options.ts new file mode 100644 index 000000000000..ff8d30df12b0 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetMembers/options.ts @@ -0,0 +1,37 @@ +// Licensed under the MIT License. + +import { OperationOptions } from "@typespec/ts-http-runtime"; + +/** Optional parameters. */ +export interface FleetMembersListByFleetOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface FleetMembersDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface FleetMembersUpdateAsyncOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface FleetMembersCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; + /** The request should only proceed if no entity matches this string. */ + ifNoneMatch?: string; +} + +/** Optional parameters. */ +export interface FleetMembersGetOptionalParams extends OperationOptions {} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/index.ts new file mode 100644 index 000000000000..deab3f37065f --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/index.ts @@ -0,0 +1,9 @@ +// Licensed under the MIT License. + +export { listByFleet, $delete, createOrUpdate, get } from "./operations.js"; +export { + FleetUpdateStrategiesListByFleetOptionalParams, + FleetUpdateStrategiesDeleteOptionalParams, + FleetUpdateStrategiesCreateOrUpdateOptionalParams, + FleetUpdateStrategiesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/operations.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/operations.ts new file mode 100644 index 000000000000..d44feb453507 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/operations.ts @@ -0,0 +1,326 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + FleetUpdateStrategy, + fleetUpdateStrategySerializer, + fleetUpdateStrategyDeserializer, + _FleetUpdateStrategyListResult, + _fleetUpdateStrategyListResultDeserializer, +} from "../../models/models.js"; +import { + FleetUpdateStrategiesListByFleetOptionalParams, + FleetUpdateStrategiesDeleteOptionalParams, + FleetUpdateStrategiesCreateOrUpdateOptionalParams, + FleetUpdateStrategiesGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _listByFleetSend( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetUpdateStrategiesListByFleetOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "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 _listByFleetDeserialize( + result: PathUncheckedResponse, +): Promise<_FleetUpdateStrategyListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _fleetUpdateStrategyListResultDeserializer(result.body); +} + +/** List FleetUpdateStrategy resources by Fleet */ +export function listByFleet( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetUpdateStrategiesListByFleetOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByFleetSend(context, resourceGroupName, fleetName, options), + _listByFleetDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + options: FleetUpdateStrategiesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateStrategyName: updateStrategyName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a FleetUpdateStrategy */ +/** + * @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, + fleetName: string, + updateStrategyName: string, + options: FleetUpdateStrategiesDeleteOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + fleetName, + updateStrategyName, + options, + ), + resourceLocationConfig: "location", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + resource: FleetUpdateStrategy, + options: FleetUpdateStrategiesCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateStrategyName: updateStrategyName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "If-None-Match": options?.ifNoneMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: fleetUpdateStrategySerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return fleetUpdateStrategyDeserializer(result.body); +} + +/** Create a FleetUpdateStrategy */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + resource: FleetUpdateStrategy, + options: FleetUpdateStrategiesCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): __PLACEHOLDER_o122__< + __PLACEHOLDER_o123__, + FleetUpdateStrategy +> { + return getLongRunningPoller( + context, + _createOrUpdateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + fleetName, + updateStrategyName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as __PLACEHOLDER_o122__< + __PLACEHOLDER_o123__, + FleetUpdateStrategy + >; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + options: FleetUpdateStrategiesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateStrategyName: updateStrategyName, + "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 fleetUpdateStrategyDeserializer(result.body); +} + +/** Get a FleetUpdateStrategy */ +export async function get( + context: Client, + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + options: FleetUpdateStrategiesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + fleetName, + updateStrategyName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/options.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/options.ts new file mode 100644 index 000000000000..89dc89a6a1b5 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleetUpdateStrategies/options.ts @@ -0,0 +1,31 @@ +// Licensed under the MIT License. + +import { OperationOptions } from "@typespec/ts-http-runtime"; + +/** Optional parameters. */ +export interface FleetUpdateStrategiesListByFleetOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface FleetUpdateStrategiesDeleteOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface FleetUpdateStrategiesCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; + /** The request should only proceed if no entity matches this string. */ + ifNoneMatch?: string; +} + +/** Optional parameters. */ +export interface FleetUpdateStrategiesGetOptionalParams + extends OperationOptions {} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/index.ts new file mode 100644 index 000000000000..d8d3d5067253 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/index.ts @@ -0,0 +1,20 @@ +// Licensed under the MIT License. + +export { + listCredentials, + listBySubscription, + listByResourceGroup, + $delete, + updateAsync, + create, + get, +} from "./operations.js"; +export { + FleetsListCredentialsOptionalParams, + FleetsListBySubscriptionOptionalParams, + FleetsListByResourceGroupOptionalParams, + FleetsDeleteOptionalParams, + FleetsUpdateAsyncOptionalParams, + FleetsCreateOptionalParams, + FleetsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/operations.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/operations.ts new file mode 100644 index 000000000000..f89fd795e4fe --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/operations.ts @@ -0,0 +1,469 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + Fleet, + fleetSerializer, + fleetDeserializer, + FleetPatch, + fleetPatchSerializer, + _FleetListResult, + _fleetListResultDeserializer, + FleetCredentialResults, + fleetCredentialResultsDeserializer, +} from "../../models/models.js"; +import { + FleetsListCredentialsOptionalParams, + FleetsListBySubscriptionOptionalParams, + FleetsListByResourceGroupOptionalParams, + FleetsDeleteOptionalParams, + FleetsUpdateAsyncOptionalParams, + FleetsCreateOptionalParams, + FleetsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _listCredentialsSend( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetsListCredentialsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "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 _listCredentialsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return fleetCredentialResultsDeserializer(result.body); +} + +/** Lists the user credentials of a Fleet. */ +export async function listCredentials( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetsListCredentialsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listCredentialsSend( + context, + resourceGroupName, + fleetName, + options, + ); + return _listCredentialsDeserialize(result); +} + +export function _listBySubscriptionSend( + context: Client, + options: FleetsListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets{?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<_FleetListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _fleetListResultDeserializer(result.body); +} + +/** Lists fleets in the specified subscription. */ +export function listBySubscription( + context: Client, + options: FleetsListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: FleetsListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets{?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<_FleetListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _fleetListResultDeserializer(result.body); +} + +/** Lists fleets in the specified subscription and resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: FleetsListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a Fleet */ +/** + * @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, + fleetName: string, + options: FleetsDeleteOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, fleetName, options), + resourceLocationConfig: "location", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; +} + +export function _updateAsyncSend( + context: Client, + resourceGroupName: string, + fleetName: string, + properties: FleetPatch, + options: FleetsUpdateAsyncOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: fleetPatchSerializer(properties), + }); +} + +export async function _updateAsyncDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return fleetDeserializer(result.body); +} + +/** Update a Fleet */ +export function updateAsync( + context: Client, + resourceGroupName: string, + fleetName: string, + properties: FleetPatch, + options: FleetsUpdateAsyncOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, Fleet> { + return getLongRunningPoller( + context, + _updateAsyncDeserialize, + ["200", "202"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateAsyncSend( + context, + resourceGroupName, + fleetName, + properties, + options, + ), + resourceLocationConfig: "location", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, Fleet>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + fleetName: string, + resource: Fleet, + options: FleetsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "If-None-Match": options?.ifNoneMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: fleetSerializer(resource), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return fleetDeserializer(result.body); +} + +/** Creates or updates a Fleet. */ +export function create( + context: Client, + resourceGroupName: string, + fleetName: string, + resource: Fleet, + options: FleetsCreateOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, Fleet> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend(context, resourceGroupName, fleetName, resource, options), + resourceLocationConfig: "azure-async-operation", + }) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, Fleet>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "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 fleetDeserializer(result.body); +} + +/** Gets a Fleet. */ +export async function get( + context: Client, + resourceGroupName: string, + fleetName: string, + options: FleetsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, fleetName, options); + return _getDeserialize(result); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/options.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/options.ts new file mode 100644 index 000000000000..42b910397222 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/fleets/options.ts @@ -0,0 +1,43 @@ +// Licensed under the MIT License. + +import { OperationOptions } from "@typespec/ts-http-runtime"; + +/** Optional parameters. */ +export interface FleetsListCredentialsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface FleetsListBySubscriptionOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface FleetsListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface FleetsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface FleetsUpdateAsyncOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface FleetsCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; + /** The request should only proceed if no entity matches this string. */ + ifNoneMatch?: string; +} + +/** Optional parameters. */ +export interface FleetsGetOptionalParams extends OperationOptions {} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/index.ts new file mode 100644 index 000000000000..96089fec3527 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/index.ts @@ -0,0 +1,7 @@ +// Licensed under the MIT License. + +export { + createContainerService, + ContainerServiceContext, + ContainerServiceClientOptionalParams, +} from "./containerServiceContext.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/index.ts new file mode 100644 index 000000000000..8371d659c11a --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/index.ts @@ -0,0 +1,4 @@ +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/operations.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/operations.ts new file mode 100644 index 000000000000..ac9f450231c7 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/operations.ts @@ -0,0 +1,72 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext as Client } from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + Operation, + errorResponseDeserializer, +} from "../../models/models.js"; +import { OperationsListOptionalParams } from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.ContainerService/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 _listDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/options.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/options.ts new file mode 100644 index 000000000000..ed91532bbf70 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/operations/options.ts @@ -0,0 +1,6 @@ +// Licensed under the MIT License. + +import { OperationOptions } from "@typespec/ts-http-runtime"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/index.ts new file mode 100644 index 000000000000..d206c54fc0fb --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/index.ts @@ -0,0 +1,20 @@ +// Licensed under the MIT License. + +export { + skip, + stop, + start, + listByFleet, + $delete, + createOrUpdate, + get, +} from "./operations.js"; +export { + UpdateRunsSkipOptionalParams, + UpdateRunsStopOptionalParams, + UpdateRunsStartOptionalParams, + UpdateRunsListByFleetOptionalParams, + UpdateRunsDeleteOptionalParams, + UpdateRunsCreateOrUpdateOptionalParams, + UpdateRunsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/operations.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/operations.ts new file mode 100644 index 000000000000..fe2bebe0326d --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/operations.ts @@ -0,0 +1,520 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + UpdateRun, + updateRunSerializer, + updateRunDeserializer, + _UpdateRunListResult, + _updateRunListResultDeserializer, + SkipProperties, + skipPropertiesSerializer, +} from "../../models/models.js"; +import { + UpdateRunsSkipOptionalParams, + UpdateRunsStopOptionalParams, + UpdateRunsStartOptionalParams, + UpdateRunsListByFleetOptionalParams, + UpdateRunsDeleteOptionalParams, + UpdateRunsCreateOrUpdateOptionalParams, + UpdateRunsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _skipSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + body: SkipProperties, + options: UpdateRunsSkipOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateRunName: updateRunName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: skipPropertiesSerializer(body), + }); +} + +export async function _skipDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return updateRunDeserializer(result.body); +} + +/** Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. */ +export function skip( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + body: SkipProperties, + options: UpdateRunsSkipOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun> { + return getLongRunningPoller(context, _skipDeserialize, ["202", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _skipSend( + context, + resourceGroupName, + fleetName, + updateRunName, + body, + options, + ), + resourceLocationConfig: "location", + }) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun>; +} + +export function _stopSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options: UpdateRunsStopOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateRunName: updateRunName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _stopDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return updateRunDeserializer(result.body); +} + +/** Stops an UpdateRun. */ +export function stop( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options: UpdateRunsStopOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun> { + return getLongRunningPoller(context, _stopDeserialize, ["202", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _stopSend(context, resourceGroupName, fleetName, updateRunName, options), + resourceLocationConfig: "location", + }) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun>; +} + +export function _startSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options: UpdateRunsStartOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateRunName: updateRunName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _startDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return updateRunDeserializer(result.body); +} + +/** Starts an UpdateRun. */ +export function start( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options: UpdateRunsStartOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun> { + return getLongRunningPoller(context, _startDeserialize, ["202", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _startSend(context, resourceGroupName, fleetName, updateRunName, options), + resourceLocationConfig: "location", + }) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun>; +} + +export function _listByFleetSend( + context: Client, + resourceGroupName: string, + fleetName: string, + options: UpdateRunsListByFleetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + "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 _listByFleetDeserialize( + result: PathUncheckedResponse, +): Promise<_UpdateRunListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _updateRunListResultDeserializer(result.body); +} + +/** List UpdateRun resources by Fleet */ +export function listByFleet( + context: Client, + resourceGroupName: string, + fleetName: string, + options: UpdateRunsListByFleetOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByFleetSend(context, resourceGroupName, fleetName, options), + _listByFleetDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options: UpdateRunsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateRunName: updateRunName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a UpdateRun */ +/** + * @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, + fleetName: string, + updateRunName: string, + options: UpdateRunsDeleteOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + fleetName, + updateRunName, + options, + ), + resourceLocationConfig: "location", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + resource: UpdateRun, + options: UpdateRunsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateRunName: updateRunName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined + ? { "If-Match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "If-None-Match": options?.ifNoneMatch } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: updateRunSerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return updateRunDeserializer(result.body); +} + +/** Create a UpdateRun */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + resource: UpdateRun, + options: UpdateRunsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun> { + return getLongRunningPoller( + context, + _createOrUpdateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + fleetName, + updateRunName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options: UpdateRunsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + fleetName: fleetName, + updateRunName: updateRunName, + "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 updateRunDeserializer(result.body); +} + +/** Get a UpdateRun */ +export async function get( + context: Client, + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options: UpdateRunsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + fleetName, + updateRunName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/options.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/options.ts new file mode 100644 index 000000000000..44573e8046d6 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/api/updateRuns/options.ts @@ -0,0 +1,52 @@ +// Licensed under the MIT License. + +import { OperationOptions } from "@typespec/ts-http-runtime"; + +/** Optional parameters. */ +export interface UpdateRunsSkipOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface UpdateRunsStopOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface UpdateRunsStartOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface UpdateRunsListByFleetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface UpdateRunsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface UpdateRunsCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The request should only proceed if an entity matches this string. */ + ifMatch?: string; + /** The request should only proceed if no entity matches this string. */ + ifNoneMatch?: string; +} + +/** Optional parameters. */ +export interface UpdateRunsGetOptionalParams extends OperationOptions {} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/autoUpgradeProfileOperations/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/autoUpgradeProfileOperations/index.ts new file mode 100644 index 000000000000..3c36480c77a6 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/autoUpgradeProfileOperations/index.ts @@ -0,0 +1,42 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext } from "../../api/containerServiceContext.js"; +import { AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams } from "../../api/autoUpgradeProfileOperations/options.js"; +import { generateUpdateRun } from "../../api/autoUpgradeProfileOperations/operations.js"; + +/** Interface representing a AutoUpgradeProfileOperations operations. */ +export interface AutoUpgradeProfileOperationsOperations { + /** Generates an update run for a given auto upgrade profile. */ + generateUpdateRun: ( + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options?: AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; +} + +function _getAutoUpgradeProfileOperations(context: ContainerServiceContext) { + return { + generateUpdateRun: ( + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options?: AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams, + ) => + generateUpdateRun( + context, + resourceGroupName, + fleetName, + autoUpgradeProfileName, + options, + ), + }; +} + +export function _getAutoUpgradeProfileOperationsOperations( + context: ContainerServiceContext, +): AutoUpgradeProfileOperationsOperations { + return { + ..._getAutoUpgradeProfileOperations(context), + }; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/autoUpgradeProfiles/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/autoUpgradeProfiles/index.ts new file mode 100644 index 000000000000..d3bbd9d3fe43 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/autoUpgradeProfiles/index.ts @@ -0,0 +1,116 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext } from "../../api/containerServiceContext.js"; +import { AutoUpgradeProfile } from "../../models/models.js"; +import { + AutoUpgradeProfilesListByFleetOptionalParams, + AutoUpgradeProfilesDeleteOptionalParams, + AutoUpgradeProfilesCreateOrUpdateOptionalParams, + AutoUpgradeProfilesGetOptionalParams, +} from "../../api/autoUpgradeProfiles/options.js"; +import { + listByFleet, + $delete, + createOrUpdate, + get, +} from "../../api/autoUpgradeProfiles/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a AutoUpgradeProfiles operations. */ +export interface AutoUpgradeProfilesOperations { + /** List AutoUpgradeProfile resources by Fleet */ + listByFleet: ( + resourceGroupName: string, + fleetName: string, + options?: AutoUpgradeProfilesListByFleetOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a AutoUpgradeProfile */ + /** + * @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, + fleetName: string, + autoUpgradeProfileName: string, + options?: AutoUpgradeProfilesDeleteOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; + /** Create a AutoUpgradeProfile */ + createOrUpdate: ( + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + resource: AutoUpgradeProfile, + options?: AutoUpgradeProfilesCreateOrUpdateOptionalParams, + ) => __PLACEHOLDER_o122__< + __PLACEHOLDER_o123__, + AutoUpgradeProfile + >; + /** Get a AutoUpgradeProfile */ + get: ( + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options?: AutoUpgradeProfilesGetOptionalParams, + ) => Promise; +} + +function _getAutoUpgradeProfiles(context: ContainerServiceContext) { + return { + listByFleet: ( + resourceGroupName: string, + fleetName: string, + options?: AutoUpgradeProfilesListByFleetOptionalParams, + ) => listByFleet(context, resourceGroupName, fleetName, options), + delete: ( + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options?: AutoUpgradeProfilesDeleteOptionalParams, + ) => + $delete( + context, + resourceGroupName, + fleetName, + autoUpgradeProfileName, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + resource: AutoUpgradeProfile, + options?: AutoUpgradeProfilesCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + fleetName, + autoUpgradeProfileName, + resource, + options, + ), + get: ( + resourceGroupName: string, + fleetName: string, + autoUpgradeProfileName: string, + options?: AutoUpgradeProfilesGetOptionalParams, + ) => + get( + context, + resourceGroupName, + fleetName, + autoUpgradeProfileName, + options, + ), + }; +} + +export function _getAutoUpgradeProfilesOperations( + context: ContainerServiceContext, +): AutoUpgradeProfilesOperations { + return { + ..._getAutoUpgradeProfiles(context), + }; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleetMembers/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleetMembers/index.ts new file mode 100644 index 000000000000..f4a63fc5c87e --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleetMembers/index.ts @@ -0,0 +1,125 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext } from "../../api/containerServiceContext.js"; +import { FleetMember, FleetMemberUpdate } from "../../models/models.js"; +import { + FleetMembersListByFleetOptionalParams, + FleetMembersDeleteOptionalParams, + FleetMembersUpdateAsyncOptionalParams, + FleetMembersCreateOptionalParams, + FleetMembersGetOptionalParams, +} from "../../api/fleetMembers/options.js"; +import { + listByFleet, + $delete, + updateAsync, + create, + get, +} from "../../api/fleetMembers/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a FleetMembers operations. */ +export interface FleetMembersOperations { + /** List FleetMember resources by Fleet */ + listByFleet: ( + resourceGroupName: string, + fleetName: string, + options?: FleetMembersListByFleetOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a FleetMember */ + /** + * @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, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersDeleteOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; + /** Update a FleetMember */ + updateAsync: ( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + properties: FleetMemberUpdate, + options?: FleetMembersUpdateAsyncOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, FleetMember>; + /** Create a FleetMember */ + create: ( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + resource: FleetMember, + options?: FleetMembersCreateOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, FleetMember>; + /** Get a FleetMember */ + get: ( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersGetOptionalParams, + ) => Promise; +} + +function _getFleetMembers(context: ContainerServiceContext) { + return { + listByFleet: ( + resourceGroupName: string, + fleetName: string, + options?: FleetMembersListByFleetOptionalParams, + ) => listByFleet(context, resourceGroupName, fleetName, options), + delete: ( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersDeleteOptionalParams, + ) => + $delete(context, resourceGroupName, fleetName, fleetMemberName, options), + updateAsync: ( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + properties: FleetMemberUpdate, + options?: FleetMembersUpdateAsyncOptionalParams, + ) => + updateAsync( + context, + resourceGroupName, + fleetName, + fleetMemberName, + properties, + options, + ), + create: ( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + resource: FleetMember, + options?: FleetMembersCreateOptionalParams, + ) => + create( + context, + resourceGroupName, + fleetName, + fleetMemberName, + resource, + options, + ), + get: ( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersGetOptionalParams, + ) => get(context, resourceGroupName, fleetName, fleetMemberName, options), + }; +} + +export function _getFleetMembersOperations( + context: ContainerServiceContext, +): FleetMembersOperations { + return { + ..._getFleetMembers(context), + }; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleetUpdateStrategies/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleetUpdateStrategies/index.ts new file mode 100644 index 000000000000..6201e099988a --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleetUpdateStrategies/index.ts @@ -0,0 +1,110 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext } from "../../api/containerServiceContext.js"; +import { FleetUpdateStrategy } from "../../models/models.js"; +import { + FleetUpdateStrategiesListByFleetOptionalParams, + FleetUpdateStrategiesDeleteOptionalParams, + FleetUpdateStrategiesCreateOrUpdateOptionalParams, + FleetUpdateStrategiesGetOptionalParams, +} from "../../api/fleetUpdateStrategies/options.js"; +import { + listByFleet, + $delete, + createOrUpdate, + get, +} from "../../api/fleetUpdateStrategies/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a FleetUpdateStrategies operations. */ +export interface FleetUpdateStrategiesOperations { + /** List FleetUpdateStrategy resources by Fleet */ + listByFleet: ( + resourceGroupName: string, + fleetName: string, + options?: FleetUpdateStrategiesListByFleetOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a FleetUpdateStrategy */ + /** + * @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, + fleetName: string, + updateStrategyName: string, + options?: FleetUpdateStrategiesDeleteOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; + /** Create a FleetUpdateStrategy */ + createOrUpdate: ( + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + resource: FleetUpdateStrategy, + options?: FleetUpdateStrategiesCreateOrUpdateOptionalParams, + ) => __PLACEHOLDER_o122__< + __PLACEHOLDER_o123__, + FleetUpdateStrategy + >; + /** Get a FleetUpdateStrategy */ + get: ( + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + options?: FleetUpdateStrategiesGetOptionalParams, + ) => Promise; +} + +function _getFleetUpdateStrategies(context: ContainerServiceContext) { + return { + listByFleet: ( + resourceGroupName: string, + fleetName: string, + options?: FleetUpdateStrategiesListByFleetOptionalParams, + ) => listByFleet(context, resourceGroupName, fleetName, options), + delete: ( + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + options?: FleetUpdateStrategiesDeleteOptionalParams, + ) => + $delete( + context, + resourceGroupName, + fleetName, + updateStrategyName, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + resource: FleetUpdateStrategy, + options?: FleetUpdateStrategiesCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + fleetName, + updateStrategyName, + resource, + options, + ), + get: ( + resourceGroupName: string, + fleetName: string, + updateStrategyName: string, + options?: FleetUpdateStrategiesGetOptionalParams, + ) => + get(context, resourceGroupName, fleetName, updateStrategyName, options), + }; +} + +export function _getFleetUpdateStrategiesOperations( + context: ContainerServiceContext, +): FleetUpdateStrategiesOperations { + return { + ..._getFleetUpdateStrategies(context), + }; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleets/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleets/index.ts new file mode 100644 index 000000000000..81c7ad147215 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/fleets/index.ts @@ -0,0 +1,124 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext } from "../../api/containerServiceContext.js"; +import { + Fleet, + FleetPatch, + FleetCredentialResults, +} from "../../models/models.js"; +import { + FleetsListCredentialsOptionalParams, + FleetsListBySubscriptionOptionalParams, + FleetsListByResourceGroupOptionalParams, + FleetsDeleteOptionalParams, + FleetsUpdateAsyncOptionalParams, + FleetsCreateOptionalParams, + FleetsGetOptionalParams, +} from "../../api/fleets/options.js"; +import { + listCredentials, + listBySubscription, + listByResourceGroup, + $delete, + updateAsync, + create, + get, +} from "../../api/fleets/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Fleets operations. */ +export interface FleetsOperations { + /** Lists the user credentials of a Fleet. */ + listCredentials: ( + resourceGroupName: string, + fleetName: string, + options?: FleetsListCredentialsOptionalParams, + ) => Promise; + /** Lists fleets in the specified subscription. */ + listBySubscription: ( + options?: FleetsListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists fleets in the specified subscription and resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: FleetsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a Fleet */ + /** + * @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, + fleetName: string, + options?: FleetsDeleteOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; + /** Update a Fleet */ + updateAsync: ( + resourceGroupName: string, + fleetName: string, + properties: FleetPatch, + options?: FleetsUpdateAsyncOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, Fleet>; + /** Creates or updates a Fleet. */ + create: ( + resourceGroupName: string, + fleetName: string, + resource: Fleet, + options?: FleetsCreateOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, Fleet>; + /** Gets a Fleet. */ + get: ( + resourceGroupName: string, + fleetName: string, + options?: FleetsGetOptionalParams, + ) => Promise; +} + +function _getFleets(context: ContainerServiceContext) { + return { + listCredentials: ( + resourceGroupName: string, + fleetName: string, + options?: FleetsListCredentialsOptionalParams, + ) => listCredentials(context, resourceGroupName, fleetName, options), + listBySubscription: (options?: FleetsListBySubscriptionOptionalParams) => + listBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: FleetsListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + fleetName: string, + options?: FleetsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, fleetName, options), + updateAsync: ( + resourceGroupName: string, + fleetName: string, + properties: FleetPatch, + options?: FleetsUpdateAsyncOptionalParams, + ) => + updateAsync(context, resourceGroupName, fleetName, properties, options), + create: ( + resourceGroupName: string, + fleetName: string, + resource: Fleet, + options?: FleetsCreateOptionalParams, + ) => create(context, resourceGroupName, fleetName, resource, options), + get: ( + resourceGroupName: string, + fleetName: string, + options?: FleetsGetOptionalParams, + ) => get(context, resourceGroupName, fleetName, options), + }; +} + +export function _getFleetsOperations( + context: ContainerServiceContext, +): FleetsOperations { + return { + ..._getFleets(context), + }; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/index.ts new file mode 100644 index 000000000000..77a074336ba1 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/index.ts @@ -0,0 +1,9 @@ +// Licensed under the MIT License. + +export { AutoUpgradeProfileOperationsOperations } from "./autoUpgradeProfileOperations/index.js"; +export { AutoUpgradeProfilesOperations } from "./autoUpgradeProfiles/index.js"; +export { FleetMembersOperations } from "./fleetMembers/index.js"; +export { FleetsOperations } from "./fleets/index.js"; +export { FleetUpdateStrategiesOperations } from "./fleetUpdateStrategies/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { UpdateRunsOperations } from "./updateRuns/index.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/operations/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/operations/index.ts new file mode 100644 index 000000000000..6ee84f7b058c --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/operations/index.ts @@ -0,0 +1,29 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext } from "../../api/containerServiceContext.js"; +import { Operation } from "../../models/models.js"; +import { OperationsListOptionalParams } from "../../api/operations/options.js"; +import { list } from "../../api/operations/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: ( + options?: OperationsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getOperations(context: ContainerServiceContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations( + context: ContainerServiceContext, +): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/updateRuns/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/updateRuns/index.ts new file mode 100644 index 000000000000..cf7279c7f45b --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/classic/updateRuns/index.ts @@ -0,0 +1,147 @@ +// Licensed under the MIT License. + +import { ContainerServiceContext } from "../../api/containerServiceContext.js"; +import { UpdateRun, SkipProperties } from "../../models/models.js"; +import { + UpdateRunsSkipOptionalParams, + UpdateRunsStopOptionalParams, + UpdateRunsStartOptionalParams, + UpdateRunsListByFleetOptionalParams, + UpdateRunsDeleteOptionalParams, + UpdateRunsCreateOrUpdateOptionalParams, + UpdateRunsGetOptionalParams, +} from "../../api/updateRuns/options.js"; +import { + skip, + stop, + start, + listByFleet, + $delete, + createOrUpdate, + get, +} from "../../api/updateRuns/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a UpdateRuns operations. */ +export interface UpdateRunsOperations { + /** Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. */ + skip: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + body: SkipProperties, + options?: UpdateRunsSkipOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun>; + /** Stops an UpdateRun. */ + stop: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options?: UpdateRunsStopOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun>; + /** Starts an UpdateRun. */ + start: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options?: UpdateRunsStartOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun>; + /** List UpdateRun resources by Fleet */ + listByFleet: ( + resourceGroupName: string, + fleetName: string, + options?: UpdateRunsListByFleetOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a UpdateRun */ + /** + * @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, + fleetName: string, + updateRunName: string, + options?: UpdateRunsDeleteOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, void>; + /** Create a UpdateRun */ + createOrUpdate: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + resource: UpdateRun, + options?: UpdateRunsCreateOrUpdateOptionalParams, + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, UpdateRun>; + /** Get a UpdateRun */ + get: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options?: UpdateRunsGetOptionalParams, + ) => Promise; +} + +function _getUpdateRuns(context: ContainerServiceContext) { + return { + skip: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + body: SkipProperties, + options?: UpdateRunsSkipOptionalParams, + ) => + skip(context, resourceGroupName, fleetName, updateRunName, body, options), + stop: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options?: UpdateRunsStopOptionalParams, + ) => stop(context, resourceGroupName, fleetName, updateRunName, options), + start: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options?: UpdateRunsStartOptionalParams, + ) => start(context, resourceGroupName, fleetName, updateRunName, options), + listByFleet: ( + resourceGroupName: string, + fleetName: string, + options?: UpdateRunsListByFleetOptionalParams, + ) => listByFleet(context, resourceGroupName, fleetName, options), + delete: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options?: UpdateRunsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, fleetName, updateRunName, options), + createOrUpdate: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + resource: UpdateRun, + options?: UpdateRunsCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + fleetName, + updateRunName, + resource, + options, + ), + get: ( + resourceGroupName: string, + fleetName: string, + updateRunName: string, + options?: UpdateRunsGetOptionalParams, + ) => get(context, resourceGroupName, fleetName, updateRunName, options), + }; +} + +export function _getUpdateRunsOperations( + context: ContainerServiceContext, +): UpdateRunsOperations { + return { + ..._getUpdateRuns(context), + }; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/containerServiceClient.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/containerServiceClient.ts new file mode 100644 index 000000000000..32535c11eaaa --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/containerServiceClient.ts @@ -0,0 +1,86 @@ +// Licensed under the MIT License. + +import { + createContainerService, + ContainerServiceContext, + ContainerServiceClientOptionalParams, +} from "./api/index.js"; +import { + AutoUpgradeProfileOperationsOperations, + _getAutoUpgradeProfileOperationsOperations, +} from "./classic/autoUpgradeProfileOperations/index.js"; +import { + AutoUpgradeProfilesOperations, + _getAutoUpgradeProfilesOperations, +} from "./classic/autoUpgradeProfiles/index.js"; +import { + FleetUpdateStrategiesOperations, + _getFleetUpdateStrategiesOperations, +} from "./classic/fleetUpdateStrategies/index.js"; +import { + UpdateRunsOperations, + _getUpdateRunsOperations, +} from "./classic/updateRuns/index.js"; +import { + FleetMembersOperations, + _getFleetMembersOperations, +} from "./classic/fleetMembers/index.js"; +import { + FleetsOperations, + _getFleetsOperations, +} from "./classic/fleets/index.js"; +import { + OperationsOperations, + _getOperationsOperations, +} from "./classic/operations/index.js"; +import { Pipeline, TokenCredential } from "@typespec/ts-http-runtime"; + +export { ContainerServiceClientOptionalParams } from "./api/containerServiceContext.js"; + +export class ContainerServiceClient { + private _client: ContainerServiceContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** Azure Kubernetes Fleet Manager api client. */ + constructor( + credential: TokenCredential, + subscriptionId: string, + options: ContainerServiceClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createContainerService(credential, subscriptionId, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.autoUpgradeProfileOperations = + _getAutoUpgradeProfileOperationsOperations(this._client); + this.autoUpgradeProfiles = _getAutoUpgradeProfilesOperations(this._client); + this.fleetUpdateStrategies = _getFleetUpdateStrategiesOperations( + this._client, + ); + this.updateRuns = _getUpdateRunsOperations(this._client); + this.fleetMembers = _getFleetMembersOperations(this._client); + this.fleets = _getFleetsOperations(this._client); + this.operations = _getOperationsOperations(this._client); + } + + /** The operation groups for autoUpgradeProfileOperations */ + public readonly autoUpgradeProfileOperations: AutoUpgradeProfileOperationsOperations; + /** The operation groups for autoUpgradeProfiles */ + public readonly autoUpgradeProfiles: AutoUpgradeProfilesOperations; + /** The operation groups for fleetUpdateStrategies */ + public readonly fleetUpdateStrategies: FleetUpdateStrategiesOperations; + /** The operation groups for updateRuns */ + public readonly updateRuns: UpdateRunsOperations; + /** The operation groups for fleetMembers */ + public readonly fleetMembers: FleetMembersOperations; + /** The operation groups for fleets */ + public readonly fleets: FleetsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/index.ts new file mode 100644 index 000000000000..a57a0ef867b1 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/index.ts @@ -0,0 +1,144 @@ +// Licensed under the MIT License. + +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { ContainerServiceClient } from "./containerServiceClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + Fleet, + FleetProperties, + KnownFleetProvisioningState, + FleetProvisioningState, + FleetHubProfile, + APIServerAccessProfile, + AgentProfile, + FleetStatus, + ManagedServiceIdentity, + KnownManagedServiceIdentityType, + ManagedServiceIdentityType, + UserAssignedIdentity, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + FleetPatch, + FleetCredentialResults, + FleetCredentialResult, + FleetMember, + FleetMemberProperties, + KnownFleetMemberProvisioningState, + FleetMemberProvisioningState, + FleetMemberStatus, + ProxyResource, + FleetMemberUpdate, + FleetMemberUpdateProperties, + UpdateRun, + UpdateRunProperties, + KnownUpdateRunProvisioningState, + UpdateRunProvisioningState, + UpdateRunStrategy, + UpdateStage, + UpdateGroup, + ManagedClusterUpdate, + ManagedClusterUpgradeSpec, + KnownManagedClusterUpgradeType, + ManagedClusterUpgradeType, + NodeImageSelection, + KnownNodeImageSelectionType, + NodeImageSelectionType, + NodeImageVersion, + UpdateRunStatus, + UpdateStatus, + KnownUpdateState, + UpdateState, + UpdateStageStatus, + UpdateGroupStatus, + MemberUpdateStatus, + WaitStatus, + NodeImageSelectionStatus, + SkipProperties, + SkipTarget, + KnownTargetType, + TargetType, + FleetUpdateStrategy, + FleetUpdateStrategyProperties, + KnownFleetUpdateStrategyProvisioningState, + FleetUpdateStrategyProvisioningState, + AutoUpgradeProfile, + AutoUpgradeProfileProperties, + KnownAutoUpgradeProfileProvisioningState, + AutoUpgradeProfileProvisioningState, + KnownUpgradeChannel, + UpgradeChannel, + AutoUpgradeNodeImageSelection, + KnownAutoUpgradeNodeImageSelectionType, + AutoUpgradeNodeImageSelectionType, + AutoUpgradeProfileStatus, + KnownAutoUpgradeLastTriggerStatus, + AutoUpgradeLastTriggerStatus, + KnownVersions, +} from "./models/index.js"; +export { ContainerServiceClientOptionalParams } from "./api/index.js"; +export { AutoUpgradeProfileOperationsGenerateUpdateRunOptionalParams } from "./api/autoUpgradeProfileOperations/index.js"; +export { + AutoUpgradeProfilesListByFleetOptionalParams, + AutoUpgradeProfilesDeleteOptionalParams, + AutoUpgradeProfilesCreateOrUpdateOptionalParams, + AutoUpgradeProfilesGetOptionalParams, +} from "./api/autoUpgradeProfiles/index.js"; +export { + FleetMembersListByFleetOptionalParams, + FleetMembersDeleteOptionalParams, + FleetMembersUpdateAsyncOptionalParams, + FleetMembersCreateOptionalParams, + FleetMembersGetOptionalParams, +} from "./api/fleetMembers/index.js"; +export { + FleetsListCredentialsOptionalParams, + FleetsListBySubscriptionOptionalParams, + FleetsListByResourceGroupOptionalParams, + FleetsDeleteOptionalParams, + FleetsUpdateAsyncOptionalParams, + FleetsCreateOptionalParams, + FleetsGetOptionalParams, +} from "./api/fleets/index.js"; +export { + FleetUpdateStrategiesListByFleetOptionalParams, + FleetUpdateStrategiesDeleteOptionalParams, + FleetUpdateStrategiesCreateOrUpdateOptionalParams, + FleetUpdateStrategiesGetOptionalParams, +} from "./api/fleetUpdateStrategies/index.js"; +export { OperationsListOptionalParams } from "./api/operations/index.js"; +export { + UpdateRunsSkipOptionalParams, + UpdateRunsStopOptionalParams, + UpdateRunsStartOptionalParams, + UpdateRunsListByFleetOptionalParams, + UpdateRunsDeleteOptionalParams, + UpdateRunsCreateOrUpdateOptionalParams, + UpdateRunsGetOptionalParams, +} from "./api/updateRuns/index.js"; +export { + AutoUpgradeProfileOperationsOperations, + AutoUpgradeProfilesOperations, + FleetMembersOperations, + FleetsOperations, + FleetUpdateStrategiesOperations, + OperationsOperations, + UpdateRunsOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/models/index.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/models/index.ts new file mode 100644 index 000000000000..414e24a9fdea --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/models/index.ts @@ -0,0 +1,86 @@ +// Licensed under the MIT License. + +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + Fleet, + FleetProperties, + KnownFleetProvisioningState, + FleetProvisioningState, + FleetHubProfile, + APIServerAccessProfile, + AgentProfile, + FleetStatus, + ManagedServiceIdentity, + KnownManagedServiceIdentityType, + ManagedServiceIdentityType, + UserAssignedIdentity, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + FleetPatch, + FleetCredentialResults, + FleetCredentialResult, + FleetMember, + FleetMemberProperties, + KnownFleetMemberProvisioningState, + FleetMemberProvisioningState, + FleetMemberStatus, + ProxyResource, + FleetMemberUpdate, + FleetMemberUpdateProperties, + UpdateRun, + UpdateRunProperties, + KnownUpdateRunProvisioningState, + UpdateRunProvisioningState, + UpdateRunStrategy, + UpdateStage, + UpdateGroup, + ManagedClusterUpdate, + ManagedClusterUpgradeSpec, + KnownManagedClusterUpgradeType, + ManagedClusterUpgradeType, + NodeImageSelection, + KnownNodeImageSelectionType, + NodeImageSelectionType, + NodeImageVersion, + UpdateRunStatus, + UpdateStatus, + KnownUpdateState, + UpdateState, + UpdateStageStatus, + UpdateGroupStatus, + MemberUpdateStatus, + WaitStatus, + NodeImageSelectionStatus, + SkipProperties, + SkipTarget, + KnownTargetType, + TargetType, + FleetUpdateStrategy, + FleetUpdateStrategyProperties, + KnownFleetUpdateStrategyProvisioningState, + FleetUpdateStrategyProvisioningState, + AutoUpgradeProfile, + AutoUpgradeProfileProperties, + KnownAutoUpgradeProfileProvisioningState, + AutoUpgradeProfileProvisioningState, + KnownUpgradeChannel, + UpgradeChannel, + AutoUpgradeNodeImageSelection, + KnownAutoUpgradeNodeImageSelectionType, + AutoUpgradeNodeImageSelectionType, + AutoUpgradeProfileStatus, + KnownAutoUpgradeLastTriggerStatus, + AutoUpgradeLastTriggerStatus, + KnownVersions, +} from "./models.js"; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/models/models.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/models/models.ts new file mode 100644 index 000000000000..3a1d79194a99 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/models/models.ts @@ -0,0 +1,1942 @@ +// Licensed under the MIT License. + +import { stringToUint8Array } from "@typespec/ts-http-runtime"; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface _OperationListResult { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _operationListResultDeserializer( + item: any, +): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + readonly actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] + ? item["display"] + : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for and operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + User = "user", + /** Indicates the operation is initiated by a system. */ + System = "system", + /** Indicates the operation is initiated by a user or system. */ + UserSystem = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = 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?: Record; +} + +export function errorAdditionalInfoDeserializer( + item: any, +): ErrorAdditionalInfo { + return { + type: item["type"], + info: !item["info"] + ? item["info"] + : _errorAdditionalInfoInfoDeserializer(item["info"]), + }; +} + +/** model interface _ErrorAdditionalInfoInfo */ +export interface _ErrorAdditionalInfoInfo {} + +export function _errorAdditionalInfoInfoDeserializer( + item: any, +): _ErrorAdditionalInfoInfo { + return item; +} + +/** The Fleet resource. */ +export interface Fleet extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: FleetProperties; + /** If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. */ + readonly eTag?: string; + /** Managed identity. */ + identity?: ManagedServiceIdentity; +} + +export function fleetSerializer(item: Fleet): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : fleetPropertiesSerializer(item["properties"]), + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentitySerializer(item["identity"]), + }; +} + +export function fleetDeserializer(item: any): Fleet { + 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"] + : fleetPropertiesDeserializer(item["properties"]), + eTag: item["eTag"], + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentityDeserializer(item["identity"]), + }; +} + +/** Fleet properties. */ +export interface FleetProperties { + /** The status of the last operation. */ + readonly provisioningState?: FleetProvisioningState; + /** The FleetHubProfile configures the Fleet's hub. */ + hubProfile?: FleetHubProfile; + /** Status information for the fleet. */ + readonly status?: FleetStatus; +} + +export function fleetPropertiesSerializer(item: FleetProperties): any { + return { + hubProfile: !item["hubProfile"] + ? item["hubProfile"] + : fleetHubProfileSerializer(item["hubProfile"]), + }; +} + +export function fleetPropertiesDeserializer(item: any): FleetProperties { + return { + provisioningState: item["provisioningState"], + hubProfile: !item["hubProfile"] + ? item["hubProfile"] + : fleetHubProfileDeserializer(item["hubProfile"]), + status: !item["status"] + ? item["status"] + : fleetStatusDeserializer(item["status"]), + }; +} + +/** The provisioning state of the last accepted operation. */ +export enum KnownFleetProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** The provisioning state of a fleet being created. */ + Creating = "Creating", + /** The provisioning state of a fleet being updated. */ + Updating = "Updating", + /** The provisioning state of a fleet being deleted. */ + Deleting = "Deleting", +} + +/** + * The provisioning state of the last accepted operation. \ + * {@link KnownFleetProvisioningState} can be used interchangeably with FleetProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **Creating**: The provisioning state of a fleet being created. \ + * **Updating**: The provisioning state of a fleet being updated. \ + * **Deleting**: The provisioning state of a fleet being deleted. + */ +export type FleetProvisioningState = string; + +/** The FleetHubProfile configures the fleet hub. */ +export interface FleetHubProfile { + /** DNS prefix used to create the FQDN for the Fleet hub. */ + dnsPrefix?: string; + /** The access profile for the Fleet hub API server. */ + apiServerAccessProfile?: APIServerAccessProfile; + /** The agent profile for the Fleet hub. */ + agentProfile?: AgentProfile; + /** The FQDN of the Fleet hub. */ + readonly fqdn?: string; + /** The Kubernetes version of the Fleet hub. */ + readonly kubernetesVersion?: string; + /** The Azure Portal FQDN of the Fleet hub. */ + readonly portalFqdn?: string; +} + +export function fleetHubProfileSerializer(item: FleetHubProfile): any { + return { + dnsPrefix: item["dnsPrefix"], + apiServerAccessProfile: !item["apiServerAccessProfile"] + ? item["apiServerAccessProfile"] + : apiServerAccessProfileSerializer(item["apiServerAccessProfile"]), + agentProfile: !item["agentProfile"] + ? item["agentProfile"] + : agentProfileSerializer(item["agentProfile"]), + }; +} + +export function fleetHubProfileDeserializer(item: any): FleetHubProfile { + return { + dnsPrefix: item["dnsPrefix"], + apiServerAccessProfile: !item["apiServerAccessProfile"] + ? item["apiServerAccessProfile"] + : apiServerAccessProfileDeserializer(item["apiServerAccessProfile"]), + agentProfile: !item["agentProfile"] + ? item["agentProfile"] + : agentProfileDeserializer(item["agentProfile"]), + fqdn: item["fqdn"], + kubernetesVersion: item["kubernetesVersion"], + portalFqdn: item["portalFqdn"], + }; +} + +/** Access profile for the Fleet hub API server. */ +export interface APIServerAccessProfile { + /** Whether to create the Fleet hub as a private cluster or not. */ + enablePrivateCluster?: boolean; + /** Whether to enable apiserver vnet integration for the Fleet hub or not. */ + enableVnetIntegration?: boolean; + /** The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new Fleet with BYO vnet. */ + subnetId?: string; +} + +export function apiServerAccessProfileSerializer( + item: APIServerAccessProfile, +): any { + return { + enablePrivateCluster: item["enablePrivateCluster"], + enableVnetIntegration: item["enableVnetIntegration"], + subnetId: item["subnetId"], + }; +} + +export function apiServerAccessProfileDeserializer( + item: any, +): APIServerAccessProfile { + return { + enablePrivateCluster: item["enablePrivateCluster"], + enableVnetIntegration: item["enableVnetIntegration"], + subnetId: item["subnetId"], + }; +} + +/** Agent profile for the Fleet hub. */ +export interface AgentProfile { + /** The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet will be generated and used. */ + subnetId?: string; + /** The virtual machine size of the Fleet hub. */ + vmSize?: string; +} + +export function agentProfileSerializer(item: AgentProfile): any { + return { subnetId: item["subnetId"], vmSize: item["vmSize"] }; +} + +export function agentProfileDeserializer(item: any): AgentProfile { + return { + subnetId: item["subnetId"], + vmSize: item["vmSize"], + }; +} + +/** Status information for the fleet. */ +export interface FleetStatus { + /** The last operation ID for the fleet. */ + readonly lastOperationId?: string; + /** The last operation error for the fleet. */ + readonly lastOperationError?: ErrorDetail; +} + +export function fleetStatusDeserializer(item: any): FleetStatus { + return { + lastOperationId: item["lastOperationId"], + lastOperationError: !item["lastOperationError"] + ? item["lastOperationError"] + : errorDetailDeserializer(item["lastOperationError"]), + }; +} + +/** Managed service identity (system assigned and/or user assigned identities) */ +export interface ManagedServiceIdentity { + /** The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly principalId?: string; + /** The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly tenantId?: string; + /** The type of managed identity assigned to this resource. */ + type: ManagedServiceIdentityType; + /** The identities assigned to this resource by the user. */ + userAssignedIdentities?: Record; +} + +export function managedServiceIdentitySerializer( + item: ManagedServiceIdentity, +): any { + return { + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userAssignedIdentityRecordSerializer(item["userAssignedIdentities"]), + }; +} + +export function managedServiceIdentityDeserializer( + item: any, +): ManagedServiceIdentity { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userAssignedIdentityRecordDeserializer(item["userAssignedIdentities"]), + }; +} + +/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +export enum KnownManagedServiceIdentityType { + /** No managed identity. */ + None = "None", + /** System assigned managed identity. */ + SystemAssigned = "SystemAssigned", + /** User assigned managed identity. */ + UserAssigned = "UserAssigned", + /** System and user assigned managed identity. */ + SystemAndUserAssigned = "SystemAssigned, UserAssigned", +} + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). \ + * {@link KnownManagedServiceIdentityType} can be used interchangeably with ManagedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: No managed identity. \ + * **SystemAssigned**: System assigned managed identity. \ + * **UserAssigned**: User assigned managed identity. \ + * **SystemAssigned, UserAssigned**: System and user assigned managed identity. + */ +export type ManagedServiceIdentityType = string; + +export function userAssignedIdentityRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : userAssignedIdentitySerializer(item[key]); + }); + return result; +} + +export function userAssignedIdentityRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : userAssignedIdentityDeserializer(item[key]); + }); + return result; +} + +/** User assigned identity properties */ +export interface UserAssignedIdentity { + /** The client ID of the assigned identity. */ + readonly clientId?: string; + /** The principal ID of the assigned identity. */ + readonly principalId?: string; +} + +export function userAssignedIdentitySerializer( + item: UserAssignedIdentity, +): any { + return item; +} + +export function userAssignedIdentityDeserializer( + item: any, +): UserAssignedIdentity { + return { + clientId: item["clientId"], + principalId: item["principalId"], + }; +} + +/** 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; + +/** Properties of a Fleet that can be patched. */ +export interface FleetPatch { + /** Resource tags. */ + tags?: Record; + /** Managed identity. */ + identity?: ManagedServiceIdentity; +} + +export function fleetPatchSerializer(item: FleetPatch): any { + return { + tags: item["tags"], + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentitySerializer(item["identity"]), + }; +} + +/** The response of a Fleet list operation. */ +export interface _FleetListResult { + /** The Fleet items on this page */ + value: Fleet[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _fleetListResultDeserializer(item: any): _FleetListResult { + return { + value: fleetArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function fleetArraySerializer(result: Array): any[] { + return result.map((item) => { + return fleetSerializer(item); + }); +} + +export function fleetArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return fleetDeserializer(item); + }); +} + +/** The Credential results response. */ +export interface FleetCredentialResults { + /** Array of base64-encoded Kubernetes configuration files. */ + readonly kubeconfigs?: FleetCredentialResult[]; +} + +export function fleetCredentialResultsDeserializer( + item: any, +): FleetCredentialResults { + return { + kubeconfigs: !item["kubeconfigs"] + ? item["kubeconfigs"] + : fleetCredentialResultArrayDeserializer(item["kubeconfigs"]), + }; +} + +export function fleetCredentialResultArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return fleetCredentialResultDeserializer(item); + }); +} + +/** One credential result item. */ +export interface FleetCredentialResult { + /** The name of the credential. */ + readonly name?: string; + /** Base64-encoded Kubernetes configuration file. */ + readonly value?: Uint8Array; +} + +export function fleetCredentialResultDeserializer( + item: any, +): FleetCredentialResult { + return { + name: item["name"], + value: !item["value"] + ? item["value"] + : typeof item["value"] === "string" + ? stringToUint8Array(item["value"], "base64") + : item["value"], + }; +} + +/** A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. */ +export interface FleetMember extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: FleetMemberProperties; + /** If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. */ + readonly eTag?: string; +} + +export function fleetMemberSerializer(item: FleetMember): any { + return { + properties: !item["properties"] + ? item["properties"] + : fleetMemberPropertiesSerializer(item["properties"]), + }; +} + +export function fleetMemberDeserializer(item: any): FleetMember { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : fleetMemberPropertiesDeserializer(item["properties"]), + eTag: item["eTag"], + }; +} + +/** A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. */ +export interface FleetMemberProperties { + /** The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. */ + clusterResourceId: string; + /** The group this member belongs to for multi-cluster update management. */ + group?: string; + /** The status of the last operation. */ + readonly provisioningState?: FleetMemberProvisioningState; + /** Status information of the last operation for fleet member. */ + readonly status?: FleetMemberStatus; +} + +export function fleetMemberPropertiesSerializer( + item: FleetMemberProperties, +): any { + return { clusterResourceId: item["clusterResourceId"], group: item["group"] }; +} + +export function fleetMemberPropertiesDeserializer( + item: any, +): FleetMemberProperties { + return { + clusterResourceId: item["clusterResourceId"], + group: item["group"], + provisioningState: item["provisioningState"], + status: !item["status"] + ? item["status"] + : fleetMemberStatusDeserializer(item["status"]), + }; +} + +/** The provisioning state of the last accepted operation. */ +export enum KnownFleetMemberProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** The provisioning state of a member joining a fleet. */ + Joining = "Joining", + /** The provisioning state of a member leaving a fleet. */ + Leaving = "Leaving", + /** The provisioning state of a member being updated. */ + Updating = "Updating", +} + +/** + * The provisioning state of the last accepted operation. \ + * {@link KnownFleetMemberProvisioningState} can be used interchangeably with FleetMemberProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **Joining**: The provisioning state of a member joining a fleet. \ + * **Leaving**: The provisioning state of a member leaving a fleet. \ + * **Updating**: The provisioning state of a member being updated. + */ +export type FleetMemberProvisioningState = string; + +/** Status information for the fleet member */ +export interface FleetMemberStatus { + /** The last operation ID for the fleet member */ + readonly lastOperationId?: string; + /** The last operation error of the fleet member */ + readonly lastOperationError?: ErrorDetail; +} + +export function fleetMemberStatusDeserializer(item: any): FleetMemberStatus { + return { + lastOperationId: item["lastOperationId"], + lastOperationError: !item["lastOperationError"] + ? item["lastOperationError"] + : errorDetailDeserializer(item["lastOperationError"]), + }; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** The type used for update operations of the FleetMember. */ +export interface FleetMemberUpdate { + /** The resource-specific properties for this resource. */ + properties?: FleetMemberUpdateProperties; +} + +export function fleetMemberUpdateSerializer(item: FleetMemberUpdate): any { + return { + properties: !item["properties"] + ? item["properties"] + : fleetMemberUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the FleetMember. */ +export interface FleetMemberUpdateProperties { + /** The group this member belongs to for multi-cluster update management. */ + group?: string; +} + +export function fleetMemberUpdatePropertiesSerializer( + item: FleetMemberUpdateProperties, +): any { + return { group: item["group"] }; +} + +/** The response of a FleetMember list operation. */ +export interface _FleetMemberListResult { + /** The FleetMember items on this page */ + value: FleetMember[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _fleetMemberListResultDeserializer( + item: any, +): _FleetMemberListResult { + return { + value: fleetMemberArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function fleetMemberArraySerializer(result: Array): any[] { + return result.map((item) => { + return fleetMemberSerializer(item); + }); +} + +export function fleetMemberArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return fleetMemberDeserializer(item); + }); +} + +/** A multi-stage process to perform update operations across members of a Fleet. */ +export interface UpdateRun extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: UpdateRunProperties; + /** If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. */ + readonly eTag?: string; +} + +export function updateRunSerializer(item: UpdateRun): any { + return { + properties: !item["properties"] + ? item["properties"] + : updateRunPropertiesSerializer(item["properties"]), + }; +} + +export function updateRunDeserializer(item: any): UpdateRun { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : updateRunPropertiesDeserializer(item["properties"]), + eTag: item["eTag"], + }; +} + +/** The properties of the UpdateRun. */ +export interface UpdateRunProperties { + /** The provisioning state of the UpdateRun resource. */ + readonly provisioningState?: UpdateRunProvisioningState; + /** + * The resource id of the FleetUpdateStrategy resource to reference. + * + * When creating a new run, there are three ways to define a strategy for the run: + * 1. Define a new strategy in place: Set the "strategy" field. + * 2. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) + * 3. Use the default strategy to update all the members one by one: Leave both "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) + * + * Setting both "updateStrategyId" and "strategy" is invalid. + * + * UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of creation and store it in the "strategy" field. + * Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. + * UpdateRunStrategy changes can be made directly on the "strategy" field before launching the UpdateRun. + */ + updateStrategyId?: string; + /** + * The strategy defines the order in which the clusters will be updated. + * If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. + * The strategy of the UpdateRun can be modified until the run is started. + */ + strategy?: UpdateRunStrategy; + /** The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. */ + managedClusterUpdate: ManagedClusterUpdate; + /** The status of the UpdateRun. */ + readonly status?: UpdateRunStatus; + /** AutoUpgradeProfileId is the id of an auto upgrade profile resource. */ + readonly autoUpgradeProfileId?: string; +} + +export function updateRunPropertiesSerializer(item: UpdateRunProperties): any { + return { + updateStrategyId: item["updateStrategyId"], + strategy: !item["strategy"] + ? item["strategy"] + : updateRunStrategySerializer(item["strategy"]), + managedClusterUpdate: managedClusterUpdateSerializer( + item["managedClusterUpdate"], + ), + }; +} + +export function updateRunPropertiesDeserializer( + item: any, +): UpdateRunProperties { + return { + provisioningState: item["provisioningState"], + updateStrategyId: item["updateStrategyId"], + strategy: !item["strategy"] + ? item["strategy"] + : updateRunStrategyDeserializer(item["strategy"]), + managedClusterUpdate: managedClusterUpdateDeserializer( + item["managedClusterUpdate"], + ), + status: !item["status"] + ? item["status"] + : updateRunStatusDeserializer(item["status"]), + autoUpgradeProfileId: item["autoUpgradeProfileId"], + }; +} + +/** The provisioning state of the UpdateRun resource. */ +export enum KnownUpdateRunProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", +} + +/** + * The provisioning state of the UpdateRun resource. \ + * {@link KnownUpdateRunProvisioningState} can be used interchangeably with UpdateRunProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. + */ +export type UpdateRunProvisioningState = string; + +/** + * Defines the update sequence of the clusters via stages and groups. + * + * Stages within a run are executed sequentially one after another. + * Groups within a stage are executed in parallel. + * Member clusters within a group are updated sequentially one after another. + * + * A valid strategy contains no duplicate groups within or across stages. + */ +export interface UpdateRunStrategy { + /** The list of stages that compose this update run. Min size: 1. */ + stages: UpdateStage[]; +} + +export function updateRunStrategySerializer(item: UpdateRunStrategy): any { + return { stages: updateStageArraySerializer(item["stages"]) }; +} + +export function updateRunStrategyDeserializer(item: any): UpdateRunStrategy { + return { + stages: updateStageArrayDeserializer(item["stages"]), + }; +} + +export function updateStageArraySerializer(result: Array): any[] { + return result.map((item) => { + return updateStageSerializer(item); + }); +} + +export function updateStageArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return updateStageDeserializer(item); + }); +} + +/** Defines a stage which contains the groups to update and the steps to take (e.g., wait for a time period) before starting the next stage. */ +export interface UpdateStage { + /** The name of the stage. Must be unique within the UpdateRun. */ + name: string; + /** Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1. */ + groups?: UpdateGroup[]; + /** The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. */ + afterStageWaitInSeconds?: number; +} + +export function updateStageSerializer(item: UpdateStage): any { + return { + name: item["name"], + groups: !item["groups"] + ? item["groups"] + : updateGroupArraySerializer(item["groups"]), + afterStageWaitInSeconds: item["afterStageWaitInSeconds"], + }; +} + +export function updateStageDeserializer(item: any): UpdateStage { + return { + name: item["name"], + groups: !item["groups"] + ? item["groups"] + : updateGroupArrayDeserializer(item["groups"]), + afterStageWaitInSeconds: item["afterStageWaitInSeconds"], + }; +} + +export function updateGroupArraySerializer(result: Array): any[] { + return result.map((item) => { + return updateGroupSerializer(item); + }); +} + +export function updateGroupArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return updateGroupDeserializer(item); + }); +} + +/** A group to be updated. */ +export interface UpdateGroup { + /** + * Name of the group. + * It must match a group name of an existing fleet member. + */ + name: string; +} + +export function updateGroupSerializer(item: UpdateGroup): any { + return { name: item["name"] }; +} + +export function updateGroupDeserializer(item: any): UpdateGroup { + return { + name: item["name"], + }; +} + +/** The update to be applied to the ManagedClusters. */ +export interface ManagedClusterUpdate { + /** The upgrade to apply to the ManagedClusters. */ + upgrade: ManagedClusterUpgradeSpec; + /** The node image upgrade to be applied to the target nodes in update run. */ + nodeImageSelection?: NodeImageSelection; +} + +export function managedClusterUpdateSerializer( + item: ManagedClusterUpdate, +): any { + return { + upgrade: managedClusterUpgradeSpecSerializer(item["upgrade"]), + nodeImageSelection: !item["nodeImageSelection"] + ? item["nodeImageSelection"] + : nodeImageSelectionSerializer(item["nodeImageSelection"]), + }; +} + +export function managedClusterUpdateDeserializer( + item: any, +): ManagedClusterUpdate { + return { + upgrade: managedClusterUpgradeSpecDeserializer(item["upgrade"]), + nodeImageSelection: !item["nodeImageSelection"] + ? item["nodeImageSelection"] + : nodeImageSelectionDeserializer(item["nodeImageSelection"]), + }; +} + +/** The upgrade to apply to a ManagedCluster. */ +export interface ManagedClusterUpgradeSpec { + /** ManagedClusterUpgradeType is the type of upgrade to be applied. */ + type: ManagedClusterUpgradeType; + /** The Kubernetes version to upgrade the member clusters to. */ + kubernetesVersion?: string; +} + +export function managedClusterUpgradeSpecSerializer( + item: ManagedClusterUpgradeSpec, +): any { + return { type: item["type"], kubernetesVersion: item["kubernetesVersion"] }; +} + +export function managedClusterUpgradeSpecDeserializer( + item: any, +): ManagedClusterUpgradeSpec { + return { + type: item["type"], + kubernetesVersion: item["kubernetesVersion"], + }; +} + +/** The type of upgrade to perform when targeting ManagedClusters. */ +export enum KnownManagedClusterUpgradeType { + /** Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to be set. */ + Full = "Full", + /** NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set. */ + NodeImageOnly = "NodeImageOnly", + /** ControlPlaneOnly upgrades only targets the KubernetesVersion of the ManagedClusters and will not be applied to the AgentPool. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to be set. */ + ControlPlaneOnly = "ControlPlaneOnly", +} + +/** + * The type of upgrade to perform when targeting ManagedClusters. \ + * {@link KnownManagedClusterUpgradeType} can be used interchangeably with ManagedClusterUpgradeType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Full**: Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to be set. \ + * **NodeImageOnly**: NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set. \ + * **ControlPlaneOnly**: ControlPlaneOnly upgrades only targets the KubernetesVersion of the ManagedClusters and will not be applied to the AgentPool. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to be set. + */ +export type ManagedClusterUpgradeType = string; + +/** The node image upgrade to be applied to the target nodes in update run. */ +export interface NodeImageSelection { + /** The node image upgrade type. */ + type: NodeImageSelectionType; + /** Custom node image versions to upgrade the nodes to. This field is required if node image selection type is Custom. Otherwise, it must be empty. For each node image family (e.g., 'AKSUbuntu-1804gen2containerd'), this field can contain at most one version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' or 'AKSUbuntu-1804gen2containerd-2023.02.12', not both). If the nodes belong to a family without a matching image version in this field, they are not upgraded. */ + customNodeImageVersions?: NodeImageVersion[]; +} + +export function nodeImageSelectionSerializer(item: NodeImageSelection): any { + return { + type: item["type"], + customNodeImageVersions: !item["customNodeImageVersions"] + ? item["customNodeImageVersions"] + : nodeImageVersionArraySerializer(item["customNodeImageVersions"]), + }; +} + +export function nodeImageSelectionDeserializer(item: any): NodeImageSelection { + return { + type: item["type"], + customNodeImageVersions: !item["customNodeImageVersions"] + ? item["customNodeImageVersions"] + : nodeImageVersionArrayDeserializer(item["customNodeImageVersions"]), + }; +} + +/** The node image upgrade type. */ +export enum KnownNodeImageSelectionType { + /** Use the latest image version when upgrading nodes. Clusters may use different image versions (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') because, for example, the latest available version is different in different regions. */ + Latest = "Latest", + /** The image versions to upgrade nodes to are selected as described below: for each node pool in managed clusters affected by the update run, the system selects the latest image version such that it is available across all other node pools (in all other clusters) of the same image type. As a result, all node pools of the same image type will be upgraded to the same image version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'. */ + Consistent = "Consistent", + /** Upgrade the nodes to the custom image versions. When set, update run will use node image versions provided in customNodeImageVersions to upgrade the nodes. If set, customNodeImageVersions must not be empty. */ + Custom = "Custom", +} + +/** + * The node image upgrade type. \ + * {@link KnownNodeImageSelectionType} can be used interchangeably with NodeImageSelectionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Latest**: Use the latest image version when upgrading nodes. Clusters may use different image versions (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') because, for example, the latest available version is different in different regions. \ + * **Consistent**: The image versions to upgrade nodes to are selected as described below: for each node pool in managed clusters affected by the update run, the system selects the latest image version such that it is available across all other node pools (in all other clusters) of the same image type. As a result, all node pools of the same image type will be upgraded to the same image version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'. \ + * **Custom**: Upgrade the nodes to the custom image versions. When set, update run will use node image versions provided in customNodeImageVersions to upgrade the nodes. If set, customNodeImageVersions must not be empty. + */ +export type NodeImageSelectionType = string; + +export function nodeImageVersionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return nodeImageVersionSerializer(item); + }); +} + +export function nodeImageVersionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return nodeImageVersionDeserializer(item); + }); +} + +/** The node upgrade image version. */ +export interface NodeImageVersion { + /** The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). */ + readonly version?: string; +} + +export function nodeImageVersionSerializer(item: NodeImageVersion): any { + return item; +} + +export function nodeImageVersionDeserializer(item: any): NodeImageVersion { + return { + version: item["version"], + }; +} + +/** The status of a UpdateRun. */ +export interface UpdateRunStatus { + /** The status of the UpdateRun. */ + readonly status?: UpdateStatus; + /** The stages composing an update run. Stages are run sequentially withing an UpdateRun. */ + readonly stages?: UpdateStageStatus[]; + /** The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` is `Consistent`. */ + readonly nodeImageSelection?: NodeImageSelectionStatus; +} + +export function updateRunStatusDeserializer(item: any): UpdateRunStatus { + return { + status: !item["status"] + ? item["status"] + : updateStatusDeserializer(item["status"]), + stages: !item["stages"] + ? item["stages"] + : updateStageStatusArrayDeserializer(item["stages"]), + nodeImageSelection: !item["nodeImageSelection"] + ? item["nodeImageSelection"] + : nodeImageSelectionStatusDeserializer(item["nodeImageSelection"]), + }; +} + +/** The status for an operation or group of operations. */ +export interface UpdateStatus { + /** The time the operation or group was started. */ + readonly startTime?: Date; + /** The time the operation or group was completed. */ + readonly completedTime?: Date; + /** The State of the operation or group. */ + readonly state?: UpdateState; + /** The error details when a failure is encountered. */ + readonly error?: ErrorDetail; +} + +export function updateStatusDeserializer(item: any): UpdateStatus { + return { + startTime: !item["startTime"] + ? item["startTime"] + : new Date(item["startTime"]), + completedTime: !item["completedTime"] + ? item["completedTime"] + : new Date(item["completedTime"]), + state: item["state"], + error: !item["error"] + ? item["error"] + : errorDetailDeserializer(item["error"]), + }; +} + +/** The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate. */ +export enum KnownUpdateState { + /** The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started. */ + NotStarted = "NotStarted", + /** The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running. */ + Running = "Running", + /** The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped. */ + Stopping = "Stopping", + /** The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped. */ + Stopped = "Stopped", + /** The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped. */ + Skipped = "Skipped", + /** The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed. */ + Failed = "Failed", + /** The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed. */ + Completed = "Completed", +} + +/** + * The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate. \ + * {@link KnownUpdateState} can be used interchangeably with UpdateState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotStarted**: The state of an UpdateRun\/UpdateStage\/UpdateGroup\/MemberUpdate that has not been started. \ + * **Running**: The state of an UpdateRun\/UpdateStage\/UpdateGroup\/MemberUpdate that is running. \ + * **Stopping**: The state of an UpdateRun\/UpdateStage\/UpdateGroup\/MemberUpdate that is being stopped. \ + * **Stopped**: The state of an UpdateRun\/UpdateStage\/UpdateGroup\/MemberUpdate that has stopped. \ + * **Skipped**: The state of an UpdateRun\/UpdateStage\/UpdateGroup\/MemberUpdate that has been skipped. \ + * **Failed**: The state of an UpdateRun\/UpdateStage\/UpdateGroup\/MemberUpdate that has failed. \ + * **Completed**: The state of an UpdateRun\/UpdateStage\/UpdateGroup\/MemberUpdate that has completed. + */ +export type UpdateState = string; + +export function updateStageStatusArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return updateStageStatusDeserializer(item); + }); +} + +/** The status of a UpdateStage. */ +export interface UpdateStageStatus { + /** The status of the UpdateStage. */ + readonly status?: UpdateStatus; + /** The name of the UpdateStage. */ + readonly name?: string; + /** The list of groups to be updated as part of this UpdateStage. */ + readonly groups?: UpdateGroupStatus[]; + /** The status of the wait period configured on the UpdateStage. */ + readonly afterStageWaitStatus?: WaitStatus; +} + +export function updateStageStatusDeserializer(item: any): UpdateStageStatus { + return { + status: !item["status"] + ? item["status"] + : updateStatusDeserializer(item["status"]), + name: item["name"], + groups: !item["groups"] + ? item["groups"] + : updateGroupStatusArrayDeserializer(item["groups"]), + afterStageWaitStatus: !item["afterStageWaitStatus"] + ? item["afterStageWaitStatus"] + : waitStatusDeserializer(item["afterStageWaitStatus"]), + }; +} + +export function updateGroupStatusArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return updateGroupStatusDeserializer(item); + }); +} + +/** The status of a UpdateGroup. */ +export interface UpdateGroupStatus { + /** The status of the UpdateGroup. */ + readonly status?: UpdateStatus; + /** The name of the UpdateGroup. */ + readonly name?: string; + /** The list of member this UpdateGroup updates. */ + readonly members?: MemberUpdateStatus[]; +} + +export function updateGroupStatusDeserializer(item: any): UpdateGroupStatus { + return { + status: !item["status"] + ? item["status"] + : updateStatusDeserializer(item["status"]), + name: item["name"], + members: !item["members"] + ? item["members"] + : memberUpdateStatusArrayDeserializer(item["members"]), + }; +} + +export function memberUpdateStatusArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return memberUpdateStatusDeserializer(item); + }); +} + +/** The status of a member update operation. */ +export interface MemberUpdateStatus { + /** The status of the MemberUpdate operation. */ + readonly status?: UpdateStatus; + /** The name of the FleetMember. */ + readonly name?: string; + /** The Azure resource id of the target Kubernetes cluster. */ + readonly clusterResourceId?: string; + /** The operation resource id of the latest attempt to perform the operation. */ + readonly operationId?: string; + /** The status message after processing the member update operation. */ + readonly message?: string; +} + +export function memberUpdateStatusDeserializer(item: any): MemberUpdateStatus { + return { + status: !item["status"] + ? item["status"] + : updateStatusDeserializer(item["status"]), + name: item["name"], + clusterResourceId: item["clusterResourceId"], + operationId: item["operationId"], + message: item["message"], + }; +} + +/** The status of the wait duration. */ +export interface WaitStatus { + /** The status of the wait duration. */ + readonly status?: UpdateStatus; + /** The wait duration configured in seconds. */ + readonly waitDurationInSeconds?: number; +} + +export function waitStatusDeserializer(item: any): WaitStatus { + return { + status: !item["status"] + ? item["status"] + : updateStatusDeserializer(item["status"]), + waitDurationInSeconds: item["waitDurationInSeconds"], + }; +} + +/** The node image upgrade specs for the update run. */ +export interface NodeImageSelectionStatus { + /** The image versions to upgrade the nodes to. */ + readonly selectedNodeImageVersions?: NodeImageVersion[]; +} + +export function nodeImageSelectionStatusDeserializer( + item: any, +): NodeImageSelectionStatus { + return { + selectedNodeImageVersions: !item["selectedNodeImageVersions"] + ? item["selectedNodeImageVersions"] + : nodeImageVersionArrayDeserializer(item["selectedNodeImageVersions"]), + }; +} + +/** The response of a UpdateRun list operation. */ +export interface _UpdateRunListResult { + /** The UpdateRun items on this page */ + value: UpdateRun[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _updateRunListResultDeserializer( + item: any, +): _UpdateRunListResult { + return { + value: updateRunArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function updateRunArraySerializer(result: Array): any[] { + return result.map((item) => { + return updateRunSerializer(item); + }); +} + +export function updateRunArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return updateRunDeserializer(item); + }); +} + +/** The properties of a skip operation containing multiple skip requests. */ +export interface SkipProperties { + /** The targets to skip. */ + targets: SkipTarget[]; +} + +export function skipPropertiesSerializer(item: SkipProperties): any { + return { targets: skipTargetArraySerializer(item["targets"]) }; +} + +export function skipTargetArraySerializer(result: Array): any[] { + return result.map((item) => { + return skipTargetSerializer(item); + }); +} + +/** The definition of a single skip request. */ +export interface SkipTarget { + /** The skip target type. */ + type: TargetType; + /** + * The skip target's name. + * To skip a member/group/stage, use the member/group/stage's name; + * Tp skip an after stage wait, use the parent stage's name. + */ + name: string; +} + +export function skipTargetSerializer(item: SkipTarget): any { + return { type: item["type"], name: item["name"] }; +} + +/** The target type of a skip request. */ +export enum KnownTargetType { + /** Skip the update of a member. */ + Member = "Member", + /** Skip the update of a group. */ + Group = "Group", + /** Skip the update of an entire stage including the after stage wait. */ + Stage = "Stage", + /** Skip the update of the after stage wait of a certain stage. */ + AfterStageWait = "AfterStageWait", +} + +/** + * The target type of a skip request. \ + * {@link KnownTargetType} can be used interchangeably with TargetType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Member**: Skip the update of a member. \ + * **Group**: Skip the update of a group. \ + * **Stage**: Skip the update of an entire stage including the after stage wait. \ + * **AfterStageWait**: Skip the update of the after stage wait of a certain stage. + */ +export type TargetType = string; + +/** Defines a multi-stage process to perform update operations across members of a Fleet. */ +export interface FleetUpdateStrategy extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: FleetUpdateStrategyProperties; + /** If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. */ + readonly eTag?: string; +} + +export function fleetUpdateStrategySerializer(item: FleetUpdateStrategy): any { + return { + properties: !item["properties"] + ? item["properties"] + : fleetUpdateStrategyPropertiesSerializer(item["properties"]), + }; +} + +export function fleetUpdateStrategyDeserializer( + item: any, +): FleetUpdateStrategy { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : fleetUpdateStrategyPropertiesDeserializer(item["properties"]), + eTag: item["eTag"], + }; +} + +/** The properties of the UpdateStrategy. */ +export interface FleetUpdateStrategyProperties { + /** The provisioning state of the UpdateStrategy resource. */ + readonly provisioningState?: FleetUpdateStrategyProvisioningState; + /** Defines the update sequence of the clusters. */ + strategy: UpdateRunStrategy; +} + +export function fleetUpdateStrategyPropertiesSerializer( + item: FleetUpdateStrategyProperties, +): any { + return { strategy: updateRunStrategySerializer(item["strategy"]) }; +} + +export function fleetUpdateStrategyPropertiesDeserializer( + item: any, +): FleetUpdateStrategyProperties { + return { + provisioningState: item["provisioningState"], + strategy: updateRunStrategyDeserializer(item["strategy"]), + }; +} + +/** The provisioning state of the UpdateStrategy resource. */ +export enum KnownFleetUpdateStrategyProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", +} + +/** + * The provisioning state of the UpdateStrategy resource. \ + * {@link KnownFleetUpdateStrategyProvisioningState} can be used interchangeably with FleetUpdateStrategyProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. + */ +export type FleetUpdateStrategyProvisioningState = string; + +/** The response of a FleetUpdateStrategy list operation. */ +export interface _FleetUpdateStrategyListResult { + /** The FleetUpdateStrategy items on this page */ + value: FleetUpdateStrategy[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _fleetUpdateStrategyListResultDeserializer( + item: any, +): _FleetUpdateStrategyListResult { + return { + value: fleetUpdateStrategyArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function fleetUpdateStrategyArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return fleetUpdateStrategySerializer(item); + }); +} + +export function fleetUpdateStrategyArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return fleetUpdateStrategyDeserializer(item); + }); +} + +/** The AutoUpgradeProfile resource. */ +export interface AutoUpgradeProfile extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: AutoUpgradeProfileProperties; + /** If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. */ + readonly eTag?: string; +} + +export function autoUpgradeProfileSerializer(item: AutoUpgradeProfile): any { + return { + properties: !item["properties"] + ? item["properties"] + : autoUpgradeProfilePropertiesSerializer(item["properties"]), + }; +} + +export function autoUpgradeProfileDeserializer(item: any): AutoUpgradeProfile { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : autoUpgradeProfilePropertiesDeserializer(item["properties"]), + eTag: item["eTag"], + }; +} + +/** The properties of the AutoUpgradeProfile. */ +export interface AutoUpgradeProfileProperties { + /** The provisioning state of the AutoUpgradeProfile resource. */ + readonly provisioningState?: AutoUpgradeProfileProvisioningState; + /** The resource id of the UpdateStrategy resource to reference. If not specified, the auto upgrade will run on all clusters which are members of the fleet. */ + updateStrategyId?: string; + /** Configures how auto-upgrade will be run. */ + channel: UpgradeChannel; + /** The node image upgrade to be applied to the target clusters in auto upgrade. */ + nodeImageSelection?: AutoUpgradeNodeImageSelection; + /** + * If set to False: the auto upgrade has effect - target managed clusters will be upgraded on schedule. + * If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed clusters. + * This is a boolean and not an enum because enabled/disabled are all available states of the auto upgrade profile. + * By default, this is set to False. + */ + disabled?: boolean; + /** The status of the auto upgrade profile. */ + autoUpgradeProfileStatus?: AutoUpgradeProfileStatus; +} + +export function autoUpgradeProfilePropertiesSerializer( + item: AutoUpgradeProfileProperties, +): any { + return { + updateStrategyId: item["updateStrategyId"], + channel: item["channel"], + nodeImageSelection: !item["nodeImageSelection"] + ? item["nodeImageSelection"] + : autoUpgradeNodeImageSelectionSerializer(item["nodeImageSelection"]), + disabled: item["disabled"], + autoUpgradeProfileStatus: !item["autoUpgradeProfileStatus"] + ? item["autoUpgradeProfileStatus"] + : autoUpgradeProfileStatusSerializer(item["autoUpgradeProfileStatus"]), + }; +} + +export function autoUpgradeProfilePropertiesDeserializer( + item: any, +): AutoUpgradeProfileProperties { + return { + provisioningState: item["provisioningState"], + updateStrategyId: item["updateStrategyId"], + channel: item["channel"], + nodeImageSelection: !item["nodeImageSelection"] + ? item["nodeImageSelection"] + : autoUpgradeNodeImageSelectionDeserializer(item["nodeImageSelection"]), + disabled: item["disabled"], + autoUpgradeProfileStatus: !item["autoUpgradeProfileStatus"] + ? item["autoUpgradeProfileStatus"] + : autoUpgradeProfileStatusDeserializer(item["autoUpgradeProfileStatus"]), + }; +} + +/** The provisioning state of the AutoUpgradeProfile resource. */ +export enum KnownAutoUpgradeProfileProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", +} + +/** + * The provisioning state of the AutoUpgradeProfile resource. \ + * {@link KnownAutoUpgradeProfileProvisioningState} can be used interchangeably with AutoUpgradeProfileProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. + */ +export type AutoUpgradeProfileProvisioningState = string; + +/** Configuration of how auto upgrade will be run. */ +export enum KnownUpgradeChannel { + /** + * Upgrades the clusters kubernetes version to the latest supported patch release on minor version N-1, where N is the latest supported minor version. + * For example, if a cluster runs version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, the cluster upgrades to 1.18.6. + */ + Stable = "Stable", + /** Upgrades the clusters kubernetes version to the latest supported patch release on the latest supported minor version. */ + Rapid = "Rapid", + /** Upgrade node image version of the clusters. */ + NodeImage = "NodeImage", +} + +/** + * Configuration of how auto upgrade will be run. \ + * {@link KnownUpgradeChannel} can be used interchangeably with UpgradeChannel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Stable**: Upgrades the clusters kubernetes version to the latest supported patch release on minor version N-1, where N is the latest supported minor version. + * For example, if a cluster runs version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, the cluster upgrades to 1.18.6. \ + * **Rapid**: Upgrades the clusters kubernetes version to the latest supported patch release on the latest supported minor version. \ + * **NodeImage**: Upgrade node image version of the clusters. + */ +export type UpgradeChannel = string; + +/** The node image upgrade to be applied to the target clusters in auto upgrade. */ +export interface AutoUpgradeNodeImageSelection { + /** The node image upgrade type. */ + type: AutoUpgradeNodeImageSelectionType; +} + +export function autoUpgradeNodeImageSelectionSerializer( + item: AutoUpgradeNodeImageSelection, +): any { + return { type: item["type"] }; +} + +export function autoUpgradeNodeImageSelectionDeserializer( + item: any, +): AutoUpgradeNodeImageSelection { + return { + type: item["type"], + }; +} + +/** The node image upgrade type. */ +export enum KnownAutoUpgradeNodeImageSelectionType { + /** Use the latest image version when upgrading nodes. Clusters may use different image versions (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') because, for example, the latest available version is different in different regions. */ + Latest = "Latest", + /** The image versions to upgrade nodes to are selected as described below: for each node pool in managed clusters affected by the update run, the system selects the latest image version such that it is available across all other node pools (in all other clusters) of the same image type. As a result, all node pools of the same image type will be upgraded to the same image version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'. */ + Consistent = "Consistent", +} + +/** + * The node image upgrade type. \ + * {@link KnownAutoUpgradeNodeImageSelectionType} can be used interchangeably with AutoUpgradeNodeImageSelectionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Latest**: Use the latest image version when upgrading nodes. Clusters may use different image versions (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') because, for example, the latest available version is different in different regions. \ + * **Consistent**: The image versions to upgrade nodes to are selected as described below: for each node pool in managed clusters affected by the update run, the system selects the latest image version such that it is available across all other node pools (in all other clusters) of the same image type. As a result, all node pools of the same image type will be upgraded to the same image version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'. + */ +export type AutoUpgradeNodeImageSelectionType = string; + +/** AutoUpgradeProfileStatus is the status of an auto upgrade profile. */ +export interface AutoUpgradeProfileStatus { + /** The UTC time of the last attempt to automatically create and start an UpdateRun as triggered by the release of new versions. */ + readonly lastTriggeredAt?: Date; + /** The status of the last AutoUpgrade trigger. */ + readonly lastTriggerStatus?: AutoUpgradeLastTriggerStatus; + /** The error details of the last trigger. */ + readonly lastTriggerError?: ErrorDetail; + /** The target Kubernetes version or node image versions of the last trigger. */ + readonly lastTriggerUpgradeVersions?: string[]; +} + +export function autoUpgradeProfileStatusSerializer( + item: AutoUpgradeProfileStatus, +): any { + return item; +} + +export function autoUpgradeProfileStatusDeserializer( + item: any, +): AutoUpgradeProfileStatus { + return { + lastTriggeredAt: !item["lastTriggeredAt"] + ? item["lastTriggeredAt"] + : new Date(item["lastTriggeredAt"]), + lastTriggerStatus: item["lastTriggerStatus"], + lastTriggerError: !item["lastTriggerError"] + ? item["lastTriggerError"] + : errorDetailDeserializer(item["lastTriggerError"]), + lastTriggerUpgradeVersions: !item["lastTriggerUpgradeVersions"] + ? item["lastTriggerUpgradeVersions"] + : item["lastTriggerUpgradeVersions"].map((p: any) => { + return p; + }), + }; +} + +/** AutoUpgradeLastTriggerStatus is the status of the last AutoUpgrade trigger (attempt to automatically create and start UpdateRun when there are new released versions) of an auto upgrade profile. */ +export enum KnownAutoUpgradeLastTriggerStatus { + /** The last AutoUpgrade trigger was succeeded. */ + Succeeded = "Succeeded", + /** The last AutoUpgrade trigger failed. */ + Failed = "Failed", +} + +/** + * AutoUpgradeLastTriggerStatus is the status of the last AutoUpgrade trigger (attempt to automatically create and start UpdateRun when there are new released versions) of an auto upgrade profile. \ + * {@link KnownAutoUpgradeLastTriggerStatus} can be used interchangeably with AutoUpgradeLastTriggerStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: The last AutoUpgrade trigger was succeeded. \ + * **Failed**: The last AutoUpgrade trigger failed. + */ +export type AutoUpgradeLastTriggerStatus = string; + +/** The response of a AutoUpgradeProfile list operation. */ +export interface _AutoUpgradeProfileListResult { + /** The AutoUpgradeProfile items on this page */ + value: AutoUpgradeProfile[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _autoUpgradeProfileListResultDeserializer( + item: any, +): _AutoUpgradeProfileListResult { + return { + value: autoUpgradeProfileArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function autoUpgradeProfileArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return autoUpgradeProfileSerializer(item); + }); +} + +export function autoUpgradeProfileArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return autoUpgradeProfileDeserializer(item); + }); +} + +/** Azure Kubernetes Fleet Manager api versions. */ +export enum KnownVersions { + /** Azure Kubernetes Fleet Manager api version 2023-10-15. */ + V20231015 = "2023-10-15", + /** Azure Kubernetes Fleet Manager api version 2024-04-01. */ + V20240401 = "2024-04-01", + /** Azure Kubernetes Fleet Manager api version 2025-03-01. */ + V20250301 = "2025-03-01", +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/restorePollerHelpers.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..8bb4dff39e6a --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/restorePollerHelpers.ts @@ -0,0 +1,244 @@ +// Licensed under the MIT License. + +import { ContainerServiceClient } from "./containerServiceClient.js"; +import { _generateUpdateRunDeserialize } from "./api/autoUpgradeProfileOperations/operations.js"; +import { + _$deleteDeserialize, + _createOrUpdateDeserialize, +} from "./api/autoUpgradeProfiles/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeFleetUpdateStrategies, + _createOrUpdateDeserialize as _createOrUpdateDeserializeFleetUpdateStrategies, +} from "./api/fleetUpdateStrategies/operations.js"; +import { + _skipDeserialize, + _stopDeserialize, + _startDeserialize, + _$deleteDeserialize as _$deleteDeserializeUpdateRuns, + _createOrUpdateDeserialize as _createOrUpdateDeserializeUpdateRuns, +} from "./api/updateRuns/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeFleetMembers, + _updateAsyncDeserialize, + _createDeserialize, +} from "./api/fleetMembers/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeFleets, + _updateAsyncDeserialize as _updateAsyncDeserializeFleets, + _createDeserialize as _createDeserializeFleets, +} from "./api/fleets/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { + OperationOptions, + PathUncheckedResponse, + AbortSignalLike, +} from "@typespec/ts-http-runtime"; + +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: ContainerServiceClient, + serializedState: string, + sourceOperation: ( + ...args: any[] + ) => __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, TResult>, + options?: RestorePollerOptions, +): __PLACEHOLDER_o122__<__PLACEHOLDER_o123__, TResult> { + const pollerConfig = __PLACEHOLDER_o132__(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 + | __PLACEHOLDER_o134__ + | 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: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}/generateUpdateRun": + { + deserializer: _generateUpdateRunDeserialize, + expectedStatuses: ["202", "200"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}": + { + deserializer: _$deleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}": + { + deserializer: _createOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}": + { + deserializer: _$deleteDeserializeFleetUpdateStrategies, + expectedStatuses: ["200", "202", "204"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}": + { + deserializer: _createOrUpdateDeserializeFleetUpdateStrategies, + expectedStatuses: ["200", "201"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip": + { deserializer: _skipDeserialize, expectedStatuses: ["202", "200"] }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop": + { deserializer: _stopDeserialize, expectedStatuses: ["202", "200"] }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start": + { deserializer: _startDeserialize, expectedStatuses: ["202", "200"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}": + { + deserializer: _$deleteDeserializeUpdateRuns, + expectedStatuses: ["200", "202", "204"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}": + { + deserializer: _createOrUpdateDeserializeUpdateRuns, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}": + { + deserializer: _$deleteDeserializeFleetMembers, + expectedStatuses: ["200", "202", "204"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}": + { deserializer: _updateAsyncDeserialize, expectedStatuses: ["200", "202"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}": + { deserializer: _createDeserialize, expectedStatuses: ["200", "201"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}": + { + deserializer: _$deleteDeserializeFleets, + expectedStatuses: ["200", "202", "204"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}": + { + deserializer: _updateAsyncDeserializeFleets, + expectedStatuses: ["200", "202"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}": + { + deserializer: _createDeserializeFleets, + expectedStatuses: ["200", "201"], + }, +}; + +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/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/pagingHelpers.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..39c2ece980ec --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,273 @@ +// Licensed under the MIT License. + +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@typespec/ts-http-runtime"; +import { RestError } from "@typespec/ts-http-runtime"; + +/** + * 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< + TElement, + TPage, + TPageSettings + >; + /** + * 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; +} + +/** + * 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 pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : 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< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + 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/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/pollingHelpers.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..200a3752827d --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,136 @@ +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { + Client, + PathUncheckedResponse, + createRestError, +} from "@typespec/ts-http-runtime"; +import { 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< + TResponse extends PathUncheckedResponse, + TResult = void, +>( + 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/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/urlTemplate.ts b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..776b87f3c407 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/static-helpers/urlTemplate.ts @@ -0,0 +1,199 @@ +// 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) { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: 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) { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any) { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [ + !!op && [";", "?", "&"].includes(op), + !!op && ["?", "&"].includes(op) ? "=" : "", + ]; +} + +function getFirstOrSep(op?: string, isFirst = false) { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions) { + 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)}`); + val === "" ? vals.push(ifEmpty) : 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)}`); + named && val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions) { + 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); + val === "" ? vals.push(ifEmpty) : 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 { + return 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(""); + }); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/tsconfig.json b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/tsconfig.json new file mode 100644 index 000000000000..758d8a0ae1e3 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "ES2017", + "module": "NodeNext", + "lib": [], + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "sourceMap": true, + "importHelpers": true, + "strict": true, + "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "NodeNext", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "paths": { + "azure-resourcemanager-containerservicefleet": ["./src/index"] + } + }, + "include": ["src/**/*.ts", "samples-dev/**/*.ts"] +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/tsp-location.yaml b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/tsp-location.yaml new file mode 100644 index 000000000000..7c67d233e11f --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/containerservice/Fleet.Management +commit: 88ad03595e8e35c4422e55fb93f7e822fee6e1ce +repo: ../azure-rest-api-specs +additionalDirectories: