From e2b3c14fa865d81d2a736ad835019d0aa762f287 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 25 Aug 2023 18:01:26 +0800 Subject: [PATCH] [mgmt] maintenance release (#26687) https://github.com/Azure/sdk-release-request/issues/4342 swagger pr https://github.com/Azure/azure-rest-api-specs/pull/25106 --- .github/CODEOWNERS | 4 + common/config/rush/pnpm-lock.yaml | 30 + eng/ignore-links.txt | 1 + rush.json | 5 + sdk/maintenance/arm-maintenance/CHANGELOG.md | 5 + sdk/maintenance/arm-maintenance/LICENSE | 21 + sdk/maintenance/arm-maintenance/README.md | 109 +++ sdk/maintenance/arm-maintenance/_meta.json | 8 + .../arm-maintenance/api-extractor.json | 31 + sdk/maintenance/arm-maintenance/assets.json | 6 + sdk/maintenance/arm-maintenance/package.json | 121 +++ .../review/arm-maintenance.api.md | 597 +++++++++++++++ .../arm-maintenance/rollup.config.js | 122 +++ sdk/maintenance/arm-maintenance/sample.env | 4 + .../applyUpdateForResourceGroupListSample.ts | 44 ++ .../applyUpdatesCreateOrUpdateParentSample.ts | 51 ++ .../applyUpdatesCreateOrUpdateSample.ts | 47 ++ .../applyUpdatesGetParentSample.ts | 53 ++ .../samples-dev/applyUpdatesGetSample.ts | 49 ++ .../samples-dev/applyUpdatesListSample.ts | 40 + ...onAssignmentsCreateOrUpdateParentSample.ts | 61 ++ ...gurationAssignmentsCreateOrUpdateSample.ts | 57 ++ ...figurationAssignmentsDeleteParentSample.ts | 53 ++ .../configurationAssignmentsDeleteSample.ts | 49 ++ ...ntsForResourceGroupCreateOrUpdateSample.ts | 65 ++ ...AssignmentsForResourceGroupDeleteSample.ts | 43 ++ ...ionAssignmentsForResourceGroupGetSample.ts | 43 ++ ...AssignmentsForResourceGroupUpdateSample.ts | 65 ++ ...ntsForSubscriptionsCreateOrUpdateSample.ts | 63 ++ ...AssignmentsForSubscriptionsDeleteSample.ts | 40 + ...ionAssignmentsForSubscriptionsGetSample.ts | 40 + ...AssignmentsForSubscriptionsUpdateSample.ts | 63 ++ ...configurationAssignmentsGetParentSample.ts | 53 ++ .../configurationAssignmentsGetSample.ts | 49 ++ ...onfigurationAssignmentsListParentSample.ts | 54 ++ .../configurationAssignmentsListSample.ts | 50 ++ ...AssignmentsWithinSubscriptionListSample.ts | 40 + ...nanceConfigurationsCreateOrUpdateSample.ts | 58 ++ .../maintenanceConfigurationsDeleteSample.ts | 43 ++ ...onfigurationsForResourceGroupListSample.ts | 44 ++ .../maintenanceConfigurationsGetSample.ts | 89 +++ .../maintenanceConfigurationsListSample.ts | 40 + .../maintenanceConfigurationsUpdateSample.ts | 58 ++ .../samples-dev/operationsListSample.ts | 40 + ...ublicMaintenanceConfigurationsGetSample.ts | 38 + ...blicMaintenanceConfigurationsListSample.ts | 40 + .../samples-dev/updatesListParentSample.ts | 54 ++ .../samples-dev/updatesListSample.ts | 50 ++ .../samples/v1-beta/javascript/README.md | 116 +++ .../applyUpdateForResourceGroupListSample.js | 38 + .../applyUpdatesCreateOrUpdateParentSample.js | 47 ++ .../applyUpdatesCreateOrUpdateSample.js | 43 ++ .../javascript/applyUpdatesGetParentSample.js | 49 ++ .../javascript/applyUpdatesGetSample.js | 45 ++ .../javascript/applyUpdatesListSample.js | 37 + ...onAssignmentsCreateOrUpdateParentSample.js | 54 ++ ...gurationAssignmentsCreateOrUpdateSample.js | 50 ++ ...figurationAssignmentsDeleteParentSample.js | 49 ++ .../configurationAssignmentsDeleteSample.js | 45 ++ ...ntsForResourceGroupCreateOrUpdateSample.js | 55 ++ ...AssignmentsForResourceGroupDeleteSample.js | 39 + ...ionAssignmentsForResourceGroupGetSample.js | 39 + ...AssignmentsForResourceGroupUpdateSample.js | 55 ++ ...ntsForSubscriptionsCreateOrUpdateSample.js | 54 ++ ...AssignmentsForSubscriptionsDeleteSample.js | 37 + ...ionAssignmentsForSubscriptionsGetSample.js | 37 + ...AssignmentsForSubscriptionsUpdateSample.js | 54 ++ ...configurationAssignmentsGetParentSample.js | 49 ++ .../configurationAssignmentsGetSample.js | 45 ++ ...onfigurationAssignmentsListParentSample.js | 50 ++ .../configurationAssignmentsListSample.js | 46 ++ ...AssignmentsWithinSubscriptionListSample.js | 37 + ...nanceConfigurationsCreateOrUpdateSample.js | 51 ++ .../maintenanceConfigurationsDeleteSample.js | 36 + ...onfigurationsForResourceGroupListSample.js | 38 + .../maintenanceConfigurationsGetSample.js | 72 ++ .../maintenanceConfigurationsListSample.js | 37 + .../maintenanceConfigurationsUpdateSample.js | 51 ++ .../javascript/operationsListSample.js | 37 + .../samples/v1-beta/javascript/package.json | 32 + ...ublicMaintenanceConfigurationsGetSample.js | 35 + ...blicMaintenanceConfigurationsListSample.js | 37 + .../samples/v1-beta/javascript/sample.env | 4 + .../javascript/updatesListParentSample.js | 50 ++ .../v1-beta/javascript/updatesListSample.js | 46 ++ .../samples/v1-beta/typescript/README.md | 129 ++++ .../samples/v1-beta/typescript/package.json | 41 + .../samples/v1-beta/typescript/sample.env | 4 + .../applyUpdateForResourceGroupListSample.ts | 44 ++ .../applyUpdatesCreateOrUpdateParentSample.ts | 51 ++ .../src/applyUpdatesCreateOrUpdateSample.ts | 47 ++ .../src/applyUpdatesGetParentSample.ts | 53 ++ .../typescript/src/applyUpdatesGetSample.ts | 49 ++ .../typescript/src/applyUpdatesListSample.ts | 40 + ...onAssignmentsCreateOrUpdateParentSample.ts | 61 ++ ...gurationAssignmentsCreateOrUpdateSample.ts | 57 ++ ...figurationAssignmentsDeleteParentSample.ts | 53 ++ .../configurationAssignmentsDeleteSample.ts | 49 ++ ...ntsForResourceGroupCreateOrUpdateSample.ts | 65 ++ ...AssignmentsForResourceGroupDeleteSample.ts | 43 ++ ...ionAssignmentsForResourceGroupGetSample.ts | 43 ++ ...AssignmentsForResourceGroupUpdateSample.ts | 65 ++ ...ntsForSubscriptionsCreateOrUpdateSample.ts | 63 ++ ...AssignmentsForSubscriptionsDeleteSample.ts | 40 + ...ionAssignmentsForSubscriptionsGetSample.ts | 40 + ...AssignmentsForSubscriptionsUpdateSample.ts | 63 ++ ...configurationAssignmentsGetParentSample.ts | 53 ++ .../src/configurationAssignmentsGetSample.ts | 49 ++ ...onfigurationAssignmentsListParentSample.ts | 54 ++ .../src/configurationAssignmentsListSample.ts | 50 ++ ...AssignmentsWithinSubscriptionListSample.ts | 40 + ...nanceConfigurationsCreateOrUpdateSample.ts | 58 ++ .../maintenanceConfigurationsDeleteSample.ts | 43 ++ ...onfigurationsForResourceGroupListSample.ts | 44 ++ .../src/maintenanceConfigurationsGetSample.ts | 89 +++ .../maintenanceConfigurationsListSample.ts | 40 + .../maintenanceConfigurationsUpdateSample.ts | 58 ++ .../typescript/src/operationsListSample.ts | 40 + ...ublicMaintenanceConfigurationsGetSample.ts | 38 + ...blicMaintenanceConfigurationsListSample.ts | 40 + .../typescript/src/updatesListParentSample.ts | 54 ++ .../typescript/src/updatesListSample.ts | 50 ++ .../samples/v1-beta/typescript/tsconfig.json | 17 + sdk/maintenance/arm-maintenance/src/index.ts | 13 + .../src/maintenanceManagementClient.ts | 197 +++++ .../arm-maintenance/src/models/index.ts | 637 ++++++++++++++++ .../arm-maintenance/src/models/mappers.ts | 705 +++++++++++++++++ .../arm-maintenance/src/models/parameters.ts | 188 +++++ .../operations/applyUpdateForResourceGroup.ts | 118 +++ .../src/operations/applyUpdates.ts | 340 +++++++++ .../operations/configurationAssignments.ts | 706 ++++++++++++++++++ ...onfigurationAssignmentsForResourceGroup.ts | 219 ++++++ ...onfigurationAssignmentsForSubscriptions.ts | 197 +++++ ...figurationAssignmentsWithinSubscription.ts | 105 +++ .../arm-maintenance/src/operations/index.ts | 19 + .../operations/maintenanceConfigurations.ts | 281 +++++++ ...intenanceConfigurationsForResourceGroup.ts | 118 +++ .../src/operations/operations.ts | 103 +++ .../publicMaintenanceConfigurations.ts | 143 ++++ .../arm-maintenance/src/operations/updates.ts | 322 ++++++++ .../applyUpdateForResourceGroup.ts | 27 + .../src/operationsInterfaces/applyUpdates.ts | 105 +++ .../configurationAssignments.ts | 183 +++++ ...onfigurationAssignmentsForResourceGroup.ts | 71 ++ ...onfigurationAssignmentsForSubscriptions.ts | 63 ++ ...figurationAssignmentsWithinSubscription.ts | 25 + .../src/operationsInterfaces/index.ts | 19 + .../maintenanceConfigurations.ts | 81 ++ ...intenanceConfigurationsForResourceGroup.ts | 27 + .../src/operationsInterfaces/operations.ts | 22 + .../publicMaintenanceConfigurations.ts | 36 + .../src/operationsInterfaces/updates.ts | 53 ++ .../arm-maintenance/src/pagingHelper.ts | 39 + .../test/maintenance_operations_test.spec.ts | 102 +++ sdk/maintenance/arm-maintenance/tsconfig.json | 33 + sdk/maintenance/ci.mgmt.yml | 38 + 156 files changed, 11738 insertions(+) create mode 100644 sdk/maintenance/arm-maintenance/CHANGELOG.md create mode 100644 sdk/maintenance/arm-maintenance/LICENSE create mode 100644 sdk/maintenance/arm-maintenance/README.md create mode 100644 sdk/maintenance/arm-maintenance/_meta.json create mode 100644 sdk/maintenance/arm-maintenance/api-extractor.json create mode 100644 sdk/maintenance/arm-maintenance/assets.json create mode 100644 sdk/maintenance/arm-maintenance/package.json create mode 100644 sdk/maintenance/arm-maintenance/review/arm-maintenance.api.md create mode 100644 sdk/maintenance/arm-maintenance/rollup.config.js create mode 100644 sdk/maintenance/arm-maintenance/sample.env create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/applyUpdateForResourceGroupListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesCreateOrUpdateParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesGetParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsCreateOrUpdateParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsDeleteParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsDeleteSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupDeleteSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsDeleteSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsGetParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsListParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsWithinSubscriptionListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsDeleteSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsForResourceGroupListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/operationsListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/publicMaintenanceConfigurationsGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/publicMaintenanceConfigurationsListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/updatesListParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples-dev/updatesListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/README.md create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdateForResourceGroupListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateParentSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetParentSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateParentSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteParentSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupCreateOrUpdateSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupDeleteSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupGetSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupUpdateSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsDeleteSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsGetSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsUpdateSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetParentSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListParentSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsWithinSubscriptionListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsCreateOrUpdateSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsDeleteSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsForResourceGroupListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsGetSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsUpdateSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/operationsListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/package.json create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsGetSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/sample.env create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListParentSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListSample.js create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/README.md create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/package.json create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/sample.env create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdateForResourceGroupListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupDeleteSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsDeleteSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsWithinSubscriptionListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsCreateOrUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsDeleteSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsForResourceGroupListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsUpdateSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/operationsListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsGetSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListParentSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListSample.ts create mode 100644 sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/tsconfig.json create mode 100644 sdk/maintenance/arm-maintenance/src/index.ts create mode 100644 sdk/maintenance/arm-maintenance/src/maintenanceManagementClient.ts create mode 100644 sdk/maintenance/arm-maintenance/src/models/index.ts create mode 100644 sdk/maintenance/arm-maintenance/src/models/mappers.ts create mode 100644 sdk/maintenance/arm-maintenance/src/models/parameters.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/applyUpdateForResourceGroup.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/applyUpdates.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/configurationAssignments.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsForResourceGroup.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsForSubscriptions.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsWithinSubscription.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/index.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/maintenanceConfigurations.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/maintenanceConfigurationsForResourceGroup.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/operations.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/publicMaintenanceConfigurations.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operations/updates.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/applyUpdateForResourceGroup.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/applyUpdates.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignments.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsForResourceGroup.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsForSubscriptions.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsWithinSubscription.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/index.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/maintenanceConfigurations.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/maintenanceConfigurationsForResourceGroup.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/operations.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/publicMaintenanceConfigurations.ts create mode 100644 sdk/maintenance/arm-maintenance/src/operationsInterfaces/updates.ts create mode 100644 sdk/maintenance/arm-maintenance/src/pagingHelper.ts create mode 100644 sdk/maintenance/arm-maintenance/test/maintenance_operations_test.spec.ts create mode 100644 sdk/maintenance/arm-maintenance/tsconfig.json create mode 100644 sdk/maintenance/ci.mgmt.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b5a2d8e38fe6..0bbb51cd79a7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -917,6 +917,10 @@ /sdk/sphere/arm-sphere/ @qiaozha @MaryGao /sdk/sphere/ci.mgmt.yml @qiaozha @MaryGao +# PRLabel: %Mgmt +/sdk/maintenance/arm-maintenance/ @qiaozha @MaryGao +/sdk/maintenance/ci.mgmt.yml @qiaozha @MaryGao + # PRLabel: %Mgmt /sdk/chaos/arm-chaos/ @qiaozha @MaryGao /sdk/chaos/ci.mgmt.yml @qiaozha @MaryGao diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index dcf4d08a1464..eaac94f66b02 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -132,6 +132,7 @@ specifiers: '@rush-temp/arm-machinelearning': file:./projects/arm-machinelearning.tgz '@rush-temp/arm-machinelearningcompute': file:./projects/arm-machinelearningcompute.tgz '@rush-temp/arm-machinelearningexperimentation': file:./projects/arm-machinelearningexperimentation.tgz + '@rush-temp/arm-maintenance': file:./projects/arm-maintenance.tgz '@rush-temp/arm-managedapplications': file:./projects/arm-managedapplications.tgz '@rush-temp/arm-managednetworkfabric': file:./projects/arm-managednetworkfabric.tgz '@rush-temp/arm-managementgroups': file:./projects/arm-managementgroups.tgz @@ -493,6 +494,7 @@ dependencies: '@rush-temp/arm-machinelearning': file:projects/arm-machinelearning.tgz '@rush-temp/arm-machinelearningcompute': file:projects/arm-machinelearningcompute.tgz '@rush-temp/arm-machinelearningexperimentation': file:projects/arm-machinelearningexperimentation.tgz + '@rush-temp/arm-maintenance': file:projects/arm-maintenance.tgz '@rush-temp/arm-managedapplications': file:projects/arm-managedapplications.tgz '@rush-temp/arm-managednetworkfabric': file:projects/arm-managednetworkfabric.tgz '@rush-temp/arm-managementgroups': file:projects/arm-managementgroups.tgz @@ -13441,6 +13443,34 @@ packages: - supports-color dev: false + file:projects/arm-maintenance.tgz: + resolution: {integrity: sha512-i07OIams7Sxy9QKJUfC+PSRpBdUUZIEzno/4VVw4R7k/mreyPcqDQCeXiYSmGfKmup9ceGZWeU8wMnFxJrr2Jw==, tarball: file:projects/arm-maintenance.tgz} + name: '@rush-temp/arm-maintenance' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.36.4_@types+node@14.18.54 + '@rollup/plugin-commonjs': 24.1.0_rollup@2.79.1 + '@rollup/plugin-json': 6.0.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 6.0.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.5 + '@types/node': 14.18.54 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 16.3.1 + mkdirp: 2.1.6 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_dmbj5memikchm63lpeyt6ukdau + tslib: 2.6.2 + typescript: 5.0.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/arm-managedapplications.tgz: resolution: {integrity: sha512-l+pncXDhFwTze0AYcleRnD0vjlPpyRmwtCDgpmVDSa3L/7UFMKJN8sSusWW9fzn3Y7Aigl0xIW/vYNgyUr7rTw==, tarball: file:projects/arm-managedapplications.tgz} name: '@rush-temp/arm-managedapplications' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index e44757dba6a6..a0e678b87b45 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -26,6 +26,7 @@ https://docs.microsoft.com/javascript/api/@azure/arm-managednetworkfabric?view=a https://docs.microsoft.com/javascript/api/@azure/arm-iotfirmwaredefense?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-quantum?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-sphere?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/arm-maintenance?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-apicenter?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-defendereasm?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-resourcesdeploymentstacks?view=azure-node-preview diff --git a/rush.json b/rush.json index d4c8745d6d97..b6f940e8ebf9 100644 --- a/rush.json +++ b/rush.json @@ -2065,6 +2065,11 @@ "projectFolder": "sdk/sphere/arm-sphere", "versionPolicyName": "management" }, + { + "packageName": "@azure/arm-maintenance", + "projectFolder": "sdk/maintenance/arm-maintenance", + "versionPolicyName": "management" + }, { "packageName": "@azure/arm-resourcesdeploymentstacks", "projectFolder": "sdk/resourcesdeploymentstacks/arm-resourcesdeploymentstacks", diff --git a/sdk/maintenance/arm-maintenance/CHANGELOG.md b/sdk/maintenance/arm-maintenance/CHANGELOG.md new file mode 100644 index 000000000000..28cd10fbd73f --- /dev/null +++ b/sdk/maintenance/arm-maintenance/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-08-02) + +The package of @azure/arm-maintenance is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/maintenance/arm-maintenance/LICENSE b/sdk/maintenance/arm-maintenance/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/maintenance/arm-maintenance/README.md b/sdk/maintenance/arm-maintenance/README.md new file mode 100644 index 000000000000..dc616f1115c0 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/README.md @@ -0,0 +1,109 @@ +# Azure MaintenanceManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MaintenanceManagement client. + +Azure Maintenance Management Client + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maintenance/arm-maintenance) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-maintenance) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-maintenance?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-maintenance` package + +Install the Azure MaintenanceManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-maintenance +``` + +### Create and authenticate a `MaintenanceManagementClient` + +To create a client object to access the Azure MaintenanceManagement API, you will need the `endpoint` of your Azure MaintenanceManagement resource and a `credential`. The Azure MaintenanceManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure MaintenanceManagement resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure MaintenanceManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new MaintenanceManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new MaintenanceManagementClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### MaintenanceManagementClient + +`MaintenanceManagementClient` is the primary interface for developers using the Azure MaintenanceManagement client library. Explore the methods on this client object to understand the different features of the Azure MaintenanceManagement service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmaintenance%2Farm-maintenance%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/maintenance/arm-maintenance/_meta.json b/sdk/maintenance/arm-maintenance/_meta.json new file mode 100644 index 000000000000..dc724372be25 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "4ebdf8f60d425e4f14afa83d9a3f6d3ef905efa7", + "readme": "specification/maintenance/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\maintenance\\resource-manager\\readme.md --use=@autorest/typescript@6.0.5 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", + "use": "@autorest/typescript@6.0.5" +} \ No newline at end of file diff --git a/sdk/maintenance/arm-maintenance/api-extractor.json b/sdk/maintenance/arm-maintenance/api-extractor.json new file mode 100644 index 000000000000..ecce91913103 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-maintenance.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/maintenance/arm-maintenance/assets.json b/sdk/maintenance/arm-maintenance/assets.json new file mode 100644 index 000000000000..2c0403608a8d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "js", + "TagPrefix": "js/maintenance/arm-maintenance", + "Tag": "js/maintenance/arm-maintenance_a8e723f91c" +} diff --git a/sdk/maintenance/arm-maintenance/package.json b/sdk/maintenance/arm-maintenance/package.json new file mode 100644 index 000000000000..8a08f010bfc1 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/package.json @@ -0,0 +1,121 @@ +{ + "name": "@azure/arm-maintenance", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for MaintenanceManagementClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-maintenance.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-multi-entry": "^6.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^2.1.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~5.0.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "dotenv": "^16.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^14.0.0", + "@azure/dev-tool": "^1.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/maintenanceManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maintenance/arm-maintenance", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-maintenance?view=azure-node-preview" + } +} diff --git a/sdk/maintenance/arm-maintenance/review/arm-maintenance.api.md b/sdk/maintenance/arm-maintenance/review/arm-maintenance.api.md new file mode 100644 index 000000000000..174377346207 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/review/arm-maintenance.api.md @@ -0,0 +1,597 @@ +## API Report File for "@azure/arm-maintenance" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; + +// @public +export interface ApplyUpdate extends Resource { + lastUpdateTime?: Date; + resourceId?: string; + status?: UpdateStatus; +} + +// @public +export interface ApplyUpdateForResourceGroup { + list(resourceGroupName: string, options?: ApplyUpdateForResourceGroupListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ApplyUpdateForResourceGroupListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplyUpdateForResourceGroupListResponse = ListApplyUpdate; + +// @public +export interface ApplyUpdates { + createOrUpdate(resourceGroupName: string, providerName: string, resourceType: string, resourceName: string, options?: ApplyUpdatesCreateOrUpdateOptionalParams): Promise; + createOrUpdateParent(resourceGroupName: string, providerName: string, resourceParentType: string, resourceParentName: string, resourceType: string, resourceName: string, options?: ApplyUpdatesCreateOrUpdateParentOptionalParams): Promise; + get(resourceGroupName: string, providerName: string, resourceType: string, resourceName: string, applyUpdateName: string, options?: ApplyUpdatesGetOptionalParams): Promise; + getParent(resourceGroupName: string, providerName: string, resourceParentType: string, resourceParentName: string, resourceType: string, resourceName: string, applyUpdateName: string, options?: ApplyUpdatesGetParentOptionalParams): Promise; + list(options?: ApplyUpdatesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ApplyUpdatesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ApplyUpdatesCreateOrUpdateParentOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplyUpdatesCreateOrUpdateParentResponse = ApplyUpdate; + +// @public +export type ApplyUpdatesCreateOrUpdateResponse = ApplyUpdate; + +// @public +export interface ApplyUpdatesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ApplyUpdatesGetParentOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplyUpdatesGetParentResponse = ApplyUpdate; + +// @public +export type ApplyUpdatesGetResponse = ApplyUpdate; + +// @public +export interface ApplyUpdatesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplyUpdatesListResponse = ListApplyUpdate; + +// @public +export interface ConfigurationAssignment extends Resource { + filter?: ConfigurationAssignmentFilterProperties; + location?: string; + maintenanceConfigurationId?: string; + resourceId?: string; +} + +// @public +export interface ConfigurationAssignmentFilterProperties { + locations?: string[]; + osTypes?: string[]; + resourceGroups?: string[]; + resourceTypes?: string[]; + tagSettings?: TagSettingsProperties; +} + +// @public +export interface ConfigurationAssignments { + createOrUpdate(resourceGroupName: string, providerName: string, resourceType: string, resourceName: string, configurationAssignmentName: string, configurationAssignment: ConfigurationAssignment, options?: ConfigurationAssignmentsCreateOrUpdateOptionalParams): Promise; + createOrUpdateParent(resourceGroupName: string, providerName: string, resourceParentType: string, resourceParentName: string, resourceType: string, resourceName: string, configurationAssignmentName: string, configurationAssignment: ConfigurationAssignment, options?: ConfigurationAssignmentsCreateOrUpdateParentOptionalParams): Promise; + delete(resourceGroupName: string, providerName: string, resourceType: string, resourceName: string, configurationAssignmentName: string, options?: ConfigurationAssignmentsDeleteOptionalParams): Promise; + deleteParent(resourceGroupName: string, providerName: string, resourceParentType: string, resourceParentName: string, resourceType: string, resourceName: string, configurationAssignmentName: string, options?: ConfigurationAssignmentsDeleteParentOptionalParams): Promise; + get(resourceGroupName: string, providerName: string, resourceType: string, resourceName: string, configurationAssignmentName: string, options?: ConfigurationAssignmentsGetOptionalParams): Promise; + getParent(resourceGroupName: string, providerName: string, resourceParentType: string, resourceParentName: string, resourceType: string, resourceName: string, configurationAssignmentName: string, options?: ConfigurationAssignmentsGetParentOptionalParams): Promise; + list(resourceGroupName: string, providerName: string, resourceType: string, resourceName: string, options?: ConfigurationAssignmentsListOptionalParams): PagedAsyncIterableIterator; + listParent(resourceGroupName: string, providerName: string, resourceParentType: string, resourceParentName: string, resourceType: string, resourceName: string, options?: ConfigurationAssignmentsListParentOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ConfigurationAssignmentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ConfigurationAssignmentsCreateOrUpdateParentOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsCreateOrUpdateParentResponse = ConfigurationAssignment; + +// @public +export type ConfigurationAssignmentsCreateOrUpdateResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ConfigurationAssignmentsDeleteParentOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsDeleteParentResponse = ConfigurationAssignment; + +// @public +export type ConfigurationAssignmentsDeleteResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsForResourceGroup { + createOrUpdate(resourceGroupName: string, configurationAssignmentName: string, configurationAssignment: ConfigurationAssignment, options?: ConfigurationAssignmentsForResourceGroupCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, configurationAssignmentName: string, options?: ConfigurationAssignmentsForResourceGroupDeleteOptionalParams): Promise; + get(resourceGroupName: string, configurationAssignmentName: string, options?: ConfigurationAssignmentsForResourceGroupGetOptionalParams): Promise; + update(resourceGroupName: string, configurationAssignmentName: string, configurationAssignment: ConfigurationAssignment, options?: ConfigurationAssignmentsForResourceGroupUpdateOptionalParams): Promise; +} + +// @public +export interface ConfigurationAssignmentsForResourceGroupCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsForResourceGroupCreateOrUpdateResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsForResourceGroupDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsForResourceGroupDeleteResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsForResourceGroupGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsForResourceGroupGetResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsForResourceGroupUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsForResourceGroupUpdateResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsForSubscriptions { + createOrUpdate(configurationAssignmentName: string, configurationAssignment: ConfigurationAssignment, options?: ConfigurationAssignmentsForSubscriptionsCreateOrUpdateOptionalParams): Promise; + delete(configurationAssignmentName: string, options?: ConfigurationAssignmentsForSubscriptionsDeleteOptionalParams): Promise; + get(configurationAssignmentName: string, options?: ConfigurationAssignmentsForSubscriptionsGetOptionalParams): Promise; + update(configurationAssignmentName: string, configurationAssignment: ConfigurationAssignment, options?: ConfigurationAssignmentsForSubscriptionsUpdateOptionalParams): Promise; +} + +// @public +export interface ConfigurationAssignmentsForSubscriptionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsForSubscriptionsCreateOrUpdateResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsForSubscriptionsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsForSubscriptionsDeleteResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsForSubscriptionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsForSubscriptionsGetResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsForSubscriptionsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsForSubscriptionsUpdateResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ConfigurationAssignmentsGetParentOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsGetParentResponse = ConfigurationAssignment; + +// @public +export type ConfigurationAssignmentsGetResponse = ConfigurationAssignment; + +// @public +export interface ConfigurationAssignmentsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ConfigurationAssignmentsListParentOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsListParentResponse = ListConfigurationAssignmentsResult; + +// @public +export type ConfigurationAssignmentsListResponse = ListConfigurationAssignmentsResult; + +// @public +export interface ConfigurationAssignmentsWithinSubscription { + list(options?: ConfigurationAssignmentsWithinSubscriptionListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ConfigurationAssignmentsWithinSubscriptionListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConfigurationAssignmentsWithinSubscriptionListResponse = ListConfigurationAssignmentsResult; + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorDetails { + code?: string; + message?: string; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export type ImpactType = string; + +// @public +export interface InputLinuxParameters { + classificationsToInclude?: string[]; + packageNameMasksToExclude?: string[]; + packageNameMasksToInclude?: string[]; +} + +// @public +export interface InputPatchConfiguration { + linuxParameters?: InputLinuxParameters; + rebootSetting?: RebootOptions; + windowsParameters?: InputWindowsParameters; +} + +// @public +export interface InputWindowsParameters { + classificationsToInclude?: string[]; + excludeKbsRequiringReboot?: boolean; + kbNumbersToExclude?: string[]; + kbNumbersToInclude?: string[]; +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownImpactType { + Freeze = "Freeze", + None = "None", + Redeploy = "Redeploy", + Restart = "Restart" +} + +// @public +export enum KnownMaintenanceScope { + Extension = "Extension", + Host = "Host", + InGuestPatch = "InGuestPatch", + OSImage = "OSImage", + Resource = "Resource", + Sqldb = "SQLDB", + SQLManagedInstance = "SQLManagedInstance" +} + +// @public +export enum KnownRebootOptions { + Always = "Always", + IfRequired = "IfRequired", + Never = "Never" +} + +// @public +export enum KnownUpdateStatus { + Completed = "Completed", + InProgress = "InProgress", + Pending = "Pending", + RetryLater = "RetryLater", + RetryNow = "RetryNow" +} + +// @public +export enum KnownVisibility { + Custom = "Custom", + Public = "Public" +} + +// @public +export interface ListApplyUpdate { + value?: ApplyUpdate[]; +} + +// @public +export interface ListConfigurationAssignmentsResult { + value?: ConfigurationAssignment[]; +} + +// @public +export interface ListMaintenanceConfigurationsResult { + value?: MaintenanceConfiguration[]; +} + +// @public +export interface ListUpdatesResult { + value?: Update[]; +} + +// @public +export interface MaintenanceConfiguration extends Resource { + duration?: string; + expirationDateTime?: string; + extensionProperties?: { + [propertyName: string]: string; + }; + installPatches?: InputPatchConfiguration; + location?: string; + maintenanceScope?: MaintenanceScope; + namespace?: string; + recurEvery?: string; + startDateTime?: string; + tags?: { + [propertyName: string]: string; + }; + timeZone?: string; + visibility?: Visibility; +} + +// @public +export interface MaintenanceConfigurations { + createOrUpdate(resourceGroupName: string, resourceName: string, configuration: MaintenanceConfiguration, options?: MaintenanceConfigurationsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, resourceName: string, options?: MaintenanceConfigurationsDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, options?: MaintenanceConfigurationsGetOptionalParams): Promise; + list(options?: MaintenanceConfigurationsListOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, resourceName: string, configuration: MaintenanceConfiguration, options?: MaintenanceConfigurationsUpdateOptionalParams): Promise; +} + +// @public +export interface MaintenanceConfigurationsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MaintenanceConfigurationsCreateOrUpdateResponse = MaintenanceConfiguration; + +// @public +export interface MaintenanceConfigurationsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MaintenanceConfigurationsDeleteResponse = MaintenanceConfiguration; + +// @public +export interface MaintenanceConfigurationsForResourceGroup { + list(resourceGroupName: string, options?: MaintenanceConfigurationsForResourceGroupListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface MaintenanceConfigurationsForResourceGroupListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MaintenanceConfigurationsForResourceGroupListResponse = ListMaintenanceConfigurationsResult; + +// @public +export interface MaintenanceConfigurationsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MaintenanceConfigurationsGetResponse = MaintenanceConfiguration; + +// @public +export interface MaintenanceConfigurationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MaintenanceConfigurationsListResponse = ListMaintenanceConfigurationsResult; + +// @public +export interface MaintenanceConfigurationsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MaintenanceConfigurationsUpdateResponse = MaintenanceConfiguration; + +// @public +export interface MaintenanceError { + error?: ErrorDetails; +} + +// @public (undocumented) +export class MaintenanceManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MaintenanceManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + applyUpdateForResourceGroup: ApplyUpdateForResourceGroup; + // (undocumented) + applyUpdates: ApplyUpdates; + // (undocumented) + configurationAssignments: ConfigurationAssignments; + // (undocumented) + configurationAssignmentsForResourceGroup: ConfigurationAssignmentsForResourceGroup; + // (undocumented) + configurationAssignmentsForSubscriptions: ConfigurationAssignmentsForSubscriptions; + // (undocumented) + configurationAssignmentsWithinSubscription: ConfigurationAssignmentsWithinSubscription; + // (undocumented) + maintenanceConfigurations: MaintenanceConfigurations; + // (undocumented) + maintenanceConfigurationsForResourceGroup: MaintenanceConfigurationsForResourceGroup; + // (undocumented) + operations: Operations; + // (undocumented) + publicMaintenanceConfigurations: PublicMaintenanceConfigurations; + // (undocumented) + subscriptionId: string; + // (undocumented) + updates: Updates; +} + +// @public +export interface MaintenanceManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type MaintenanceScope = string; + +// @public +export interface Operation { + display?: OperationInfo; + isDataAction?: boolean; + name?: string; + origin?: string; + properties?: Record; +} + +// @public +export interface OperationInfo { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationsListResult; + +// @public +export interface OperationsListResult { + value?: Operation[]; +} + +// @public +export interface PublicMaintenanceConfigurations { + get(resourceName: string, options?: PublicMaintenanceConfigurationsGetOptionalParams): Promise; + list(options?: PublicMaintenanceConfigurationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface PublicMaintenanceConfigurationsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PublicMaintenanceConfigurationsGetResponse = MaintenanceConfiguration; + +// @public +export interface PublicMaintenanceConfigurationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PublicMaintenanceConfigurationsListResponse = ListMaintenanceConfigurationsResult; + +// @public +export type RebootOptions = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type TagOperators = "All" | "Any"; + +// @public +export interface TagSettingsProperties { + filterOperator?: TagOperators; + tags?: { + [propertyName: string]: string[]; + }; +} + +// @public +export interface Update { + impactDurationInSec?: number; + impactType?: ImpactType; + maintenanceScope?: MaintenanceScope; + notBefore?: Date; + resourceId?: string; + status?: UpdateStatus; +} + +// @public +export interface Updates { + list(resourceGroupName: string, providerName: string, resourceType: string, resourceName: string, options?: UpdatesListOptionalParams): PagedAsyncIterableIterator; + listParent(resourceGroupName: string, providerName: string, resourceParentType: string, resourceParentName: string, resourceType: string, resourceName: string, options?: UpdatesListParentOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface UpdatesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface UpdatesListParentOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UpdatesListParentResponse = ListUpdatesResult; + +// @public +export type UpdatesListResponse = ListUpdatesResult; + +// @public +export type UpdateStatus = string; + +// @public +export type Visibility = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/maintenance/arm-maintenance/rollup.config.js b/sdk/maintenance/arm-maintenance/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/rollup.config.js @@ -0,0 +1,122 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/maintenance/arm-maintenance/sample.env b/sdk/maintenance/arm-maintenance/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/maintenance/arm-maintenance/samples-dev/applyUpdateForResourceGroupListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdateForResourceGroupListSample.ts new file mode 100644 index 000000000000..0d4fcb94a80c --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdateForResourceGroupListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription and resource group + * + * @summary Get Configuration records within a subscription and resource group + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdatesResourceGroup_List.json + */ +async function applyUpdatesResourceGroupList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applyUpdateForResourceGroup.list( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + applyUpdatesResourceGroupList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesCreateOrUpdateParentSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesCreateOrUpdateParentSample.ts new file mode 100644 index 000000000000..4e4d09813edd --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesCreateOrUpdateParentSample.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Apply maintenance updates to resource with parent + * + * @summary Apply maintenance updates to resource with parent + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdateParent.json + */ +async function applyUpdatesCreateOrUpdateParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.createOrUpdateParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + ); + console.log(result); +} + +async function main() { + applyUpdatesCreateOrUpdateParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..d9e648bfcaca --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesCreateOrUpdateSample.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Apply maintenance updates to resource + * + * @summary Apply maintenance updates to resource + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdate.json + */ +async function applyUpdatesCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.createOrUpdate( + resourceGroupName, + providerName, + resourceType, + resourceName + ); + console.log(result); +} + +async function main() { + applyUpdatesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesGetParentSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesGetParentSample.ts new file mode 100644 index 000000000000..c56602060ad1 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesGetParentSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Track maintenance updates to resource with parent + * + * @summary Track maintenance updates to resource with parent + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_GetParent.json + */ +async function applyUpdatesGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const applyUpdateName = "e9b9685d-78e4-44c4-a81c-64a14f9b87b6"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.getParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + applyUpdateName + ); + console.log(result); +} + +async function main() { + applyUpdatesGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesGetSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesGetSample.ts new file mode 100644 index 000000000000..1e606fc28290 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesGetSample.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Track maintenance updates to resource + * + * @summary Track maintenance updates to resource + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json + */ +async function applyUpdatesGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const applyUpdateName = "e9b9685d-78e4-44c4-a81c-64a14f9b87b6"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.get( + resourceGroupName, + providerName, + resourceType, + resourceName, + applyUpdateName + ); + console.log(result); +} + +async function main() { + applyUpdatesGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesListSample.ts new file mode 100644 index 000000000000..c309e9efdec2 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/applyUpdatesListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription + * + * @summary Get Configuration records within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_List.json + */ +async function applyUpdatesList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applyUpdates.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + applyUpdatesList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsCreateOrUpdateParentSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsCreateOrUpdateParentSample.ts new file mode 100644 index 000000000000..e256416ea4f4 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsCreateOrUpdateParentSample.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdateParent.json + */ +async function configurationAssignmentsCreateOrUpdateParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmPolicy"; + const configurationAssignment: ConfigurationAssignment = { + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/policy1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.createOrUpdateParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsCreateOrUpdateParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..7d49c3541c33 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsCreateOrUpdateSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdate.json + */ +async function configurationAssignmentsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.createOrUpdate( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsDeleteParentSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsDeleteParentSample.ts new file mode 100644 index 000000000000..8316d14aaa78 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsDeleteParentSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_DeleteParent.json + */ +async function configurationAssignmentsDeleteParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.deleteParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsDeleteParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsDeleteSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsDeleteSample.ts new file mode 100644 index 000000000000..372a1c4dc37b --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsDeleteSample.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Delete.json + */ +async function configurationAssignmentsDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.delete( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts new file mode 100644 index 000000000000..a793bb6e2c01 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_CreateOrUpdate.json + */ +async function configurationAssignmentsForResourceGroupCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceTypes: [ + "Microsoft.HybridCompute/machines", + "Microsoft.Compute/virtualMachines" + ], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"] + } + } + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.createOrUpdate( + resourceGroupName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupDeleteSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupDeleteSample.ts new file mode 100644 index 000000000000..2424b4725d93 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Delete.json + */ +async function configurationAssignmentsForResourceGroupDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.delete( + resourceGroupName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupGetSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupGetSample.ts new file mode 100644 index 000000000000..aa369aeb7688 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupGetSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Get.json + */ +async function configurationAssignmentsForResourceGroupGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.get( + resourceGroupName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupUpdateSample.ts new file mode 100644 index 000000000000..afc293e73d81 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForResourceGroupUpdateSample.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_UpdateForResource.json + */ +async function configurationAssignmentsForResourceGroupCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceTypes: [ + "Microsoft.HybridCompute/machines", + "Microsoft.Compute/virtualMachines" + ], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"] + } + } + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.update( + resourceGroupName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..8181edf44231 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_CreateOrUpdate.json + */ +async function configurationAssignmentsForSubscriptionsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceGroups: ["RG1", "RG2"], + resourceTypes: [ + "Microsoft.HybridCompute/machines", + "Microsoft.Compute/virtualMachines" + ], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"] + } + } + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.createOrUpdate( + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsDeleteSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsDeleteSample.ts new file mode 100644 index 000000000000..4b660728d2b0 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsDeleteSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Delete.json + */ +async function configurationAssignmentsForSubscriptionsDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.delete( + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsGetSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsGetSample.ts new file mode 100644 index 000000000000..d5f4f82d8fe5 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsGetSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Get.json + */ +async function configurationAssignmentsGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.get( + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsUpdateSample.ts new file mode 100644 index 000000000000..6b29dcf0a64d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsForSubscriptionsUpdateSample.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_UpdateForResource.json + */ +async function configurationAssignmentsForSubscriptionsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceGroups: ["RG1", "RG2"], + resourceTypes: [ + "Microsoft.HybridCompute/machines", + "Microsoft.Compute/virtualMachines" + ], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"] + } + } + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.update( + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsGetParentSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsGetParentSample.ts new file mode 100644 index 000000000000..c58bc70fcf6d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsGetParentSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_GetParent.json + */ +async function configurationAssignmentsGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmPolicy"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.getParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsGetSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsGetSample.ts new file mode 100644 index 000000000000..3623ec2b5b69 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsGetSample.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Get.json + */ +async function configurationAssignmentsGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.get( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsListParentSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsListParentSample.ts new file mode 100644 index 000000000000..026137897c07 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsListParentSample.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List configurationAssignments for resource. + * + * @summary List configurationAssignments for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_ListParent.json + */ +async function configurationAssignmentsListParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdtestvm1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignments.listParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsListParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsListSample.ts new file mode 100644 index 000000000000..553a5ee9fa48 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsListSample.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List configurationAssignments for resource. + * + * @summary List configurationAssignments for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_List.json + */ +async function configurationAssignmentsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignments.list( + resourceGroupName, + providerName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsWithinSubscriptionListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsWithinSubscriptionListSample.ts new file mode 100644 index 000000000000..ea2c9b0f3418 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/configurationAssignmentsWithinSubscriptionListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment within a subscription + * + * @summary Get configuration assignment within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsResultWithinSubscription_List.json + */ +async function configurationAssignmentsResultWithinSubscriptionList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignmentsWithinSubscription.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsResultWithinSubscriptionList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..303f7acca8db --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsCreateOrUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MaintenanceConfiguration, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or Update configuration record + * + * @summary Create or Update configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json + */ +async function maintenanceConfigurationsCreateOrUpdateForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const configuration: MaintenanceConfiguration = { + duration: "05:00", + expirationDateTime: "9999-12-31 00:00", + location: "westus2", + maintenanceScope: "OSImage", + namespace: "Microsoft.Maintenance", + recurEvery: "Day", + startDateTime: "2020-04-30 08:00", + timeZone: "Pacific Standard Time", + visibility: "Custom" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.createOrUpdate( + resourceGroupName, + resourceName, + configuration + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsCreateOrUpdateForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsDeleteSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsDeleteSample.ts new file mode 100644 index 000000000000..e275dcaa3ebe --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete Configuration record + * + * @summary Delete Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_DeleteForResource.json + */ +async function maintenanceConfigurationsDeleteForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "example1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.delete( + resourceGroupName, + resourceName + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsDeleteForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsForResourceGroupListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsForResourceGroupListSample.ts new file mode 100644 index 000000000000..e0ed1020f0fb --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsForResourceGroupListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription and resource group + * + * @summary Get Configuration records within a subscription and resource group + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurationsResourceGroup_List.json + */ +async function maintenanceConfigurationsResourceGroupList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurationsForResourceGroup.list( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + maintenanceConfigurationsResourceGroupList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsGetSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsGetSample.ts new file mode 100644 index 000000000000..3b627a9a636c --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsGetSample.ts @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json + */ +async function maintenanceConfigurationsGetForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json + */ +async function maintenanceConfigurationsGetForResourceGuestOSPatchLinux() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json + */ +async function maintenanceConfigurationsGetForResourceGuestOSPatchWindows() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsGetForResource(); + maintenanceConfigurationsGetForResourceGuestOSPatchLinux(); + maintenanceConfigurationsGetForResourceGuestOSPatchWindows(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsListSample.ts new file mode 100644 index 000000000000..3393bc1836bc --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription + * + * @summary Get Configuration records within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_List.json + */ +async function maintenanceConfigurationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + maintenanceConfigurationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsUpdateSample.ts new file mode 100644 index 000000000000..2c15198baa43 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/maintenanceConfigurationsUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MaintenanceConfiguration, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patch configuration record + * + * @summary Patch configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_UpdateForResource.json + */ +async function maintenanceConfigurationsUpdateForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const configuration: MaintenanceConfiguration = { + duration: "05:00", + expirationDateTime: "9999-12-31 00:00", + location: "westus2", + maintenanceScope: "OSImage", + namespace: "Microsoft.Maintenance", + recurEvery: "Month Third Sunday", + startDateTime: "2020-04-30 08:00", + timeZone: "Pacific Standard Time", + visibility: "Custom" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.update( + resourceGroupName, + resourceName, + configuration + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsUpdateForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/operationsListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..9a612eb384c5 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the available operations supported by the Microsoft.Maintenance resource provider + * + * @summary List the available operations supported by the Microsoft.Maintenance resource provider + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + operationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/publicMaintenanceConfigurationsGetSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/publicMaintenanceConfigurationsGetSample.ts new file mode 100644 index 000000000000..ea1f0e207167 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/publicMaintenanceConfigurationsGetSample.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Public Maintenance Configuration record + * + * @summary Get Public Maintenance Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json + */ +async function publicMaintenanceConfigurationsGetForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.publicMaintenanceConfigurations.get(resourceName); + console.log(result); +} + +async function main() { + publicMaintenanceConfigurationsGetForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/publicMaintenanceConfigurationsListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/publicMaintenanceConfigurationsListSample.ts new file mode 100644 index 000000000000..094a1fc8fa53 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/publicMaintenanceConfigurationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Public Maintenance Configuration records + * + * @summary Get Public Maintenance Configuration records + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_List.json + */ +async function publicMaintenanceConfigurationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.publicMaintenanceConfigurations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + publicMaintenanceConfigurationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/updatesListParentSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/updatesListParentSample.ts new file mode 100644 index 000000000000..dc561f46390f --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/updatesListParentSample.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get updates to resources. + * + * @summary Get updates to resources. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_ListParent.json + */ +async function updatesListParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.updates.listParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + updatesListParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples-dev/updatesListSample.ts b/sdk/maintenance/arm-maintenance/samples-dev/updatesListSample.ts new file mode 100644 index 000000000000..42267b00ea30 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples-dev/updatesListSample.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get updates to resources. + * + * @summary Get updates to resources. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_List.json + */ +async function updatesList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.updates.list( + resourceGroupName, + providerName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + updatesList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/README.md b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..23d56ef31b21 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/README.md @@ -0,0 +1,116 @@ +# client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [applyUpdateForResourceGroupListSample.js][applyupdateforresourcegrouplistsample] | Get Configuration records within a subscription and resource group x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdatesResourceGroup_List.json | +| [applyUpdatesCreateOrUpdateParentSample.js][applyupdatescreateorupdateparentsample] | Apply maintenance updates to resource with parent x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdateParent.json | +| [applyUpdatesCreateOrUpdateSample.js][applyupdatescreateorupdatesample] | Apply maintenance updates to resource x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdate.json | +| [applyUpdatesGetParentSample.js][applyupdatesgetparentsample] | Track maintenance updates to resource with parent x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_GetParent.json | +| [applyUpdatesGetSample.js][applyupdatesgetsample] | Track maintenance updates to resource x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json | +| [applyUpdatesListSample.js][applyupdateslistsample] | Get Configuration records within a subscription x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_List.json | +| [configurationAssignmentsCreateOrUpdateParentSample.js][configurationassignmentscreateorupdateparentsample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdateParent.json | +| [configurationAssignmentsCreateOrUpdateSample.js][configurationassignmentscreateorupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdate.json | +| [configurationAssignmentsDeleteParentSample.js][configurationassignmentsdeleteparentsample] | Unregister configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_DeleteParent.json | +| [configurationAssignmentsDeleteSample.js][configurationassignmentsdeletesample] | Unregister configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Delete.json | +| [configurationAssignmentsForResourceGroupCreateOrUpdateSample.js][configurationassignmentsforresourcegroupcreateorupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_CreateOrUpdate.json | +| [configurationAssignmentsForResourceGroupDeleteSample.js][configurationassignmentsforresourcegroupdeletesample] | Unregister configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Delete.json | +| [configurationAssignmentsForResourceGroupGetSample.js][configurationassignmentsforresourcegroupgetsample] | Get configuration assignment for resource.. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Get.json | +| [configurationAssignmentsForResourceGroupUpdateSample.js][configurationassignmentsforresourcegroupupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_UpdateForResource.json | +| [configurationAssignmentsForSubscriptionsCreateOrUpdateSample.js][configurationassignmentsforsubscriptionscreateorupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_CreateOrUpdate.json | +| [configurationAssignmentsForSubscriptionsDeleteSample.js][configurationassignmentsforsubscriptionsdeletesample] | Unregister configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Delete.json | +| [configurationAssignmentsForSubscriptionsGetSample.js][configurationassignmentsforsubscriptionsgetsample] | Get configuration assignment for resource.. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Get.json | +| [configurationAssignmentsForSubscriptionsUpdateSample.js][configurationassignmentsforsubscriptionsupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_UpdateForResource.json | +| [configurationAssignmentsGetParentSample.js][configurationassignmentsgetparentsample] | Get configuration assignment for resource.. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_GetParent.json | +| [configurationAssignmentsGetSample.js][configurationassignmentsgetsample] | Get configuration assignment for resource.. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Get.json | +| [configurationAssignmentsListParentSample.js][configurationassignmentslistparentsample] | List configurationAssignments for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_ListParent.json | +| [configurationAssignmentsListSample.js][configurationassignmentslistsample] | List configurationAssignments for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_List.json | +| [configurationAssignmentsWithinSubscriptionListSample.js][configurationassignmentswithinsubscriptionlistsample] | Get configuration assignment within a subscription x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsResultWithinSubscription_List.json | +| [maintenanceConfigurationsCreateOrUpdateSample.js][maintenanceconfigurationscreateorupdatesample] | Create or Update configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json | +| [maintenanceConfigurationsDeleteSample.js][maintenanceconfigurationsdeletesample] | Delete Configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_DeleteForResource.json | +| [maintenanceConfigurationsForResourceGroupListSample.js][maintenanceconfigurationsforresourcegrouplistsample] | Get Configuration records within a subscription and resource group x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurationsResourceGroup_List.json | +| [maintenanceConfigurationsGetSample.js][maintenanceconfigurationsgetsample] | Get Configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json | +| [maintenanceConfigurationsListSample.js][maintenanceconfigurationslistsample] | Get Configuration records within a subscription x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_List.json | +| [maintenanceConfigurationsUpdateSample.js][maintenanceconfigurationsupdatesample] | Patch configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_UpdateForResource.json | +| [operationsListSample.js][operationslistsample] | List the available operations supported by the Microsoft.Maintenance resource provider x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Operations_List.json | +| [publicMaintenanceConfigurationsGetSample.js][publicmaintenanceconfigurationsgetsample] | Get Public Maintenance Configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json | +| [publicMaintenanceConfigurationsListSample.js][publicmaintenanceconfigurationslistsample] | Get Public Maintenance Configuration records x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_List.json | +| [updatesListParentSample.js][updateslistparentsample] | Get updates to resources. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_ListParent.json | +| [updatesListSample.js][updateslistsample] | Get updates to resources. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node applyUpdateForResourceGroupListSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env MAINTENANCE_SUBSCRIPTION_ID="" MAINTENANCE_RESOURCE_GROUP="" node applyUpdateForResourceGroupListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[applyupdateforresourcegrouplistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdateForResourceGroupListSample.js +[applyupdatescreateorupdateparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateParentSample.js +[applyupdatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateSample.js +[applyupdatesgetparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetParentSample.js +[applyupdatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetSample.js +[applyupdateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesListSample.js +[configurationassignmentscreateorupdateparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateParentSample.js +[configurationassignmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateSample.js +[configurationassignmentsdeleteparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteParentSample.js +[configurationassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteSample.js +[configurationassignmentsforresourcegroupcreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupCreateOrUpdateSample.js +[configurationassignmentsforresourcegroupdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupDeleteSample.js +[configurationassignmentsforresourcegroupgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupGetSample.js +[configurationassignmentsforresourcegroupupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupUpdateSample.js +[configurationassignmentsforsubscriptionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.js +[configurationassignmentsforsubscriptionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsDeleteSample.js +[configurationassignmentsforsubscriptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsGetSample.js +[configurationassignmentsforsubscriptionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsUpdateSample.js +[configurationassignmentsgetparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetParentSample.js +[configurationassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetSample.js +[configurationassignmentslistparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListParentSample.js +[configurationassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListSample.js +[configurationassignmentswithinsubscriptionlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsWithinSubscriptionListSample.js +[maintenanceconfigurationscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsCreateOrUpdateSample.js +[maintenanceconfigurationsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsDeleteSample.js +[maintenanceconfigurationsforresourcegrouplistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsForResourceGroupListSample.js +[maintenanceconfigurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsGetSample.js +[maintenanceconfigurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsListSample.js +[maintenanceconfigurationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/operationsListSample.js +[publicmaintenanceconfigurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsGetSample.js +[publicmaintenanceconfigurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsListSample.js +[updateslistparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListParentSample.js +[updateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-maintenance?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maintenance/arm-maintenance/README.md diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdateForResourceGroupListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdateForResourceGroupListSample.js new file mode 100644 index 000000000000..6bdd01245e43 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdateForResourceGroupListSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription and resource group + * + * @summary Get Configuration records within a subscription and resource group + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdatesResourceGroup_List.json + */ +async function applyUpdatesResourceGroupList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applyUpdateForResourceGroup.list(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + applyUpdatesResourceGroupList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateParentSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateParentSample.js new file mode 100644 index 000000000000..a868eca34da2 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateParentSample.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Apply maintenance updates to resource with parent + * + * @summary Apply maintenance updates to resource with parent + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdateParent.json + */ +async function applyUpdatesCreateOrUpdateParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.createOrUpdateParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + ); + console.log(result); +} + +async function main() { + applyUpdatesCreateOrUpdateParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateSample.js new file mode 100644 index 000000000000..d41e0d46f597 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesCreateOrUpdateSample.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Apply maintenance updates to resource + * + * @summary Apply maintenance updates to resource + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdate.json + */ +async function applyUpdatesCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.createOrUpdate( + resourceGroupName, + providerName, + resourceType, + resourceName + ); + console.log(result); +} + +async function main() { + applyUpdatesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetParentSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetParentSample.js new file mode 100644 index 000000000000..97dffdd6b307 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetParentSample.js @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Track maintenance updates to resource with parent + * + * @summary Track maintenance updates to resource with parent + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_GetParent.json + */ +async function applyUpdatesGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const applyUpdateName = "e9b9685d-78e4-44c4-a81c-64a14f9b87b6"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.getParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + applyUpdateName + ); + console.log(result); +} + +async function main() { + applyUpdatesGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetSample.js new file mode 100644 index 000000000000..d69c6661b5cb --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesGetSample.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Track maintenance updates to resource + * + * @summary Track maintenance updates to resource + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json + */ +async function applyUpdatesGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const applyUpdateName = "e9b9685d-78e4-44c4-a81c-64a14f9b87b6"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.get( + resourceGroupName, + providerName, + resourceType, + resourceName, + applyUpdateName + ); + console.log(result); +} + +async function main() { + applyUpdatesGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesListSample.js new file mode 100644 index 000000000000..82cf59b9020a --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/applyUpdatesListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription + * + * @summary Get Configuration records within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_List.json + */ +async function applyUpdatesList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applyUpdates.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + applyUpdatesList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateParentSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateParentSample.js new file mode 100644 index 000000000000..05f0f9f5323a --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateParentSample.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdateParent.json + */ +async function configurationAssignmentsCreateOrUpdateParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmPolicy"; + const configurationAssignment = { + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/policy1", + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.createOrUpdateParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsCreateOrUpdateParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..40bb7db68f2f --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsCreateOrUpdateSample.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdate.json + */ +async function configurationAssignmentsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment = { + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1", + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.createOrUpdate( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteParentSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteParentSample.js new file mode 100644 index 000000000000..f2cb24b6c0d2 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteParentSample.js @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_DeleteParent.json + */ +async function configurationAssignmentsDeleteParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.deleteParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsDeleteParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteSample.js new file mode 100644 index 000000000000..ccfa5fea18c2 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsDeleteSample.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Delete.json + */ +async function configurationAssignmentsDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.delete( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupCreateOrUpdateSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupCreateOrUpdateSample.js new file mode 100644 index 000000000000..a7129b113df2 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupCreateOrUpdateSample.js @@ -0,0 +1,55 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_CreateOrUpdate.json + */ +async function configurationAssignmentsForResourceGroupCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceTypes: ["Microsoft.HybridCompute/machines", "Microsoft.Compute/virtualMachines"], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"], + }, + }, + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1", + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.createOrUpdate( + resourceGroupName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupDeleteSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupDeleteSample.js new file mode 100644 index 000000000000..9624c7a075ff --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupDeleteSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Delete.json + */ +async function configurationAssignmentsForResourceGroupDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.delete( + resourceGroupName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupGetSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupGetSample.js new file mode 100644 index 000000000000..8f2893a9db1d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupGetSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Get.json + */ +async function configurationAssignmentsForResourceGroupGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.get( + resourceGroupName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupUpdateSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupUpdateSample.js new file mode 100644 index 000000000000..d87312ce5573 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForResourceGroupUpdateSample.js @@ -0,0 +1,55 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_UpdateForResource.json + */ +async function configurationAssignmentsForResourceGroupCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceTypes: ["Microsoft.HybridCompute/machines", "Microsoft.Compute/virtualMachines"], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"], + }, + }, + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1", + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.update( + resourceGroupName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.js new file mode 100644 index 000000000000..854e24b1a052 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_CreateOrUpdate.json + */ +async function configurationAssignmentsForSubscriptionsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceGroups: ["RG1", "RG2"], + resourceTypes: ["Microsoft.HybridCompute/machines", "Microsoft.Compute/virtualMachines"], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"], + }, + }, + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1", + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.createOrUpdate( + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsDeleteSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsDeleteSample.js new file mode 100644 index 000000000000..5750a1cd6e7d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsDeleteSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Delete.json + */ +async function configurationAssignmentsForSubscriptionsDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.delete( + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsGetSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsGetSample.js new file mode 100644 index 000000000000..fdbe559004f1 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsGetSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Get.json + */ +async function configurationAssignmentsGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.get( + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsUpdateSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsUpdateSample.js new file mode 100644 index 000000000000..e37a1df186a9 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsForSubscriptionsUpdateSample.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_UpdateForResource.json + */ +async function configurationAssignmentsForSubscriptionsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceGroups: ["RG1", "RG2"], + resourceTypes: ["Microsoft.HybridCompute/machines", "Microsoft.Compute/virtualMachines"], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"], + }, + }, + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1", + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.update( + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetParentSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetParentSample.js new file mode 100644 index 000000000000..995ab5f5678e --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetParentSample.js @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_GetParent.json + */ +async function configurationAssignmentsGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmPolicy"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.getParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetSample.js new file mode 100644 index 000000000000..447f5325dee8 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsGetSample.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Get.json + */ +async function configurationAssignmentsGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.get( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListParentSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListParentSample.js new file mode 100644 index 000000000000..0e559412e99f --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListParentSample.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List configurationAssignments for resource. + * + * @summary List configurationAssignments for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_ListParent.json + */ +async function configurationAssignmentsListParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdtestvm1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignments.listParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsListParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListSample.js new file mode 100644 index 000000000000..5ca5d450aad9 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsListSample.js @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List configurationAssignments for resource. + * + * @summary List configurationAssignments for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_List.json + */ +async function configurationAssignmentsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignments.list( + resourceGroupName, + providerName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsWithinSubscriptionListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsWithinSubscriptionListSample.js new file mode 100644 index 000000000000..545531aa69bc --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/configurationAssignmentsWithinSubscriptionListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get configuration assignment within a subscription + * + * @summary Get configuration assignment within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsResultWithinSubscription_List.json + */ +async function configurationAssignmentsResultWithinSubscriptionList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignmentsWithinSubscription.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsResultWithinSubscriptionList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsCreateOrUpdateSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsCreateOrUpdateSample.js new file mode 100644 index 000000000000..a0bf1ff82913 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsCreateOrUpdateSample.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or Update configuration record + * + * @summary Create or Update configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json + */ +async function maintenanceConfigurationsCreateOrUpdateForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const configuration = { + duration: "05:00", + expirationDateTime: "9999-12-31 00:00", + location: "westus2", + maintenanceScope: "OSImage", + namespace: "Microsoft.Maintenance", + recurEvery: "Day", + startDateTime: "2020-04-30 08:00", + timeZone: "Pacific Standard Time", + visibility: "Custom", + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.createOrUpdate( + resourceGroupName, + resourceName, + configuration + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsCreateOrUpdateForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsDeleteSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsDeleteSample.js new file mode 100644 index 000000000000..07fc5160efb7 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsDeleteSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete Configuration record + * + * @summary Delete Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_DeleteForResource.json + */ +async function maintenanceConfigurationsDeleteForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "example1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.delete(resourceGroupName, resourceName); + console.log(result); +} + +async function main() { + maintenanceConfigurationsDeleteForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsForResourceGroupListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsForResourceGroupListSample.js new file mode 100644 index 000000000000..0ecfea5f9bbe --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsForResourceGroupListSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription and resource group + * + * @summary Get Configuration records within a subscription and resource group + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurationsResourceGroup_List.json + */ +async function maintenanceConfigurationsResourceGroupList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurationsForResourceGroup.list(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + maintenanceConfigurationsResourceGroupList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsGetSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsGetSample.js new file mode 100644 index 000000000000..1fbc5789467d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsGetSample.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json + */ +async function maintenanceConfigurationsGetForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get(resourceGroupName, resourceName); + console.log(result); +} + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json + */ +async function maintenanceConfigurationsGetForResourceGuestOSPatchLinux() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get(resourceGroupName, resourceName); + console.log(result); +} + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json + */ +async function maintenanceConfigurationsGetForResourceGuestOSPatchWindows() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get(resourceGroupName, resourceName); + console.log(result); +} + +async function main() { + maintenanceConfigurationsGetForResource(); + maintenanceConfigurationsGetForResourceGuestOSPatchLinux(); + maintenanceConfigurationsGetForResourceGuestOSPatchWindows(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsListSample.js new file mode 100644 index 000000000000..28afb479766f --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription + * + * @summary Get Configuration records within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_List.json + */ +async function maintenanceConfigurationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + maintenanceConfigurationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsUpdateSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsUpdateSample.js new file mode 100644 index 000000000000..174340fbccfa --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/maintenanceConfigurationsUpdateSample.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Patch configuration record + * + * @summary Patch configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_UpdateForResource.json + */ +async function maintenanceConfigurationsUpdateForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const configuration = { + duration: "05:00", + expirationDateTime: "9999-12-31 00:00", + location: "westus2", + maintenanceScope: "OSImage", + namespace: "Microsoft.Maintenance", + recurEvery: "Month Third Sunday", + startDateTime: "2020-04-30 08:00", + timeZone: "Pacific Standard Time", + visibility: "Custom", + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.update( + resourceGroupName, + resourceName, + configuration + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsUpdateForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/operationsListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..0af90cb3aac8 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/operationsListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List the available operations supported by the Microsoft.Maintenance resource provider + * + * @summary List the available operations supported by the Microsoft.Maintenance resource provider + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + operationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/package.json b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..cc59d6829ca4 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-maintenance-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/maintenance/arm-maintenance" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maintenance/arm-maintenance", + "dependencies": { + "@azure/arm-maintenance": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsGetSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsGetSample.js new file mode 100644 index 000000000000..aee3e370eea1 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get Public Maintenance Configuration record + * + * @summary Get Public Maintenance Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json + */ +async function publicMaintenanceConfigurationsGetForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.publicMaintenanceConfigurations.get(resourceName); + console.log(result); +} + +async function main() { + publicMaintenanceConfigurationsGetForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsListSample.js new file mode 100644 index 000000000000..81262d419045 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/publicMaintenanceConfigurationsListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get Public Maintenance Configuration records + * + * @summary Get Public Maintenance Configuration records + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_List.json + */ +async function publicMaintenanceConfigurationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.publicMaintenanceConfigurations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + publicMaintenanceConfigurationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/sample.env b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListParentSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListParentSample.js new file mode 100644 index 000000000000..5206b30ea130 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListParentSample.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get updates to resources. + * + * @summary Get updates to resources. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_ListParent.json + */ +async function updatesListParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.updates.listParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + updatesListParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListSample.js b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListSample.js new file mode 100644 index 000000000000..12d571540941 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/javascript/updatesListSample.js @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MaintenanceManagementClient } = require("@azure/arm-maintenance"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get updates to resources. + * + * @summary Get updates to resources. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_List.json + */ +async function updatesList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.updates.list( + resourceGroupName, + providerName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + updatesList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/README.md b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..b2118756012d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/README.md @@ -0,0 +1,129 @@ +# client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [applyUpdateForResourceGroupListSample.ts][applyupdateforresourcegrouplistsample] | Get Configuration records within a subscription and resource group x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdatesResourceGroup_List.json | +| [applyUpdatesCreateOrUpdateParentSample.ts][applyupdatescreateorupdateparentsample] | Apply maintenance updates to resource with parent x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdateParent.json | +| [applyUpdatesCreateOrUpdateSample.ts][applyupdatescreateorupdatesample] | Apply maintenance updates to resource x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdate.json | +| [applyUpdatesGetParentSample.ts][applyupdatesgetparentsample] | Track maintenance updates to resource with parent x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_GetParent.json | +| [applyUpdatesGetSample.ts][applyupdatesgetsample] | Track maintenance updates to resource x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json | +| [applyUpdatesListSample.ts][applyupdateslistsample] | Get Configuration records within a subscription x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_List.json | +| [configurationAssignmentsCreateOrUpdateParentSample.ts][configurationassignmentscreateorupdateparentsample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdateParent.json | +| [configurationAssignmentsCreateOrUpdateSample.ts][configurationassignmentscreateorupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdate.json | +| [configurationAssignmentsDeleteParentSample.ts][configurationassignmentsdeleteparentsample] | Unregister configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_DeleteParent.json | +| [configurationAssignmentsDeleteSample.ts][configurationassignmentsdeletesample] | Unregister configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Delete.json | +| [configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts][configurationassignmentsforresourcegroupcreateorupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_CreateOrUpdate.json | +| [configurationAssignmentsForResourceGroupDeleteSample.ts][configurationassignmentsforresourcegroupdeletesample] | Unregister configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Delete.json | +| [configurationAssignmentsForResourceGroupGetSample.ts][configurationassignmentsforresourcegroupgetsample] | Get configuration assignment for resource.. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Get.json | +| [configurationAssignmentsForResourceGroupUpdateSample.ts][configurationassignmentsforresourcegroupupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_UpdateForResource.json | +| [configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts][configurationassignmentsforsubscriptionscreateorupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_CreateOrUpdate.json | +| [configurationAssignmentsForSubscriptionsDeleteSample.ts][configurationassignmentsforsubscriptionsdeletesample] | Unregister configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Delete.json | +| [configurationAssignmentsForSubscriptionsGetSample.ts][configurationassignmentsforsubscriptionsgetsample] | Get configuration assignment for resource.. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Get.json | +| [configurationAssignmentsForSubscriptionsUpdateSample.ts][configurationassignmentsforsubscriptionsupdatesample] | Register configuration for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_UpdateForResource.json | +| [configurationAssignmentsGetParentSample.ts][configurationassignmentsgetparentsample] | Get configuration assignment for resource.. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_GetParent.json | +| [configurationAssignmentsGetSample.ts][configurationassignmentsgetsample] | Get configuration assignment for resource.. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Get.json | +| [configurationAssignmentsListParentSample.ts][configurationassignmentslistparentsample] | List configurationAssignments for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_ListParent.json | +| [configurationAssignmentsListSample.ts][configurationassignmentslistsample] | List configurationAssignments for resource. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_List.json | +| [configurationAssignmentsWithinSubscriptionListSample.ts][configurationassignmentswithinsubscriptionlistsample] | Get configuration assignment within a subscription x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsResultWithinSubscription_List.json | +| [maintenanceConfigurationsCreateOrUpdateSample.ts][maintenanceconfigurationscreateorupdatesample] | Create or Update configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json | +| [maintenanceConfigurationsDeleteSample.ts][maintenanceconfigurationsdeletesample] | Delete Configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_DeleteForResource.json | +| [maintenanceConfigurationsForResourceGroupListSample.ts][maintenanceconfigurationsforresourcegrouplistsample] | Get Configuration records within a subscription and resource group x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurationsResourceGroup_List.json | +| [maintenanceConfigurationsGetSample.ts][maintenanceconfigurationsgetsample] | Get Configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json | +| [maintenanceConfigurationsListSample.ts][maintenanceconfigurationslistsample] | Get Configuration records within a subscription x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_List.json | +| [maintenanceConfigurationsUpdateSample.ts][maintenanceconfigurationsupdatesample] | Patch configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_UpdateForResource.json | +| [operationsListSample.ts][operationslistsample] | List the available operations supported by the Microsoft.Maintenance resource provider x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Operations_List.json | +| [publicMaintenanceConfigurationsGetSample.ts][publicmaintenanceconfigurationsgetsample] | Get Public Maintenance Configuration record x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json | +| [publicMaintenanceConfigurationsListSample.ts][publicmaintenanceconfigurationslistsample] | Get Public Maintenance Configuration records x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_List.json | +| [updatesListParentSample.ts][updateslistparentsample] | Get updates to resources. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_ListParent.json | +| [updatesListSample.ts][updateslistsample] | Get updates to resources. x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/applyUpdateForResourceGroupListSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env MAINTENANCE_SUBSCRIPTION_ID="" MAINTENANCE_RESOURCE_GROUP="" node dist/applyUpdateForResourceGroupListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[applyupdateforresourcegrouplistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdateForResourceGroupListSample.ts +[applyupdatescreateorupdateparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateParentSample.ts +[applyupdatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateSample.ts +[applyupdatesgetparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetParentSample.ts +[applyupdatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetSample.ts +[applyupdateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesListSample.ts +[configurationassignmentscreateorupdateparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateParentSample.ts +[configurationassignmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateSample.ts +[configurationassignmentsdeleteparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteParentSample.ts +[configurationassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteSample.ts +[configurationassignmentsforresourcegroupcreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts +[configurationassignmentsforresourcegroupdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupDeleteSample.ts +[configurationassignmentsforresourcegroupgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupGetSample.ts +[configurationassignmentsforresourcegroupupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupUpdateSample.ts +[configurationassignmentsforsubscriptionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts +[configurationassignmentsforsubscriptionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsDeleteSample.ts +[configurationassignmentsforsubscriptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsGetSample.ts +[configurationassignmentsforsubscriptionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsUpdateSample.ts +[configurationassignmentsgetparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetParentSample.ts +[configurationassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetSample.ts +[configurationassignmentslistparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListParentSample.ts +[configurationassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListSample.ts +[configurationassignmentswithinsubscriptionlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsWithinSubscriptionListSample.ts +[maintenanceconfigurationscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsCreateOrUpdateSample.ts +[maintenanceconfigurationsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsDeleteSample.ts +[maintenanceconfigurationsforresourcegrouplistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsForResourceGroupListSample.ts +[maintenanceconfigurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsGetSample.ts +[maintenanceconfigurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsListSample.ts +[maintenanceconfigurationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/operationsListSample.ts +[publicmaintenanceconfigurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsGetSample.ts +[publicmaintenanceconfigurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsListSample.ts +[updateslistparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListParentSample.ts +[updateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-maintenance?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maintenance/arm-maintenance/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/package.json b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..01c76fcf089f --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-maintenance-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/maintenance/arm-maintenance" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maintenance/arm-maintenance", + "dependencies": { + "@azure/arm-maintenance": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~5.0.0", + "rimraf": "latest" + } +} diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/sample.env b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdateForResourceGroupListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdateForResourceGroupListSample.ts new file mode 100644 index 000000000000..0d4fcb94a80c --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdateForResourceGroupListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription and resource group + * + * @summary Get Configuration records within a subscription and resource group + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdatesResourceGroup_List.json + */ +async function applyUpdatesResourceGroupList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applyUpdateForResourceGroup.list( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + applyUpdatesResourceGroupList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateParentSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateParentSample.ts new file mode 100644 index 000000000000..4e4d09813edd --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateParentSample.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Apply maintenance updates to resource with parent + * + * @summary Apply maintenance updates to resource with parent + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdateParent.json + */ +async function applyUpdatesCreateOrUpdateParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.createOrUpdateParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + ); + console.log(result); +} + +async function main() { + applyUpdatesCreateOrUpdateParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..d9e648bfcaca --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesCreateOrUpdateSample.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Apply maintenance updates to resource + * + * @summary Apply maintenance updates to resource + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdate.json + */ +async function applyUpdatesCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.createOrUpdate( + resourceGroupName, + providerName, + resourceType, + resourceName + ); + console.log(result); +} + +async function main() { + applyUpdatesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetParentSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetParentSample.ts new file mode 100644 index 000000000000..c56602060ad1 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetParentSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Track maintenance updates to resource with parent + * + * @summary Track maintenance updates to resource with parent + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_GetParent.json + */ +async function applyUpdatesGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const applyUpdateName = "e9b9685d-78e4-44c4-a81c-64a14f9b87b6"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.getParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + applyUpdateName + ); + console.log(result); +} + +async function main() { + applyUpdatesGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetSample.ts new file mode 100644 index 000000000000..1e606fc28290 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesGetSample.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Track maintenance updates to resource + * + * @summary Track maintenance updates to resource + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json + */ +async function applyUpdatesGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const applyUpdateName = "e9b9685d-78e4-44c4-a81c-64a14f9b87b6"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.applyUpdates.get( + resourceGroupName, + providerName, + resourceType, + resourceName, + applyUpdateName + ); + console.log(result); +} + +async function main() { + applyUpdatesGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesListSample.ts new file mode 100644 index 000000000000..c309e9efdec2 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/applyUpdatesListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription + * + * @summary Get Configuration records within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_List.json + */ +async function applyUpdatesList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.applyUpdates.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + applyUpdatesList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateParentSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateParentSample.ts new file mode 100644 index 000000000000..e256416ea4f4 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateParentSample.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdateParent.json + */ +async function configurationAssignmentsCreateOrUpdateParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmPolicy"; + const configurationAssignment: ConfigurationAssignment = { + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/policy1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.createOrUpdateParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsCreateOrUpdateParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..7d49c3541c33 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsCreateOrUpdateSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdate.json + */ +async function configurationAssignmentsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.createOrUpdate( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteParentSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteParentSample.ts new file mode 100644 index 000000000000..8316d14aaa78 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteParentSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_DeleteParent.json + */ +async function configurationAssignmentsDeleteParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.deleteParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsDeleteParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteSample.ts new file mode 100644 index 000000000000..372a1c4dc37b --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsDeleteSample.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Delete.json + */ +async function configurationAssignmentsDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.delete( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts new file mode 100644 index 000000000000..a793bb6e2c01 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupCreateOrUpdateSample.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_CreateOrUpdate.json + */ +async function configurationAssignmentsForResourceGroupCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceTypes: [ + "Microsoft.HybridCompute/machines", + "Microsoft.Compute/virtualMachines" + ], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"] + } + } + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.createOrUpdate( + resourceGroupName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupDeleteSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupDeleteSample.ts new file mode 100644 index 000000000000..2424b4725d93 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Delete.json + */ +async function configurationAssignmentsForResourceGroupDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.delete( + resourceGroupName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupGetSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupGetSample.ts new file mode 100644 index 000000000000..aa369aeb7688 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupGetSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Get.json + */ +async function configurationAssignmentsForResourceGroupGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.get( + resourceGroupName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupUpdateSample.ts new file mode 100644 index 000000000000..afc293e73d81 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForResourceGroupUpdateSample.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_UpdateForResource.json + */ +async function configurationAssignmentsForResourceGroupCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceTypes: [ + "Microsoft.HybridCompute/machines", + "Microsoft.Compute/virtualMachines" + ], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"] + } + } + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForResourceGroup.update( + resourceGroupName, + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForResourceGroupCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..8181edf44231 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsCreateOrUpdateSample.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_CreateOrUpdate.json + */ +async function configurationAssignmentsForSubscriptionsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceGroups: ["RG1", "RG2"], + resourceTypes: [ + "Microsoft.HybridCompute/machines", + "Microsoft.Compute/virtualMachines" + ], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"] + } + } + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.createOrUpdate( + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsDeleteSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsDeleteSample.ts new file mode 100644 index 000000000000..4b660728d2b0 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsDeleteSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Unregister configuration for resource. + * + * @summary Unregister configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Delete.json + */ +async function configurationAssignmentsForSubscriptionsDelete() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.delete( + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsDelete(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsGetSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsGetSample.ts new file mode 100644 index 000000000000..d5f4f82d8fe5 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsGetSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Get.json + */ +async function configurationAssignmentsGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.get( + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsUpdateSample.ts new file mode 100644 index 000000000000..6b29dcf0a64d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsForSubscriptionsUpdateSample.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConfigurationAssignment, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Register configuration for resource. + * + * @summary Register configuration for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_UpdateForResource.json + */ +async function configurationAssignmentsForSubscriptionsCreateOrUpdate() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const configurationAssignmentName = "workervmConfiguration"; + const configurationAssignment: ConfigurationAssignment = { + filter: { + locations: ["Japan East", "UK South"], + resourceGroups: ["RG1", "RG2"], + resourceTypes: [ + "Microsoft.HybridCompute/machines", + "Microsoft.Compute/virtualMachines" + ], + tagSettings: { + filterOperator: "Any", + tags: { + tag1: ["tag1Value1", "tag1Value2", "tag1Value3"], + tag2: ["tag2Value1", "tag2Value2", "tag2Value3"] + } + } + }, + maintenanceConfigurationId: + "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignmentsForSubscriptions.update( + configurationAssignmentName, + configurationAssignment + ); + console.log(result); +} + +async function main() { + configurationAssignmentsForSubscriptionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetParentSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetParentSample.ts new file mode 100644 index 000000000000..c58bc70fcf6d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetParentSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_GetParent.json + */ +async function configurationAssignmentsGetParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdvm1"; + const configurationAssignmentName = "workervmPolicy"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.getParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGetParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetSample.ts new file mode 100644 index 000000000000..3623ec2b5b69 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsGetSample.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment for resource.. + * + * @summary Get configuration assignment for resource.. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Get.json + */ +async function configurationAssignmentsGet() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const configurationAssignmentName = "workervmConfiguration"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.configurationAssignments.get( + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName + ); + console.log(result); +} + +async function main() { + configurationAssignmentsGet(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListParentSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListParentSample.ts new file mode 100644 index 000000000000..026137897c07 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListParentSample.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List configurationAssignments for resource. + * + * @summary List configurationAssignments for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_ListParent.json + */ +async function configurationAssignmentsListParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "smdtestvm1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignments.listParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsListParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListSample.ts new file mode 100644 index 000000000000..553a5ee9fa48 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsListSample.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List configurationAssignments for resource. + * + * @summary List configurationAssignments for resource. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_List.json + */ +async function configurationAssignmentsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignments.list( + resourceGroupName, + providerName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsWithinSubscriptionListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsWithinSubscriptionListSample.ts new file mode 100644 index 000000000000..ea2c9b0f3418 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/configurationAssignmentsWithinSubscriptionListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get configuration assignment within a subscription + * + * @summary Get configuration assignment within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsResultWithinSubscription_List.json + */ +async function configurationAssignmentsResultWithinSubscriptionList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.configurationAssignmentsWithinSubscription.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + configurationAssignmentsResultWithinSubscriptionList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsCreateOrUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..303f7acca8db --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsCreateOrUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MaintenanceConfiguration, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or Update configuration record + * + * @summary Create or Update configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json + */ +async function maintenanceConfigurationsCreateOrUpdateForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const configuration: MaintenanceConfiguration = { + duration: "05:00", + expirationDateTime: "9999-12-31 00:00", + location: "westus2", + maintenanceScope: "OSImage", + namespace: "Microsoft.Maintenance", + recurEvery: "Day", + startDateTime: "2020-04-30 08:00", + timeZone: "Pacific Standard Time", + visibility: "Custom" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.createOrUpdate( + resourceGroupName, + resourceName, + configuration + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsCreateOrUpdateForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsDeleteSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsDeleteSample.ts new file mode 100644 index 000000000000..e275dcaa3ebe --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete Configuration record + * + * @summary Delete Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_DeleteForResource.json + */ +async function maintenanceConfigurationsDeleteForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "example1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.delete( + resourceGroupName, + resourceName + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsDeleteForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsForResourceGroupListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsForResourceGroupListSample.ts new file mode 100644 index 000000000000..e0ed1020f0fb --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsForResourceGroupListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription and resource group + * + * @summary Get Configuration records within a subscription and resource group + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurationsResourceGroup_List.json + */ +async function maintenanceConfigurationsResourceGroupList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurationsForResourceGroup.list( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + maintenanceConfigurationsResourceGroupList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsGetSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsGetSample.ts new file mode 100644 index 000000000000..3b627a9a636c --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsGetSample.ts @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json + */ +async function maintenanceConfigurationsGetForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json + */ +async function maintenanceConfigurationsGetForResourceGuestOSPatchLinux() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get Configuration record + * + * @summary Get Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json + */ +async function maintenanceConfigurationsGetForResourceGuestOSPatchWindows() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.get( + resourceGroupName, + resourceName + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsGetForResource(); + maintenanceConfigurationsGetForResourceGuestOSPatchLinux(); + maintenanceConfigurationsGetForResourceGuestOSPatchWindows(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsListSample.ts new file mode 100644 index 000000000000..3393bc1836bc --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Configuration records within a subscription + * + * @summary Get Configuration records within a subscription + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_List.json + */ +async function maintenanceConfigurationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.maintenanceConfigurations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + maintenanceConfigurationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsUpdateSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsUpdateSample.ts new file mode 100644 index 000000000000..2c15198baa43 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/maintenanceConfigurationsUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MaintenanceConfiguration, + MaintenanceManagementClient +} from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patch configuration record + * + * @summary Patch configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_UpdateForResource.json + */ +async function maintenanceConfigurationsUpdateForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const resourceName = "configuration1"; + const configuration: MaintenanceConfiguration = { + duration: "05:00", + expirationDateTime: "9999-12-31 00:00", + location: "westus2", + maintenanceScope: "OSImage", + namespace: "Microsoft.Maintenance", + recurEvery: "Month Third Sunday", + startDateTime: "2020-04-30 08:00", + timeZone: "Pacific Standard Time", + visibility: "Custom" + }; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.maintenanceConfigurations.update( + resourceGroupName, + resourceName, + configuration + ); + console.log(result); +} + +async function main() { + maintenanceConfigurationsUpdateForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..9a612eb384c5 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the available operations supported by the Microsoft.Maintenance resource provider + * + * @summary List the available operations supported by the Microsoft.Maintenance resource provider + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + operationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsGetSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsGetSample.ts new file mode 100644 index 000000000000..ea1f0e207167 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsGetSample.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Public Maintenance Configuration record + * + * @summary Get Public Maintenance Configuration record + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json + */ +async function publicMaintenanceConfigurationsGetForResource() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceName = "configuration1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const result = await client.publicMaintenanceConfigurations.get(resourceName); + console.log(result); +} + +async function main() { + publicMaintenanceConfigurationsGetForResource(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsListSample.ts new file mode 100644 index 000000000000..094a1fc8fa53 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/publicMaintenanceConfigurationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get Public Maintenance Configuration records + * + * @summary Get Public Maintenance Configuration records + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_List.json + */ +async function publicMaintenanceConfigurationsList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.publicMaintenanceConfigurations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + publicMaintenanceConfigurationsList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListParentSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListParentSample.ts new file mode 100644 index 000000000000..dc561f46390f --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListParentSample.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get updates to resources. + * + * @summary Get updates to resources. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_ListParent.json + */ +async function updatesListParent() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceParentType = "virtualMachineScaleSets"; + const resourceParentName = "smdtest1"; + const resourceType = "virtualMachines"; + const resourceName = "1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.updates.listParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + updatesListParent(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListSample.ts b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListSample.ts new file mode 100644 index 000000000000..42267b00ea30 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/src/updatesListSample.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MaintenanceManagementClient } from "@azure/arm-maintenance"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get updates to resources. + * + * @summary Get updates to resources. + * x-ms-original-file: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_List.json + */ +async function updatesList() { + const subscriptionId = + process.env["MAINTENANCE_SUBSCRIPTION_ID"] || + "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + const resourceGroupName = + process.env["MAINTENANCE_RESOURCE_GROUP"] || "examplerg"; + const providerName = "Microsoft.Compute"; + const resourceType = "virtualMachineScaleSets"; + const resourceName = "smdtest1"; + const credential = new DefaultAzureCredential(); + const client = new MaintenanceManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.updates.list( + resourceGroupName, + providerName, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + updatesList(); +} + +main().catch(console.error); diff --git a/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/tsconfig.json b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/maintenance/arm-maintenance/src/index.ts b/sdk/maintenance/arm-maintenance/src/index.ts new file mode 100644 index 000000000000..de3e90194fce --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { MaintenanceManagementClient } from "./maintenanceManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/maintenance/arm-maintenance/src/maintenanceManagementClient.ts b/sdk/maintenance/arm-maintenance/src/maintenanceManagementClient.ts new file mode 100644 index 000000000000..db7b90fb66e5 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/maintenanceManagementClient.ts @@ -0,0 +1,197 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { + PublicMaintenanceConfigurationsImpl, + ApplyUpdatesImpl, + ConfigurationAssignmentsImpl, + MaintenanceConfigurationsImpl, + MaintenanceConfigurationsForResourceGroupImpl, + ApplyUpdateForResourceGroupImpl, + ConfigurationAssignmentsWithinSubscriptionImpl, + ConfigurationAssignmentsForSubscriptionsImpl, + ConfigurationAssignmentsForResourceGroupImpl, + OperationsImpl, + UpdatesImpl +} from "./operations"; +import { + PublicMaintenanceConfigurations, + ApplyUpdates, + ConfigurationAssignments, + MaintenanceConfigurations, + MaintenanceConfigurationsForResourceGroup, + ApplyUpdateForResourceGroup, + ConfigurationAssignmentsWithinSubscription, + ConfigurationAssignmentsForSubscriptions, + ConfigurationAssignmentsForResourceGroup, + Operations, + Updates +} from "./operationsInterfaces"; +import { MaintenanceManagementClientOptionalParams } from "./models"; + +export class MaintenanceManagementClient extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; + + /** + * Initializes a new instance of the MaintenanceManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Subscription credentials that uniquely identify a Microsoft Azure + * subscription. The subscription ID forms part of the URI for every service call. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: MaintenanceManagementClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: MaintenanceManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-maintenance/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2023-04-01"; + this.publicMaintenanceConfigurations = new PublicMaintenanceConfigurationsImpl( + this + ); + this.applyUpdates = new ApplyUpdatesImpl(this); + this.configurationAssignments = new ConfigurationAssignmentsImpl(this); + this.maintenanceConfigurations = new MaintenanceConfigurationsImpl(this); + this.maintenanceConfigurationsForResourceGroup = new MaintenanceConfigurationsForResourceGroupImpl( + this + ); + this.applyUpdateForResourceGroup = new ApplyUpdateForResourceGroupImpl( + this + ); + this.configurationAssignmentsWithinSubscription = new ConfigurationAssignmentsWithinSubscriptionImpl( + this + ); + this.configurationAssignmentsForSubscriptions = new ConfigurationAssignmentsForSubscriptionsImpl( + this + ); + this.configurationAssignmentsForResourceGroup = new ConfigurationAssignmentsForResourceGroupImpl( + this + ); + this.operations = new OperationsImpl(this); + this.updates = new UpdatesImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + publicMaintenanceConfigurations: PublicMaintenanceConfigurations; + applyUpdates: ApplyUpdates; + configurationAssignments: ConfigurationAssignments; + maintenanceConfigurations: MaintenanceConfigurations; + maintenanceConfigurationsForResourceGroup: MaintenanceConfigurationsForResourceGroup; + applyUpdateForResourceGroup: ApplyUpdateForResourceGroup; + configurationAssignmentsWithinSubscription: ConfigurationAssignmentsWithinSubscription; + configurationAssignmentsForSubscriptions: ConfigurationAssignmentsForSubscriptions; + configurationAssignmentsForResourceGroup: ConfigurationAssignmentsForResourceGroup; + operations: Operations; + updates: Updates; +} diff --git a/sdk/maintenance/arm-maintenance/src/models/index.ts b/sdk/maintenance/arm-maintenance/src/models/index.ts new file mode 100644 index 000000000000..61df5c9a2fb4 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/models/index.ts @@ -0,0 +1,637 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +/** Response for MaintenanceConfigurations list */ +export interface ListMaintenanceConfigurationsResult { + /** The list of maintenance Configurations */ + value?: MaintenanceConfiguration[]; +} + +/** Input configuration for a patch run */ +export interface InputPatchConfiguration { + /** Possible reboot preference as defined by the user based on which it would be decided to reboot the machine or not after the patch operation is completed. */ + rebootSetting?: RebootOptions; + /** Input parameters specific to patching a Windows machine. For Linux machines, do not pass this property. */ + windowsParameters?: InputWindowsParameters; + /** Input parameters specific to patching Linux machine. For Windows machines, do not pass this property. */ + linuxParameters?: InputLinuxParameters; +} + +/** Input properties for patching a Windows machine. */ +export interface InputWindowsParameters { + /** Windows KBID to be excluded for patching. */ + kbNumbersToExclude?: string[]; + /** Windows KBID to be included for patching. */ + kbNumbersToInclude?: string[]; + /** Classification category of patches to be patched */ + classificationsToInclude?: string[]; + /** Exclude patches which need reboot */ + excludeKbsRequiringReboot?: boolean; +} + +/** Input properties for patching a Linux machine. */ +export interface InputLinuxParameters { + /** Package names to be excluded for patching. */ + packageNameMasksToExclude?: string[]; + /** Package names to be included for patching. */ + packageNameMasksToInclude?: string[]; + /** Classification category of patches to be patched */ + classificationsToInclude?: string[]; +} + +/** Definition of a Resource */ +export interface Resource { + /** + * Fully qualified identifier of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Type of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** An error response received from the Azure Maintenance service. */ +export interface MaintenanceError { + /** Details of the error */ + error?: ErrorDetails; +} + +/** An error response details received from the Azure Maintenance service. */ +export interface ErrorDetails { + /** Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. */ + code?: string; + /** Human-readable representation of the error. */ + message?: string; +} + +/** Azure query for the update configuration. */ +export interface ConfigurationAssignmentFilterProperties { + /** List of allowed resources. */ + resourceTypes?: string[]; + /** List of allowed resource groups. */ + resourceGroups?: string[]; + /** List of allowed operating systems. */ + osTypes?: string[]; + /** List of locations to scope the query to. */ + locations?: string[]; + /** Tag settings for the VM. */ + tagSettings?: TagSettingsProperties; +} + +/** Tag filter information for the VM. */ +export interface TagSettingsProperties { + /** Dictionary of tags with its list of values. */ + tags?: { [propertyName: string]: string[] }; + /** Filter VMs by Any or All specified tags. */ + filterOperator?: TagOperators; +} + +/** Response for ConfigurationAssignments list */ +export interface ListConfigurationAssignmentsResult { + /** The list of configuration Assignments */ + value?: ConfigurationAssignment[]; +} + +/** Response for ApplyUpdate list */ +export interface ListApplyUpdate { + /** The list of apply updates */ + value?: ApplyUpdate[]; +} + +/** Result of the List Operations operation */ +export interface OperationsListResult { + /** A collection of operations */ + value?: Operation[]; +} + +/** Represents an operation returned by the GetOperations request */ +export interface Operation { + /** Name of the operation */ + name?: string; + /** Display name of the operation */ + display?: OperationInfo; + /** Origin of the operation */ + origin?: string; + /** Properties of the operation */ + properties?: Record; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; +} + +/** Information about an operation */ +export interface OperationInfo { + /** Name of the provider */ + provider?: string; + /** Name of the resource type */ + resource?: string; + /** Name of the operation */ + operation?: string; + /** Description of the operation */ + description?: string; +} + +/** Response for Updates list */ +export interface ListUpdatesResult { + /** The pending updates */ + value?: Update[]; +} + +/** Maintenance update on a resource */ +export interface Update { + /** The impact area */ + maintenanceScope?: MaintenanceScope; + /** The impact type */ + impactType?: ImpactType; + /** The status */ + status?: UpdateStatus; + /** Duration of impact in seconds */ + impactDurationInSec?: number; + /** Time when Azure will start force updates if not self-updated by customer before this time */ + notBefore?: Date; + /** The resourceId */ + resourceId?: string; +} + +/** Maintenance configuration record type */ +export interface MaintenanceConfiguration extends Resource { + /** Gets or sets location of the resource */ + location?: string; + /** Gets or sets tags of the resource */ + tags?: { [propertyName: string]: string }; + /** Gets or sets namespace of the resource */ + namespace?: string; + /** Gets or sets extensionProperties of the maintenanceConfiguration */ + extensionProperties?: { [propertyName: string]: string }; + /** Gets or sets maintenanceScope of the configuration */ + maintenanceScope?: MaintenanceScope; + /** Gets or sets the visibility of the configuration. The default value is 'Custom' */ + visibility?: Visibility; + /** The input parameters to be passed to the patch run operation. */ + installPatches?: InputPatchConfiguration; + /** Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The start date can be set to either the current date or future date. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. */ + startDateTime?: string; + /** Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm format. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. Expiration date must be set to a future date. If not provided, it will be set to the maximum datetime 9999-12-31 23:59:59. */ + expirationDateTime?: string; + /** Duration of the maintenance window in HH:mm format. If not provided, default value will be used based on maintenance scope provided. Example: 05:00. */ + duration?: string; + /** Name of the timezone. List of timezones can be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. Example: Pacific Standard Time, UTC, W. Europe Standard Time, Korea Standard Time, Cen. Australia Standard Time. */ + timeZone?: string; + /** Rate at which a Maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday] [Optional Offset(No. of days)]. Offset value must be between -6 to 6 inclusive. Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth Monday, recurEvery: Month Last Sunday Offset-3, recurEvery: Month Third Sunday Offset6. */ + recurEvery?: string; +} + +/** Apply Update request */ +export interface ApplyUpdate extends Resource { + /** The status */ + status?: UpdateStatus; + /** The resourceId */ + resourceId?: string; + /** Last Update time */ + lastUpdateTime?: Date; +} + +/** Configuration Assignment */ +export interface ConfigurationAssignment extends Resource { + /** Location of the resource */ + location?: string; + /** The maintenance configuration Id */ + maintenanceConfigurationId?: string; + /** The unique resourceId */ + resourceId?: string; + /** Properties of the configuration assignment */ + filter?: ConfigurationAssignmentFilterProperties; +} + +/** Known values of {@link MaintenanceScope} that the service accepts. */ +export enum KnownMaintenanceScope { + /** This maintenance scope controls installation of azure platform updates i.e. services on physical nodes hosting customer VMs. */ + Host = "Host", + /** This maintenance scope controls the default update maintenance of the Azure Resource */ + Resource = "Resource", + /** This maintenance scope controls os image installation on VM\/VMSS */ + OSImage = "OSImage", + /** This maintenance scope controls extension installation on VM\/VMSS */ + Extension = "Extension", + /** This maintenance scope controls installation of windows and linux packages on VM\/VMSS */ + InGuestPatch = "InGuestPatch", + /** This maintenance scope controls installation of SQL server platform updates. */ + Sqldb = "SQLDB", + /** This maintenance scope controls installation of SQL managed instance platform update. */ + SQLManagedInstance = "SQLManagedInstance" +} + +/** + * Defines values for MaintenanceScope. \ + * {@link KnownMaintenanceScope} can be used interchangeably with MaintenanceScope, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Host**: This maintenance scope controls installation of azure platform updates i.e. services on physical nodes hosting customer VMs. \ + * **Resource**: This maintenance scope controls the default update maintenance of the Azure Resource \ + * **OSImage**: This maintenance scope controls os image installation on VM\/VMSS \ + * **Extension**: This maintenance scope controls extension installation on VM\/VMSS \ + * **InGuestPatch**: This maintenance scope controls installation of windows and linux packages on VM\/VMSS \ + * **SQLDB**: This maintenance scope controls installation of SQL server platform updates. \ + * **SQLManagedInstance**: This maintenance scope controls installation of SQL managed instance platform update. + */ +export type MaintenanceScope = string; + +/** Known values of {@link Visibility} that the service accepts. */ +export enum KnownVisibility { + /** Only visible to users with permissions. */ + Custom = "Custom", + /** Visible to all users. */ + Public = "Public" +} + +/** + * Defines values for Visibility. \ + * {@link KnownVisibility} can be used interchangeably with Visibility, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Custom**: Only visible to users with permissions. \ + * **Public**: Visible to all users. + */ +export type Visibility = string; + +/** Known values of {@link RebootOptions} that the service accepts. */ +export enum KnownRebootOptions { + /** IfRequired */ + IfRequired = "IfRequired", + /** Never */ + Never = "Never", + /** Always */ + Always = "Always" +} + +/** + * Defines values for RebootOptions. \ + * {@link KnownRebootOptions} can be used interchangeably with RebootOptions, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **IfRequired** \ + * **Never** \ + * **Always** + */ +export type RebootOptions = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link UpdateStatus} that the service accepts. */ +export enum KnownUpdateStatus { + /** There are pending updates to be installed. */ + Pending = "Pending", + /** Updates installation are in progress. */ + InProgress = "InProgress", + /** All updates are successfully applied. */ + Completed = "Completed", + /** Updates installation failed but are ready to retry again. */ + RetryNow = "RetryNow", + /** Updates installation failed and should be retried later. */ + RetryLater = "RetryLater" +} + +/** + * Defines values for UpdateStatus. \ + * {@link KnownUpdateStatus} can be used interchangeably with UpdateStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending**: There are pending updates to be installed. \ + * **InProgress**: Updates installation are in progress. \ + * **Completed**: All updates are successfully applied. \ + * **RetryNow**: Updates installation failed but are ready to retry again. \ + * **RetryLater**: Updates installation failed and should be retried later. + */ +export type UpdateStatus = string; + +/** Known values of {@link ImpactType} that the service accepts. */ +export enum KnownImpactType { + /** Pending updates has no impact on resource. */ + None = "None", + /** Pending updates can freeze network or disk io operation on resource. */ + Freeze = "Freeze", + /** Pending updates can cause resource to restart. */ + Restart = "Restart", + /** Pending updates can redeploy resource. */ + Redeploy = "Redeploy" +} + +/** + * Defines values for ImpactType. \ + * {@link KnownImpactType} can be used interchangeably with ImpactType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: Pending updates has no impact on resource. \ + * **Freeze**: Pending updates can freeze network or disk io operation on resource. \ + * **Restart**: Pending updates can cause resource to restart. \ + * **Redeploy**: Pending updates can redeploy resource. + */ +export type ImpactType = string; +/** Defines values for TagOperators. */ +export type TagOperators = "All" | "Any"; + +/** Optional parameters. */ +export interface PublicMaintenanceConfigurationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type PublicMaintenanceConfigurationsListResponse = ListMaintenanceConfigurationsResult; + +/** Optional parameters. */ +export interface PublicMaintenanceConfigurationsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type PublicMaintenanceConfigurationsGetResponse = MaintenanceConfiguration; + +/** Optional parameters. */ +export interface ApplyUpdatesGetParentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getParent operation. */ +export type ApplyUpdatesGetParentResponse = ApplyUpdate; + +/** Optional parameters. */ +export interface ApplyUpdatesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ApplyUpdatesGetResponse = ApplyUpdate; + +/** Optional parameters. */ +export interface ApplyUpdatesCreateOrUpdateParentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdateParent operation. */ +export type ApplyUpdatesCreateOrUpdateParentResponse = ApplyUpdate; + +/** Optional parameters. */ +export interface ApplyUpdatesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type ApplyUpdatesCreateOrUpdateResponse = ApplyUpdate; + +/** Optional parameters. */ +export interface ApplyUpdatesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ApplyUpdatesListResponse = ListApplyUpdate; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsGetParentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getParent operation. */ +export type ConfigurationAssignmentsGetParentResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsCreateOrUpdateParentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdateParent operation. */ +export type ConfigurationAssignmentsCreateOrUpdateParentResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsDeleteParentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the deleteParent operation. */ +export type ConfigurationAssignmentsDeleteParentResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ConfigurationAssignmentsGetResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type ConfigurationAssignmentsCreateOrUpdateResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type ConfigurationAssignmentsDeleteResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsListParentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listParent operation. */ +export type ConfigurationAssignmentsListParentResponse = ListConfigurationAssignmentsResult; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ConfigurationAssignmentsListResponse = ListConfigurationAssignmentsResult; + +/** Optional parameters. */ +export interface MaintenanceConfigurationsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type MaintenanceConfigurationsGetResponse = MaintenanceConfiguration; + +/** Optional parameters. */ +export interface MaintenanceConfigurationsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type MaintenanceConfigurationsCreateOrUpdateResponse = MaintenanceConfiguration; + +/** Optional parameters. */ +export interface MaintenanceConfigurationsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type MaintenanceConfigurationsDeleteResponse = MaintenanceConfiguration; + +/** Optional parameters. */ +export interface MaintenanceConfigurationsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type MaintenanceConfigurationsUpdateResponse = MaintenanceConfiguration; + +/** Optional parameters. */ +export interface MaintenanceConfigurationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type MaintenanceConfigurationsListResponse = ListMaintenanceConfigurationsResult; + +/** Optional parameters. */ +export interface MaintenanceConfigurationsForResourceGroupListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type MaintenanceConfigurationsForResourceGroupListResponse = ListMaintenanceConfigurationsResult; + +/** Optional parameters. */ +export interface ApplyUpdateForResourceGroupListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ApplyUpdateForResourceGroupListResponse = ListApplyUpdate; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsWithinSubscriptionListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ConfigurationAssignmentsWithinSubscriptionListResponse = ListConfigurationAssignmentsResult; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsForSubscriptionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ConfigurationAssignmentsForSubscriptionsGetResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsForSubscriptionsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type ConfigurationAssignmentsForSubscriptionsCreateOrUpdateResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsForSubscriptionsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ConfigurationAssignmentsForSubscriptionsUpdateResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsForSubscriptionsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type ConfigurationAssignmentsForSubscriptionsDeleteResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsForResourceGroupGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ConfigurationAssignmentsForResourceGroupGetResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsForResourceGroupCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type ConfigurationAssignmentsForResourceGroupCreateOrUpdateResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsForResourceGroupUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ConfigurationAssignmentsForResourceGroupUpdateResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface ConfigurationAssignmentsForResourceGroupDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type ConfigurationAssignmentsForResourceGroupDeleteResponse = ConfigurationAssignment; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationsListResult; + +/** Optional parameters. */ +export interface UpdatesListParentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listParent operation. */ +export type UpdatesListParentResponse = ListUpdatesResult; + +/** Optional parameters. */ +export interface UpdatesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type UpdatesListResponse = ListUpdatesResult; + +/** Optional parameters. */ +export interface MaintenanceManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/maintenance/arm-maintenance/src/models/mappers.ts b/sdk/maintenance/arm-maintenance/src/models/mappers.ts new file mode 100644 index 000000000000..178fdc57977d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/models/mappers.ts @@ -0,0 +1,705 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const ListMaintenanceConfigurationsResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ListMaintenanceConfigurationsResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MaintenanceConfiguration" + } + } + } + } + } + } +}; + +export const InputPatchConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InputPatchConfiguration", + modelProperties: { + rebootSetting: { + defaultValue: "IfRequired", + serializedName: "rebootSetting", + type: { + name: "String" + } + }, + windowsParameters: { + serializedName: "windowsParameters", + type: { + name: "Composite", + className: "InputWindowsParameters" + } + }, + linuxParameters: { + serializedName: "linuxParameters", + type: { + name: "Composite", + className: "InputLinuxParameters" + } + } + } + } +}; + +export const InputWindowsParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InputWindowsParameters", + modelProperties: { + kbNumbersToExclude: { + serializedName: "kbNumbersToExclude", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + kbNumbersToInclude: { + serializedName: "kbNumbersToInclude", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + classificationsToInclude: { + serializedName: "classificationsToInclude", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + excludeKbsRequiringReboot: { + serializedName: "excludeKbsRequiringReboot", + type: { + name: "Boolean" + } + } + } + } +}; + +export const InputLinuxParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InputLinuxParameters", + modelProperties: { + packageNameMasksToExclude: { + serializedName: "packageNameMasksToExclude", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + packageNameMasksToInclude: { + serializedName: "packageNameMasksToInclude", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + classificationsToInclude: { + serializedName: "classificationsToInclude", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const MaintenanceError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MaintenanceError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetails" + } + } + } + } +}; + +export const ErrorDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetails", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ConfigurationAssignmentFilterProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfigurationAssignmentFilterProperties", + modelProperties: { + resourceTypes: { + serializedName: "resourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resourceGroups: { + serializedName: "resourceGroups", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + osTypes: { + serializedName: "osTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + locations: { + serializedName: "locations", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + tagSettings: { + serializedName: "tagSettings", + type: { + name: "Composite", + className: "TagSettingsProperties" + } + } + } + } +}; + +export const TagSettingsProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TagSettingsProperties", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { name: "Sequence", element: { type: { name: "String" } } } + } + } + }, + filterOperator: { + serializedName: "filterOperator", + type: { + name: "Enum", + allowedValues: ["All", "Any"] + } + } + } + } +}; + +export const ListConfigurationAssignmentsResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ListConfigurationAssignmentsResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ConfigurationAssignment" + } + } + } + } + } + } +}; + +export const ListApplyUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ListApplyUpdate", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApplyUpdate" + } + } + } + } + } + } +}; + +export const OperationsListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationsListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationInfo" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + } + } + } +}; + +export const OperationInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationInfo", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const ListUpdatesResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ListUpdatesResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Update" + } + } + } + } + } + } +}; + +export const Update: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Update", + modelProperties: { + maintenanceScope: { + serializedName: "maintenanceScope", + type: { + name: "String" + } + }, + impactType: { + serializedName: "impactType", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + impactDurationInSec: { + serializedName: "impactDurationInSec", + type: { + name: "Number" + } + }, + notBefore: { + serializedName: "notBefore", + type: { + name: "DateTime" + } + }, + resourceId: { + serializedName: "properties.resourceId", + type: { + name: "String" + } + } + } + } +}; + +export const MaintenanceConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MaintenanceConfiguration", + modelProperties: { + ...Resource.type.modelProperties, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + namespace: { + serializedName: "properties.namespace", + type: { + name: "String" + } + }, + extensionProperties: { + serializedName: "properties.extensionProperties", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + maintenanceScope: { + serializedName: "properties.maintenanceScope", + type: { + name: "String" + } + }, + visibility: { + serializedName: "properties.visibility", + type: { + name: "String" + } + }, + installPatches: { + serializedName: "properties.installPatches", + type: { + name: "Composite", + className: "InputPatchConfiguration" + } + }, + startDateTime: { + serializedName: "properties.maintenanceWindow.startDateTime", + type: { + name: "String" + } + }, + expirationDateTime: { + serializedName: "properties.maintenanceWindow.expirationDateTime", + type: { + name: "String" + } + }, + duration: { + serializedName: "properties.maintenanceWindow.duration", + type: { + name: "String" + } + }, + timeZone: { + serializedName: "properties.maintenanceWindow.timeZone", + type: { + name: "String" + } + }, + recurEvery: { + serializedName: "properties.maintenanceWindow.recurEvery", + type: { + name: "String" + } + } + } + } +}; + +export const ApplyUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApplyUpdate", + modelProperties: { + ...Resource.type.modelProperties, + status: { + serializedName: "properties.status", + type: { + name: "String" + } + }, + resourceId: { + serializedName: "properties.resourceId", + type: { + name: "String" + } + }, + lastUpdateTime: { + serializedName: "properties.lastUpdateTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ConfigurationAssignment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfigurationAssignment", + modelProperties: { + ...Resource.type.modelProperties, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + maintenanceConfigurationId: { + serializedName: "properties.maintenanceConfigurationId", + type: { + name: "String" + } + }, + resourceId: { + serializedName: "properties.resourceId", + type: { + name: "String" + } + }, + filter: { + serializedName: "properties.filter", + type: { + name: "Composite", + className: "ConfigurationAssignmentFilterProperties" + } + } + } + } +}; diff --git a/sdk/maintenance/arm-maintenance/src/models/parameters.ts b/sdk/maintenance/arm-maintenance/src/models/parameters.ts new file mode 100644 index 000000000000..0f016a7534a4 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/models/parameters.ts @@ -0,0 +1,188 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + ConfigurationAssignment as ConfigurationAssignmentMapper, + MaintenanceConfiguration as MaintenanceConfigurationMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2023-04-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const providerName: OperationURLParameter = { + parameterPath: "providerName", + mapper: { + serializedName: "providerName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceParentType: OperationURLParameter = { + parameterPath: "resourceParentType", + mapper: { + serializedName: "resourceParentType", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceParentName: OperationURLParameter = { + parameterPath: "resourceParentName", + mapper: { + serializedName: "resourceParentName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceType: OperationURLParameter = { + parameterPath: "resourceType", + mapper: { + serializedName: "resourceType", + required: true, + type: { + name: "String" + } + } +}; + +export const applyUpdateName: OperationURLParameter = { + parameterPath: "applyUpdateName", + mapper: { + serializedName: "applyUpdateName", + required: true, + type: { + name: "String" + } + } +}; + +export const configurationAssignmentName: OperationURLParameter = { + parameterPath: "configurationAssignmentName", + mapper: { + serializedName: "configurationAssignmentName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const configurationAssignment: OperationParameter = { + parameterPath: "configurationAssignment", + mapper: ConfigurationAssignmentMapper +}; + +export const configuration: OperationParameter = { + parameterPath: "configuration", + mapper: MaintenanceConfigurationMapper +}; + +export const configurationAssignmentName1: OperationURLParameter = { + parameterPath: "configurationAssignmentName", + mapper: { + constraints: { + Pattern: new RegExp("^.+$") + }, + serializedName: "configurationAssignmentName", + required: true, + type: { + name: "String" + } + } +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/applyUpdateForResourceGroup.ts b/sdk/maintenance/arm-maintenance/src/operations/applyUpdateForResourceGroup.ts new file mode 100644 index 000000000000..b913cf9ee4ae --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/applyUpdateForResourceGroup.ts @@ -0,0 +1,118 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { ApplyUpdateForResourceGroup } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + ApplyUpdate, + ApplyUpdateForResourceGroupListOptionalParams, + ApplyUpdateForResourceGroupListResponse +} from "../models"; + +/// +/** Class containing ApplyUpdateForResourceGroup operations. */ +export class ApplyUpdateForResourceGroupImpl + implements ApplyUpdateForResourceGroup { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class ApplyUpdateForResourceGroup class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get Configuration records within a subscription and resource group + * @param resourceGroupName Resource Group Name + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + options?: ApplyUpdateForResourceGroupListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(resourceGroupName, options, settings); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + options?: ApplyUpdateForResourceGroupListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: ApplyUpdateForResourceGroupListResponse; + result = await this._list(resourceGroupName, options); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + options?: ApplyUpdateForResourceGroupListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(resourceGroupName, options)) { + yield* page; + } + } + + /** + * Get Configuration records within a subscription and resource group + * @param resourceGroupName Resource Group Name + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + options?: ApplyUpdateForResourceGroupListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/applyUpdates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListApplyUpdate + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/applyUpdates.ts b/sdk/maintenance/arm-maintenance/src/operations/applyUpdates.ts new file mode 100644 index 000000000000..fcc239cb4913 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/applyUpdates.ts @@ -0,0 +1,340 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { ApplyUpdates } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + ApplyUpdate, + ApplyUpdatesListOptionalParams, + ApplyUpdatesListResponse, + ApplyUpdatesGetParentOptionalParams, + ApplyUpdatesGetParentResponse, + ApplyUpdatesGetOptionalParams, + ApplyUpdatesGetResponse, + ApplyUpdatesCreateOrUpdateParentOptionalParams, + ApplyUpdatesCreateOrUpdateParentResponse, + ApplyUpdatesCreateOrUpdateOptionalParams, + ApplyUpdatesCreateOrUpdateResponse +} from "../models"; + +/// +/** Class containing ApplyUpdates operations. */ +export class ApplyUpdatesImpl implements ApplyUpdates { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class ApplyUpdates class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get Configuration records within a subscription + * @param options The options parameters. + */ + public list( + options?: ApplyUpdatesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: ApplyUpdatesListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: ApplyUpdatesListResponse; + result = await this._list(options); + yield result.value || []; + } + + private async *listPagingAll( + options?: ApplyUpdatesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Track maintenance updates to resource with parent + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @param options The options parameters. + */ + getParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + applyUpdateName: string, + options?: ApplyUpdatesGetParentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + applyUpdateName, + options + }, + getParentOperationSpec + ); + } + + /** + * Track maintenance updates to resource + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @param options The options parameters. + */ + get( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + applyUpdateName: string, + options?: ApplyUpdatesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceType, + resourceName, + applyUpdateName, + options + }, + getOperationSpec + ); + } + + /** + * Apply maintenance updates to resource with parent + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + createOrUpdateParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: ApplyUpdatesCreateOrUpdateParentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + }, + createOrUpdateParentOperationSpec + ); + } + + /** + * Apply maintenance updates to resource + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: ApplyUpdatesCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, providerName, resourceType, resourceName, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Get Configuration records within a subscription + * @param options The options parameters. + */ + private _list( + options?: ApplyUpdatesListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getParentOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplyUpdate + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceParentType, + Parameters.resourceParentName, + Parameters.resourceType, + Parameters.applyUpdateName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplyUpdate + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceType, + Parameters.applyUpdateName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateParentOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ApplyUpdate + }, + 201: { + bodyMapper: Mappers.ApplyUpdate + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceParentType, + Parameters.resourceParentName, + Parameters.resourceType + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ApplyUpdate + }, + 201: { + bodyMapper: Mappers.ApplyUpdate + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceType + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListApplyUpdate + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/configurationAssignments.ts b/sdk/maintenance/arm-maintenance/src/operations/configurationAssignments.ts new file mode 100644 index 000000000000..15b3badf9335 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/configurationAssignments.ts @@ -0,0 +1,706 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { ConfigurationAssignments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + ConfigurationAssignment, + ConfigurationAssignmentsListParentOptionalParams, + ConfigurationAssignmentsListParentResponse, + ConfigurationAssignmentsListOptionalParams, + ConfigurationAssignmentsListResponse, + ConfigurationAssignmentsGetParentOptionalParams, + ConfigurationAssignmentsGetParentResponse, + ConfigurationAssignmentsCreateOrUpdateParentOptionalParams, + ConfigurationAssignmentsCreateOrUpdateParentResponse, + ConfigurationAssignmentsDeleteParentOptionalParams, + ConfigurationAssignmentsDeleteParentResponse, + ConfigurationAssignmentsGetOptionalParams, + ConfigurationAssignmentsGetResponse, + ConfigurationAssignmentsCreateOrUpdateOptionalParams, + ConfigurationAssignmentsCreateOrUpdateResponse, + ConfigurationAssignmentsDeleteOptionalParams, + ConfigurationAssignmentsDeleteResponse +} from "../models"; + +/// +/** Class containing ConfigurationAssignments operations. */ +export class ConfigurationAssignmentsImpl implements ConfigurationAssignments { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class ConfigurationAssignments class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * List configurationAssignments for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + public listParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListParentOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listParentPagingAll( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listParentPagingPage( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options, + settings + ); + } + }; + } + + private async *listParentPagingPage( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListParentOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: ConfigurationAssignmentsListParentResponse; + result = await this._listParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + ); + yield result.value || []; + } + + private async *listParentPagingAll( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListParentOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listParentPagingPage( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + )) { + yield* page; + } + } + + /** + * List configurationAssignments for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + providerName, + resourceType, + resourceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + providerName, + resourceType, + resourceName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: ConfigurationAssignmentsListResponse; + result = await this._list( + resourceGroupName, + providerName, + resourceType, + resourceName, + options + ); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + providerName, + resourceType, + resourceName, + options + )) { + yield* page; + } + } + + /** + * Get configuration assignment for resource.. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param options The options parameters. + */ + getParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsGetParentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName, + options + }, + getParentOperationSpec + ); + } + + /** + * Register configuration for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + createOrUpdateParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsCreateOrUpdateParentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName, + configurationAssignment, + options + }, + createOrUpdateParentOperationSpec + ); + } + + /** + * Unregister configuration for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @param options The options parameters. + */ + deleteParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsDeleteParentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + configurationAssignmentName, + options + }, + deleteParentOperationSpec + ); + } + + /** + * Get configuration assignment for resource.. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName, + options + }, + getOperationSpec + ); + } + + /** + * Register configuration for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName, + configurationAssignment, + options + }, + createOrUpdateOperationSpec + ); + } + + /** + * Unregister configuration for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceType, + resourceName, + configurationAssignmentName, + options + }, + deleteOperationSpec + ); + } + + /** + * List configurationAssignments for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + private _listParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListParentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + }, + listParentOperationSpec + ); + } + + /** + * List configurationAssignments for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, providerName, resourceType, resourceName, options }, + listOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getParentOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceParentType, + Parameters.resourceParentName, + Parameters.resourceType, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateParentOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + 201: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + requestBody: Parameters.configurationAssignment, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceParentType, + Parameters.resourceParentName, + Parameters.resourceType, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteParentOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "DELETE", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + 204: {}, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceParentType, + Parameters.resourceParentName, + Parameters.resourceType, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceType, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + 201: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + requestBody: Parameters.configurationAssignment, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceType, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "DELETE", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + 204: {}, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceType, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listParentOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListConfigurationAssignmentsResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceParentType, + Parameters.resourceParentName, + Parameters.resourceType + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListConfigurationAssignmentsResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceType + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsForResourceGroup.ts b/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsForResourceGroup.ts new file mode 100644 index 000000000000..c06031b2c1e1 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsForResourceGroup.ts @@ -0,0 +1,219 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { ConfigurationAssignmentsForResourceGroup } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + ConfigurationAssignmentsForResourceGroupGetOptionalParams, + ConfigurationAssignmentsForResourceGroupGetResponse, + ConfigurationAssignment, + ConfigurationAssignmentsForResourceGroupCreateOrUpdateOptionalParams, + ConfigurationAssignmentsForResourceGroupCreateOrUpdateResponse, + ConfigurationAssignmentsForResourceGroupUpdateOptionalParams, + ConfigurationAssignmentsForResourceGroupUpdateResponse, + ConfigurationAssignmentsForResourceGroupDeleteOptionalParams, + ConfigurationAssignmentsForResourceGroupDeleteResponse +} from "../models"; + +/** Class containing ConfigurationAssignmentsForResourceGroup operations. */ +export class ConfigurationAssignmentsForResourceGroupImpl + implements ConfigurationAssignmentsForResourceGroup { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class ConfigurationAssignmentsForResourceGroup class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get configuration assignment for resource.. + * @param resourceGroupName Resource group name + * @param configurationAssignmentName Configuration assignment name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsForResourceGroupGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, configurationAssignmentName, options }, + getOperationSpec + ); + } + + /** + * Register configuration for resource. + * @param resourceGroupName Resource group name + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsForResourceGroupCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + configurationAssignmentName, + configurationAssignment, + options + }, + createOrUpdateOperationSpec + ); + } + + /** + * Register configuration for resource. + * @param resourceGroupName Resource group name + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + update( + resourceGroupName: string, + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsForResourceGroupUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + configurationAssignmentName, + configurationAssignment, + options + }, + updateOperationSpec + ); + } + + /** + * Unregister configuration for resource. + * @param resourceGroupName Resource group name + * @param configurationAssignmentName Unique configuration assignment name + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsForResourceGroupDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, configurationAssignmentName, options }, + deleteOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.configurationAssignmentName1 + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + 201: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + requestBody: Parameters.configurationAssignment, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + requestBody: Parameters.configurationAssignment, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "DELETE", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + 204: {}, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsForSubscriptions.ts b/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsForSubscriptions.ts new file mode 100644 index 000000000000..78f693dba11f --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsForSubscriptions.ts @@ -0,0 +1,197 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { ConfigurationAssignmentsForSubscriptions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + ConfigurationAssignmentsForSubscriptionsGetOptionalParams, + ConfigurationAssignmentsForSubscriptionsGetResponse, + ConfigurationAssignment, + ConfigurationAssignmentsForSubscriptionsCreateOrUpdateOptionalParams, + ConfigurationAssignmentsForSubscriptionsCreateOrUpdateResponse, + ConfigurationAssignmentsForSubscriptionsUpdateOptionalParams, + ConfigurationAssignmentsForSubscriptionsUpdateResponse, + ConfigurationAssignmentsForSubscriptionsDeleteOptionalParams, + ConfigurationAssignmentsForSubscriptionsDeleteResponse +} from "../models"; + +/** Class containing ConfigurationAssignmentsForSubscriptions operations. */ +export class ConfigurationAssignmentsForSubscriptionsImpl + implements ConfigurationAssignmentsForSubscriptions { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class ConfigurationAssignmentsForSubscriptions class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get configuration assignment for resource.. + * @param configurationAssignmentName Configuration assignment name + * @param options The options parameters. + */ + get( + configurationAssignmentName: string, + options?: ConfigurationAssignmentsForSubscriptionsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { configurationAssignmentName, options }, + getOperationSpec + ); + } + + /** + * Register configuration for resource. + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + createOrUpdate( + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsForSubscriptionsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { configurationAssignmentName, configurationAssignment, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Register configuration for resource. + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + update( + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsForSubscriptionsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { configurationAssignmentName, configurationAssignment, options }, + updateOperationSpec + ); + } + + /** + * Unregister configuration for resource. + * @param configurationAssignmentName Unique configuration assignment name + * @param options The options parameters. + */ + delete( + configurationAssignmentName: string, + options?: ConfigurationAssignmentsForSubscriptionsDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { configurationAssignmentName, options }, + deleteOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + 201: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + requestBody: Parameters.configurationAssignment, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + requestBody: Parameters.configurationAssignment, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", + httpMethod: "DELETE", + responses: { + 200: { + bodyMapper: Mappers.ConfigurationAssignment + }, + 204: {}, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.configurationAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsWithinSubscription.ts b/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsWithinSubscription.ts new file mode 100644 index 000000000000..0f265c30a27b --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/configurationAssignmentsWithinSubscription.ts @@ -0,0 +1,105 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { ConfigurationAssignmentsWithinSubscription } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + ConfigurationAssignment, + ConfigurationAssignmentsWithinSubscriptionListOptionalParams, + ConfigurationAssignmentsWithinSubscriptionListResponse +} from "../models"; + +/// +/** Class containing ConfigurationAssignmentsWithinSubscription operations. */ +export class ConfigurationAssignmentsWithinSubscriptionImpl + implements ConfigurationAssignmentsWithinSubscription { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class ConfigurationAssignmentsWithinSubscription class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get configuration assignment within a subscription + * @param options The options parameters. + */ + public list( + options?: ConfigurationAssignmentsWithinSubscriptionListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: ConfigurationAssignmentsWithinSubscriptionListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: ConfigurationAssignmentsWithinSubscriptionListResponse; + result = await this._list(options); + yield result.value || []; + } + + private async *listPagingAll( + options?: ConfigurationAssignmentsWithinSubscriptionListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Get configuration assignment within a subscription + * @param options The options parameters. + */ + private _list( + options?: ConfigurationAssignmentsWithinSubscriptionListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListConfigurationAssignmentsResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/index.ts b/sdk/maintenance/arm-maintenance/src/operations/index.ts new file mode 100644 index 000000000000..f483a9d87ceb --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/index.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./publicMaintenanceConfigurations"; +export * from "./applyUpdates"; +export * from "./configurationAssignments"; +export * from "./maintenanceConfigurations"; +export * from "./maintenanceConfigurationsForResourceGroup"; +export * from "./applyUpdateForResourceGroup"; +export * from "./configurationAssignmentsWithinSubscription"; +export * from "./configurationAssignmentsForSubscriptions"; +export * from "./configurationAssignmentsForResourceGroup"; +export * from "./operations"; +export * from "./updates"; diff --git a/sdk/maintenance/arm-maintenance/src/operations/maintenanceConfigurations.ts b/sdk/maintenance/arm-maintenance/src/operations/maintenanceConfigurations.ts new file mode 100644 index 000000000000..407b99b1ec11 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/maintenanceConfigurations.ts @@ -0,0 +1,281 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { MaintenanceConfigurations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + MaintenanceConfiguration, + MaintenanceConfigurationsListOptionalParams, + MaintenanceConfigurationsListResponse, + MaintenanceConfigurationsGetOptionalParams, + MaintenanceConfigurationsGetResponse, + MaintenanceConfigurationsCreateOrUpdateOptionalParams, + MaintenanceConfigurationsCreateOrUpdateResponse, + MaintenanceConfigurationsDeleteOptionalParams, + MaintenanceConfigurationsDeleteResponse, + MaintenanceConfigurationsUpdateOptionalParams, + MaintenanceConfigurationsUpdateResponse +} from "../models"; + +/// +/** Class containing MaintenanceConfigurations operations. */ +export class MaintenanceConfigurationsImpl + implements MaintenanceConfigurations { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class MaintenanceConfigurations class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get Configuration records within a subscription + * @param options The options parameters. + */ + public list( + options?: MaintenanceConfigurationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: MaintenanceConfigurationsListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: MaintenanceConfigurationsListResponse; + result = await this._list(options); + yield result.value || []; + } + + private async *listPagingAll( + options?: MaintenanceConfigurationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Get Configuration record + * @param resourceGroupName Resource Group Name + * @param resourceName Maintenance Configuration Name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: MaintenanceConfigurationsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + getOperationSpec + ); + } + + /** + * Create or Update configuration record + * @param resourceGroupName Resource Group Name + * @param resourceName Maintenance Configuration Name + * @param configuration The configuration + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + resourceName: string, + configuration: MaintenanceConfiguration, + options?: MaintenanceConfigurationsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, configuration, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Delete Configuration record + * @param resourceGroupName Resource Group Name + * @param resourceName Maintenance Configuration Name + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + resourceName: string, + options?: MaintenanceConfigurationsDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + deleteOperationSpec + ); + } + + /** + * Patch configuration record + * @param resourceGroupName Resource Group Name + * @param resourceName Maintenance Configuration Name + * @param configuration The configuration + * @param options The options parameters. + */ + update( + resourceGroupName: string, + resourceName: string, + configuration: MaintenanceConfiguration, + options?: MaintenanceConfigurationsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, configuration, options }, + updateOperationSpec + ); + } + + /** + * Get Configuration records within a subscription + * @param options The options parameters. + */ + private _list( + options?: MaintenanceConfigurationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MaintenanceConfiguration + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.MaintenanceConfiguration + }, + 201: { + bodyMapper: Mappers.MaintenanceConfiguration + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + requestBody: Parameters.configuration, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", + httpMethod: "DELETE", + responses: { + 200: { + bodyMapper: Mappers.MaintenanceConfiguration + }, + 204: {}, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.MaintenanceConfiguration + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + requestBody: Parameters.configuration, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/maintenanceConfigurations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListMaintenanceConfigurationsResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/maintenanceConfigurationsForResourceGroup.ts b/sdk/maintenance/arm-maintenance/src/operations/maintenanceConfigurationsForResourceGroup.ts new file mode 100644 index 000000000000..9fa95f5d27ad --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/maintenanceConfigurationsForResourceGroup.ts @@ -0,0 +1,118 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { MaintenanceConfigurationsForResourceGroup } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + MaintenanceConfiguration, + MaintenanceConfigurationsForResourceGroupListOptionalParams, + MaintenanceConfigurationsForResourceGroupListResponse +} from "../models"; + +/// +/** Class containing MaintenanceConfigurationsForResourceGroup operations. */ +export class MaintenanceConfigurationsForResourceGroupImpl + implements MaintenanceConfigurationsForResourceGroup { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class MaintenanceConfigurationsForResourceGroup class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get Configuration records within a subscription and resource group + * @param resourceGroupName Resource Group Name + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + options?: MaintenanceConfigurationsForResourceGroupListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(resourceGroupName, options, settings); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + options?: MaintenanceConfigurationsForResourceGroupListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: MaintenanceConfigurationsForResourceGroupListResponse; + result = await this._list(resourceGroupName, options); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + options?: MaintenanceConfigurationsForResourceGroupListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(resourceGroupName, options)) { + yield* page; + } + } + + /** + * Get Configuration records within a subscription and resource group + * @param resourceGroupName Resource Group Name + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + options?: MaintenanceConfigurationsForResourceGroupListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListMaintenanceConfigurationsResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/operations.ts b/sdk/maintenance/arm-maintenance/src/operations/operations.ts new file mode 100644 index 000000000000..73a90b6c5dcb --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/operations.ts @@ -0,0 +1,103 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + Operation, + OperationsListOptionalParams, + OperationsListResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * List the available operations supported by the Microsoft.Maintenance resource provider + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: OperationsListResponse; + result = await this._list(options); + yield result.value || []; + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List the available operations supported by the Microsoft.Maintenance resource provider + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Maintenance/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationsListResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/publicMaintenanceConfigurations.ts b/sdk/maintenance/arm-maintenance/src/operations/publicMaintenanceConfigurations.ts new file mode 100644 index 000000000000..dafd0947c17c --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/publicMaintenanceConfigurations.ts @@ -0,0 +1,143 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { PublicMaintenanceConfigurations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + MaintenanceConfiguration, + PublicMaintenanceConfigurationsListOptionalParams, + PublicMaintenanceConfigurationsListResponse, + PublicMaintenanceConfigurationsGetOptionalParams, + PublicMaintenanceConfigurationsGetResponse +} from "../models"; + +/// +/** Class containing PublicMaintenanceConfigurations operations. */ +export class PublicMaintenanceConfigurationsImpl + implements PublicMaintenanceConfigurations { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class PublicMaintenanceConfigurations class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get Public Maintenance Configuration records + * @param options The options parameters. + */ + public list( + options?: PublicMaintenanceConfigurationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: PublicMaintenanceConfigurationsListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: PublicMaintenanceConfigurationsListResponse; + result = await this._list(options); + yield result.value || []; + } + + private async *listPagingAll( + options?: PublicMaintenanceConfigurationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Get Public Maintenance Configuration records + * @param options The options parameters. + */ + private _list( + options?: PublicMaintenanceConfigurationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * Get Public Maintenance Configuration record + * @param resourceName Maintenance Configuration Name + * @param options The options parameters. + */ + get( + resourceName: string, + options?: PublicMaintenanceConfigurationsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceName, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListMaintenanceConfigurationsResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MaintenanceConfiguration + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operations/updates.ts b/sdk/maintenance/arm-maintenance/src/operations/updates.ts new file mode 100644 index 000000000000..5205c004250b --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operations/updates.ts @@ -0,0 +1,322 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { Updates } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MaintenanceManagementClient } from "../maintenanceManagementClient"; +import { + Update, + UpdatesListParentOptionalParams, + UpdatesListParentResponse, + UpdatesListOptionalParams, + UpdatesListResponse +} from "../models"; + +/// +/** Class containing Updates operations. */ +export class UpdatesImpl implements Updates { + private readonly client: MaintenanceManagementClient; + + /** + * Initialize a new instance of the class Updates class. + * @param client Reference to the service client + */ + constructor(client: MaintenanceManagementClient) { + this.client = client; + } + + /** + * Get updates to resources. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + public listParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListParentOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listParentPagingAll( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listParentPagingPage( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options, + settings + ); + } + }; + } + + private async *listParentPagingPage( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListParentOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: UpdatesListParentResponse; + result = await this._listParent( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + ); + yield result.value || []; + } + + private async *listParentPagingAll( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListParentOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listParentPagingPage( + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + )) { + yield* page; + } + } + + /** + * Get updates to resources. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + providerName, + resourceType, + resourceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + providerName, + resourceType, + resourceName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListOptionalParams, + _settings?: PageSettings + ): AsyncIterableIterator { + let result: UpdatesListResponse; + result = await this._list( + resourceGroupName, + providerName, + resourceType, + resourceName, + options + ); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + providerName, + resourceType, + resourceName, + options + )) { + yield* page; + } + } + + /** + * Get updates to resources. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + private _listParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListParentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + providerName, + resourceParentType, + resourceParentName, + resourceType, + resourceName, + options + }, + listParentOperationSpec + ); + } + + /** + * Get updates to resources. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, providerName, resourceType, resourceName, options }, + listOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listParentOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListUpdatesResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceParentType, + Parameters.resourceParentName, + Parameters.resourceType + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ListUpdatesResult + }, + default: { + bodyMapper: Mappers.MaintenanceError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceName, + Parameters.resourceGroupName, + Parameters.providerName, + Parameters.resourceType + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/applyUpdateForResourceGroup.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/applyUpdateForResourceGroup.ts new file mode 100644 index 000000000000..f47a3b42cd9a --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/applyUpdateForResourceGroup.ts @@ -0,0 +1,27 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + ApplyUpdate, + ApplyUpdateForResourceGroupListOptionalParams +} from "../models"; + +/// +/** Interface representing a ApplyUpdateForResourceGroup. */ +export interface ApplyUpdateForResourceGroup { + /** + * Get Configuration records within a subscription and resource group + * @param resourceGroupName Resource Group Name + * @param options The options parameters. + */ + list( + resourceGroupName: string, + options?: ApplyUpdateForResourceGroupListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/applyUpdates.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/applyUpdates.ts new file mode 100644 index 000000000000..f59851d425c0 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/applyUpdates.ts @@ -0,0 +1,105 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + ApplyUpdate, + ApplyUpdatesListOptionalParams, + ApplyUpdatesGetParentOptionalParams, + ApplyUpdatesGetParentResponse, + ApplyUpdatesGetOptionalParams, + ApplyUpdatesGetResponse, + ApplyUpdatesCreateOrUpdateParentOptionalParams, + ApplyUpdatesCreateOrUpdateParentResponse, + ApplyUpdatesCreateOrUpdateOptionalParams, + ApplyUpdatesCreateOrUpdateResponse +} from "../models"; + +/// +/** Interface representing a ApplyUpdates. */ +export interface ApplyUpdates { + /** + * Get Configuration records within a subscription + * @param options The options parameters. + */ + list( + options?: ApplyUpdatesListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Track maintenance updates to resource with parent + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @param options The options parameters. + */ + getParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + applyUpdateName: string, + options?: ApplyUpdatesGetParentOptionalParams + ): Promise; + /** + * Track maintenance updates to resource + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @param options The options parameters. + */ + get( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + applyUpdateName: string, + options?: ApplyUpdatesGetOptionalParams + ): Promise; + /** + * Apply maintenance updates to resource with parent + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + createOrUpdateParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: ApplyUpdatesCreateOrUpdateParentOptionalParams + ): Promise; + /** + * Apply maintenance updates to resource + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: ApplyUpdatesCreateOrUpdateOptionalParams + ): Promise; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignments.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignments.ts new file mode 100644 index 000000000000..bc9203a817f4 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignments.ts @@ -0,0 +1,183 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + ConfigurationAssignment, + ConfigurationAssignmentsListParentOptionalParams, + ConfigurationAssignmentsListOptionalParams, + ConfigurationAssignmentsGetParentOptionalParams, + ConfigurationAssignmentsGetParentResponse, + ConfigurationAssignmentsCreateOrUpdateParentOptionalParams, + ConfigurationAssignmentsCreateOrUpdateParentResponse, + ConfigurationAssignmentsDeleteParentOptionalParams, + ConfigurationAssignmentsDeleteParentResponse, + ConfigurationAssignmentsGetOptionalParams, + ConfigurationAssignmentsGetResponse, + ConfigurationAssignmentsCreateOrUpdateOptionalParams, + ConfigurationAssignmentsCreateOrUpdateResponse, + ConfigurationAssignmentsDeleteOptionalParams, + ConfigurationAssignmentsDeleteResponse +} from "../models"; + +/// +/** Interface representing a ConfigurationAssignments. */ +export interface ConfigurationAssignments { + /** + * List configurationAssignments for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + listParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListParentOptionalParams + ): PagedAsyncIterableIterator; + /** + * List configurationAssignments for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + list( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: ConfigurationAssignmentsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get configuration assignment for resource.. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param options The options parameters. + */ + getParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsGetParentOptionalParams + ): Promise; + /** + * Register configuration for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + createOrUpdateParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsCreateOrUpdateParentOptionalParams + ): Promise; + /** + * Unregister configuration for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @param options The options parameters. + */ + deleteParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsDeleteParentOptionalParams + ): Promise; + /** + * Get configuration assignment for resource.. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsGetOptionalParams + ): Promise; + /** + * Register configuration for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsCreateOrUpdateOptionalParams + ): Promise; + /** + * Unregister configuration for resource. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsForResourceGroup.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsForResourceGroup.ts new file mode 100644 index 000000000000..e1f2c0bdf83c --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsForResourceGroup.ts @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + ConfigurationAssignmentsForResourceGroupGetOptionalParams, + ConfigurationAssignmentsForResourceGroupGetResponse, + ConfigurationAssignment, + ConfigurationAssignmentsForResourceGroupCreateOrUpdateOptionalParams, + ConfigurationAssignmentsForResourceGroupCreateOrUpdateResponse, + ConfigurationAssignmentsForResourceGroupUpdateOptionalParams, + ConfigurationAssignmentsForResourceGroupUpdateResponse, + ConfigurationAssignmentsForResourceGroupDeleteOptionalParams, + ConfigurationAssignmentsForResourceGroupDeleteResponse +} from "../models"; + +/** Interface representing a ConfigurationAssignmentsForResourceGroup. */ +export interface ConfigurationAssignmentsForResourceGroup { + /** + * Get configuration assignment for resource.. + * @param resourceGroupName Resource group name + * @param configurationAssignmentName Configuration assignment name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsForResourceGroupGetOptionalParams + ): Promise; + /** + * Register configuration for resource. + * @param resourceGroupName Resource group name + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsForResourceGroupCreateOrUpdateOptionalParams + ): Promise; + /** + * Register configuration for resource. + * @param resourceGroupName Resource group name + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + update( + resourceGroupName: string, + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsForResourceGroupUpdateOptionalParams + ): Promise; + /** + * Unregister configuration for resource. + * @param resourceGroupName Resource group name + * @param configurationAssignmentName Unique configuration assignment name + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + configurationAssignmentName: string, + options?: ConfigurationAssignmentsForResourceGroupDeleteOptionalParams + ): Promise; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsForSubscriptions.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsForSubscriptions.ts new file mode 100644 index 000000000000..0505c9100a97 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsForSubscriptions.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + ConfigurationAssignmentsForSubscriptionsGetOptionalParams, + ConfigurationAssignmentsForSubscriptionsGetResponse, + ConfigurationAssignment, + ConfigurationAssignmentsForSubscriptionsCreateOrUpdateOptionalParams, + ConfigurationAssignmentsForSubscriptionsCreateOrUpdateResponse, + ConfigurationAssignmentsForSubscriptionsUpdateOptionalParams, + ConfigurationAssignmentsForSubscriptionsUpdateResponse, + ConfigurationAssignmentsForSubscriptionsDeleteOptionalParams, + ConfigurationAssignmentsForSubscriptionsDeleteResponse +} from "../models"; + +/** Interface representing a ConfigurationAssignmentsForSubscriptions. */ +export interface ConfigurationAssignmentsForSubscriptions { + /** + * Get configuration assignment for resource.. + * @param configurationAssignmentName Configuration assignment name + * @param options The options parameters. + */ + get( + configurationAssignmentName: string, + options?: ConfigurationAssignmentsForSubscriptionsGetOptionalParams + ): Promise; + /** + * Register configuration for resource. + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + createOrUpdate( + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsForSubscriptionsCreateOrUpdateOptionalParams + ): Promise; + /** + * Register configuration for resource. + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param options The options parameters. + */ + update( + configurationAssignmentName: string, + configurationAssignment: ConfigurationAssignment, + options?: ConfigurationAssignmentsForSubscriptionsUpdateOptionalParams + ): Promise; + /** + * Unregister configuration for resource. + * @param configurationAssignmentName Unique configuration assignment name + * @param options The options parameters. + */ + delete( + configurationAssignmentName: string, + options?: ConfigurationAssignmentsForSubscriptionsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsWithinSubscription.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsWithinSubscription.ts new file mode 100644 index 000000000000..39ef8bca8f06 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/configurationAssignmentsWithinSubscription.ts @@ -0,0 +1,25 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + ConfigurationAssignment, + ConfigurationAssignmentsWithinSubscriptionListOptionalParams +} from "../models"; + +/// +/** Interface representing a ConfigurationAssignmentsWithinSubscription. */ +export interface ConfigurationAssignmentsWithinSubscription { + /** + * Get configuration assignment within a subscription + * @param options The options parameters. + */ + list( + options?: ConfigurationAssignmentsWithinSubscriptionListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/index.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..f483a9d87ceb --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/index.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./publicMaintenanceConfigurations"; +export * from "./applyUpdates"; +export * from "./configurationAssignments"; +export * from "./maintenanceConfigurations"; +export * from "./maintenanceConfigurationsForResourceGroup"; +export * from "./applyUpdateForResourceGroup"; +export * from "./configurationAssignmentsWithinSubscription"; +export * from "./configurationAssignmentsForSubscriptions"; +export * from "./configurationAssignmentsForResourceGroup"; +export * from "./operations"; +export * from "./updates"; diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/maintenanceConfigurations.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/maintenanceConfigurations.ts new file mode 100644 index 000000000000..6256e12a8c51 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/maintenanceConfigurations.ts @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + MaintenanceConfiguration, + MaintenanceConfigurationsListOptionalParams, + MaintenanceConfigurationsGetOptionalParams, + MaintenanceConfigurationsGetResponse, + MaintenanceConfigurationsCreateOrUpdateOptionalParams, + MaintenanceConfigurationsCreateOrUpdateResponse, + MaintenanceConfigurationsDeleteOptionalParams, + MaintenanceConfigurationsDeleteResponse, + MaintenanceConfigurationsUpdateOptionalParams, + MaintenanceConfigurationsUpdateResponse +} from "../models"; + +/// +/** Interface representing a MaintenanceConfigurations. */ +export interface MaintenanceConfigurations { + /** + * Get Configuration records within a subscription + * @param options The options parameters. + */ + list( + options?: MaintenanceConfigurationsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get Configuration record + * @param resourceGroupName Resource Group Name + * @param resourceName Maintenance Configuration Name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: MaintenanceConfigurationsGetOptionalParams + ): Promise; + /** + * Create or Update configuration record + * @param resourceGroupName Resource Group Name + * @param resourceName Maintenance Configuration Name + * @param configuration The configuration + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + resourceName: string, + configuration: MaintenanceConfiguration, + options?: MaintenanceConfigurationsCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete Configuration record + * @param resourceGroupName Resource Group Name + * @param resourceName Maintenance Configuration Name + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + resourceName: string, + options?: MaintenanceConfigurationsDeleteOptionalParams + ): Promise; + /** + * Patch configuration record + * @param resourceGroupName Resource Group Name + * @param resourceName Maintenance Configuration Name + * @param configuration The configuration + * @param options The options parameters. + */ + update( + resourceGroupName: string, + resourceName: string, + configuration: MaintenanceConfiguration, + options?: MaintenanceConfigurationsUpdateOptionalParams + ): Promise; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/maintenanceConfigurationsForResourceGroup.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/maintenanceConfigurationsForResourceGroup.ts new file mode 100644 index 000000000000..f53ef587a045 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/maintenanceConfigurationsForResourceGroup.ts @@ -0,0 +1,27 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + MaintenanceConfiguration, + MaintenanceConfigurationsForResourceGroupListOptionalParams +} from "../models"; + +/// +/** Interface representing a MaintenanceConfigurationsForResourceGroup. */ +export interface MaintenanceConfigurationsForResourceGroup { + /** + * Get Configuration records within a subscription and resource group + * @param resourceGroupName Resource Group Name + * @param options The options parameters. + */ + list( + resourceGroupName: string, + options?: MaintenanceConfigurationsForResourceGroupListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/operations.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..35c9849e3b60 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List the available operations supported by the Microsoft.Maintenance resource provider + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/publicMaintenanceConfigurations.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/publicMaintenanceConfigurations.ts new file mode 100644 index 000000000000..d3cf938cd392 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/publicMaintenanceConfigurations.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + MaintenanceConfiguration, + PublicMaintenanceConfigurationsListOptionalParams, + PublicMaintenanceConfigurationsGetOptionalParams, + PublicMaintenanceConfigurationsGetResponse +} from "../models"; + +/// +/** Interface representing a PublicMaintenanceConfigurations. */ +export interface PublicMaintenanceConfigurations { + /** + * Get Public Maintenance Configuration records + * @param options The options parameters. + */ + list( + options?: PublicMaintenanceConfigurationsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get Public Maintenance Configuration record + * @param resourceName Maintenance Configuration Name + * @param options The options parameters. + */ + get( + resourceName: string, + options?: PublicMaintenanceConfigurationsGetOptionalParams + ): Promise; +} diff --git a/sdk/maintenance/arm-maintenance/src/operationsInterfaces/updates.ts b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/updates.ts new file mode 100644 index 000000000000..5459a4aa9a18 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/operationsInterfaces/updates.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + Update, + UpdatesListParentOptionalParams, + UpdatesListOptionalParams +} from "../models"; + +/// +/** Interface representing a Updates. */ +export interface Updates { + /** + * Get updates to resources. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + listParent( + resourceGroupName: string, + providerName: string, + resourceParentType: string, + resourceParentName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListParentOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get updates to resources. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param options The options parameters. + */ + list( + resourceGroupName: string, + providerName: string, + resourceType: string, + resourceName: string, + options?: UpdatesListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/maintenance/arm-maintenance/src/pagingHelper.ts b/sdk/maintenance/arm-maintenance/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/maintenance/arm-maintenance/test/maintenance_operations_test.spec.ts b/sdk/maintenance/arm-maintenance/test/maintenance_operations_test.spec.ts new file mode 100644 index 000000000000..e1cd87ab3ef1 --- /dev/null +++ b/sdk/maintenance/arm-maintenance/test/maintenance_operations_test.spec.ts @@ -0,0 +1,102 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + Recorder, + RecorderStartOptions, + delay, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { MaintenanceManagementClient } from "../src/maintenanceManagementClient"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("MaintenanceManagement test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: MaintenanceManagementClient; + let location: string; + let resourceGroup: string; + let resourcename: string; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + subscriptionId = env.SUBSCRIPTION_ID || ''; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new MaintenanceManagementClient(credential, subscriptionId, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + resourcename = "resourcetest"; + + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("maintenanceConfigurations create test", async function () { + const res = await client.maintenanceConfigurations.createOrUpdate( + resourceGroup, + resourcename, + { + duration: "05:00", + expirationDateTime: "2023-12-31 00:00", + location: "westus2", + maintenanceScope: "OSImage", + namespace: "Microsoft.Maintenance", + recurEvery: "Day", + startDateTime: "2023-08-02 08:00", + timeZone: "Pacific Standard Time", + visibility: "Custom" + }); + assert.equal(res.name, resourcename); + }); + + it("maintenanceConfigurations get test", async function () { + const res = await client.maintenanceConfigurations.get(resourceGroup, + resourcename); + assert.equal(res.name, resourcename); + }); + + it("maintenanceConfigurations list test", async function () { + const resArray = new Array(); + for await (let item of client.maintenanceConfigurations.list()) { + resArray.push(item); + } + assert.equal(resArray.length, 1); + }); + + it("maintenanceConfigurations delete test", async function () { + const resArray = new Array(); + const res = await client.maintenanceConfigurations.delete(resourceGroup, resourcename + ) + for await (let item of client.maintenanceConfigurations.list()) { + resArray.push(item); + } + assert.equal(resArray.length, 0); + }); +}) diff --git a/sdk/maintenance/arm-maintenance/tsconfig.json b/sdk/maintenance/arm-maintenance/tsconfig.json new file mode 100644 index 000000000000..763fe2e9476d --- /dev/null +++ b/sdk/maintenance/arm-maintenance/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { + "@azure/arm-maintenance": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/maintenance/ci.mgmt.yml b/sdk/maintenance/ci.mgmt.yml new file mode 100644 index 000000000000..b1c561c23f65 --- /dev/null +++ b/sdk/maintenance/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/maintenance/arm-maintenance + - sdk/maintenance/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/maintenance/arm-maintenance + - sdk/maintenance/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: maintenance + Artifacts: + - name: azure-arm-maintenance + safeName: azurearmmaintenance + \ No newline at end of file