From 63cf49eca776cf1bd8543625a1aac053458a36ef Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 21 Dec 2022 10:58:15 +0800 Subject: [PATCH] recording refresh 21 (#24246) * recording refresh 21 * update files * Update pnpm-lock.yaml * update files * update files * update files * update files --- common/config/rush/pnpm-lock.yaml | 54 +- .../CHANGELOG.md | 112 + .../_meta.json | 6 +- .../package.json | 33 +- .../node/my_test/recording_sample_test.json | 4 + ...ppservice-profile-2020-09-01-hybrid.api.md | 1189 ++++----- .../sample.env | 4 + .../appServicePlansCreateOrUpdateSample.ts | 56 + .../appServicePlansDeleteSample.ts | 40 + .../samples-dev/appServicePlansGetSample.ts | 40 + ...ppServicePlansListByResourceGroupSample.ts | 44 + .../samples-dev/appServicePlansListSample.ts | 40 + .../appServicePlansUpdateSample.ts | 54 + .../certificatesCreateOrUpdateSample.ts | 62 + .../samples-dev/certificatesDeleteSample.ts | 40 + .../samples-dev/certificatesGetSample.ts | 40 + .../certificatesListByResourceGroupSample.ts | 44 + .../samples-dev/certificatesListSample.ts | 40 + .../samples-dev/certificatesUpdateSample.ts | 54 + .../providerListOperationsSample.ts | 40 + .../verifyHostingEnvironmentVnetSample.ts | 45 + .../webAppsGetNetworkTraceOperationSample.ts | 45 + ...bAppsGetNetworkTraceOperationSlotSample.ts | 47 + ...ppsGetNetworkTraceOperationSlotV2Sample.ts | 47 + ...webAppsGetNetworkTraceOperationV2Sample.ts | 45 + .../webAppsGetNetworkTracesSample.ts | 45 + .../webAppsGetNetworkTracesSlotSample.ts | 47 + .../webAppsGetNetworkTracesSlotV2Sample.ts | 47 + .../webAppsGetNetworkTracesV2Sample.ts | 45 + .../webAppsStartNetworkTraceSample.ts | 49 + .../webAppsStartNetworkTraceSlotSample.ts | 53 + ...StartWebSiteNetworkTraceOperationSample.ts | 51 + ...tWebSiteNetworkTraceOperationSlotSample.ts | 53 + .../webAppsStopNetworkTraceSample.ts | 40 + .../webAppsStopNetworkTraceSlotSample.ts | 45 + .../webAppsStopWebSiteNetworkTraceSample.ts | 43 + ...ebAppsStopWebSiteNetworkTraceSlotSample.ts | 45 + .../samples/v2/javascript/README.md | 108 + .../appServicePlansCreateOrUpdateSample.js | 48 + .../javascript/appServicePlansDeleteSample.js | 36 + .../v2/javascript/appServicePlansGetSample.js | 36 + ...ppServicePlansListByResourceGroupSample.js | 38 + .../javascript/appServicePlansListSample.js | 37 + .../javascript/appServicePlansUpdateSample.js | 42 + .../certificatesCreateOrUpdateSample.js | 54 + .../v2/javascript/certificatesDeleteSample.js | 36 + .../v2/javascript/certificatesGetSample.js | 36 + .../certificatesListByResourceGroupSample.js | 38 + .../v2/javascript/certificatesListSample.js | 37 + .../v2/javascript/certificatesUpdateSample.js | 42 + .../samples/v2/javascript/package.json | 32 + .../providerListOperationsSample.js | 37 + .../samples/v2/javascript/sample.env | 4 + .../verifyHostingEnvironmentVnetSample.js | 39 + .../webAppsGetNetworkTraceOperationSample.js | 41 + ...bAppsGetNetworkTraceOperationSlotSample.js | 43 + ...ppsGetNetworkTraceOperationSlotV2Sample.js | 43 + ...webAppsGetNetworkTraceOperationV2Sample.js | 41 + .../webAppsGetNetworkTracesSample.js | 37 + .../webAppsGetNetworkTracesSlotSample.js | 43 + .../webAppsGetNetworkTracesSlotV2Sample.js | 43 + .../webAppsGetNetworkTracesV2Sample.js | 37 + .../webAppsStartNetworkTraceSample.js | 42 + .../webAppsStartNetworkTraceSlotSample.js | 46 + ...StartWebSiteNetworkTraceOperationSample.js | 44 + ...tWebSiteNetworkTraceOperationSlotSample.js | 46 + .../webAppsStopNetworkTraceSample.js | 36 + .../webAppsStopNetworkTraceSlotSample.js | 37 + .../webAppsStopWebSiteNetworkTraceSample.js | 36 + ...ebAppsStopWebSiteNetworkTraceSlotSample.js | 37 + .../samples/v2/typescript/README.md | 121 + .../samples/v2/typescript/package.json | 41 + .../samples/v2/typescript/sample.env | 4 + .../appServicePlansCreateOrUpdateSample.ts | 56 + .../src/appServicePlansDeleteSample.ts | 40 + .../src/appServicePlansGetSample.ts | 40 + ...ppServicePlansListByResourceGroupSample.ts | 44 + .../src/appServicePlansListSample.ts | 40 + .../src/appServicePlansUpdateSample.ts | 54 + .../src/certificatesCreateOrUpdateSample.ts | 62 + .../src/certificatesDeleteSample.ts | 40 + .../typescript/src/certificatesGetSample.ts | 40 + .../certificatesListByResourceGroupSample.ts | 44 + .../typescript/src/certificatesListSample.ts | 40 + .../src/certificatesUpdateSample.ts | 54 + .../src/providerListOperationsSample.ts | 40 + .../src/verifyHostingEnvironmentVnetSample.ts | 45 + .../webAppsGetNetworkTraceOperationSample.ts | 45 + ...bAppsGetNetworkTraceOperationSlotSample.ts | 47 + ...ppsGetNetworkTraceOperationSlotV2Sample.ts | 47 + ...webAppsGetNetworkTraceOperationV2Sample.ts | 45 + .../src/webAppsGetNetworkTracesSample.ts | 45 + .../src/webAppsGetNetworkTracesSlotSample.ts | 47 + .../webAppsGetNetworkTracesSlotV2Sample.ts | 47 + .../src/webAppsGetNetworkTracesV2Sample.ts | 45 + .../src/webAppsStartNetworkTraceSample.ts | 49 + .../src/webAppsStartNetworkTraceSlotSample.ts | 53 + ...StartWebSiteNetworkTraceOperationSample.ts | 51 + ...tWebSiteNetworkTraceOperationSlotSample.ts | 53 + .../src/webAppsStopNetworkTraceSample.ts | 40 + .../src/webAppsStopNetworkTraceSlotSample.ts | 45 + .../webAppsStopWebSiteNetworkTraceSample.ts | 43 + ...ebAppsStopWebSiteNetworkTraceSlotSample.ts | 45 + .../samples/v2/typescript/tsconfig.json | 17 + .../src/index.ts | 1 + .../src/models/index.ts | 480 ++-- .../src/models/mappers.ts | 2 +- .../src/operations/appServicePlans.ts | 298 ++- .../src/operations/certificates.ts | 63 +- .../src/operations/provider.ts | 88 +- .../src/operations/recommendations.ts | 204 +- .../src/operations/webApps.ts | 2329 +++++++++++------ .../src/pagingHelper.ts | 39 + .../src/webSiteManagementClient.ts | 240 +- .../test/sampleTest.ts | 39 +- .../tsconfig.json | 10 +- .../CHANGELOG.md | 22 +- .../_meta.json | 6 +- .../package.json | 35 +- .../node/my_test/recording_sample_test.js | 5 - .../node/my_test/recording_sample_test.json | 4 + ...orization-profile-2020-09-01-hybrid.api.md | 9 +- .../sample.env | 4 + .../globalAdministratorElevateAccessSample.ts | 37 + .../permissionsListForResourceGroupSample.ts | 43 + .../permissionsListForResourceSample.ts | 51 + .../providerOperationsMetadataGetSample.ts | 40 + .../providerOperationsMetadataListSample.ts | 40 + .../roleAssignmentsCreateByIdSample.ts | 51 + .../roleAssignmentsCreateSample.ts | 53 + .../roleAssignmentsDeleteByIdSample.ts | 38 + .../roleAssignmentsDeleteSample.ts | 39 + .../roleAssignmentsGetByIdSample.ts | 38 + .../samples-dev/roleAssignmentsGetSample.ts | 39 + ...leAssignmentsListForResourceGroupSample.ts | 43 + .../roleAssignmentsListForResourceSample.ts | 51 + .../roleAssignmentsListForScopeSample.ts | 41 + .../samples-dev/roleAssignmentsListSample.ts | 39 + .../roleDefinitionsCreateOrUpdateSample.ts | 47 + .../roleDefinitionsDeleteSample.ts | 39 + .../roleDefinitionsGetByIdSample.ts | 38 + .../samples-dev/roleDefinitionsGetSample.ts | 39 + .../samples-dev/roleDefinitionsListSample.ts | 41 + .../samples/v3/javascript/README.md | 88 + .../globalAdministratorElevateAccessSample.js | 36 + .../samples/v3/javascript/package.json | 32 + .../permissionsListForResourceGroupSample.js | 39 + .../permissionsListForResourceSample.js | 49 + .../providerOperationsMetadataGetSample.js | 37 + .../providerOperationsMetadataListSample.js | 39 + .../roleAssignmentsCreateByIdSample.js | 44 + .../javascript/roleAssignmentsCreateSample.js | 45 + .../roleAssignmentsDeleteByIdSample.js | 37 + .../javascript/roleAssignmentsDeleteSample.js | 38 + .../roleAssignmentsGetByIdSample.js | 37 + .../v3/javascript/roleAssignmentsGetSample.js | 38 + ...leAssignmentsListForResourceGroupSample.js | 39 + .../roleAssignmentsListForResourceSample.js | 49 + .../roleAssignmentsListForScopeSample.js | 40 + .../javascript/roleAssignmentsListSample.js | 38 + .../roleDefinitionsCreateOrUpdateSample.js | 43 + .../javascript/roleDefinitionsDeleteSample.js | 38 + .../roleDefinitionsGetByIdSample.js | 37 + .../v3/javascript/roleDefinitionsGetSample.js | 38 + .../javascript/roleDefinitionsListSample.js | 40 + .../samples/v3/javascript/sample.env | 4 + .../samples/v3/typescript/README.md | 101 + .../samples/v3/typescript/package.json | 41 + .../samples/v3/typescript/sample.env | 4 + .../globalAdministratorElevateAccessSample.ts | 37 + .../permissionsListForResourceGroupSample.ts | 43 + .../src/permissionsListForResourceSample.ts | 51 + .../providerOperationsMetadataGetSample.ts | 40 + .../providerOperationsMetadataListSample.ts | 40 + .../src/roleAssignmentsCreateByIdSample.ts | 51 + .../src/roleAssignmentsCreateSample.ts | 53 + .../src/roleAssignmentsDeleteByIdSample.ts | 38 + .../src/roleAssignmentsDeleteSample.ts | 39 + .../src/roleAssignmentsGetByIdSample.ts | 38 + .../src/roleAssignmentsGetSample.ts | 39 + ...leAssignmentsListForResourceGroupSample.ts | 43 + .../roleAssignmentsListForResourceSample.ts | 51 + .../src/roleAssignmentsListForScopeSample.ts | 41 + .../src/roleAssignmentsListSample.ts | 39 + .../roleDefinitionsCreateOrUpdateSample.ts | 47 + .../src/roleDefinitionsDeleteSample.ts | 39 + .../src/roleDefinitionsGetByIdSample.ts | 38 + .../src/roleDefinitionsGetSample.ts | 39 + .../src/roleDefinitionsListSample.ts | 41 + .../samples/v3/typescript/tsconfig.json | 17 + .../src/authorizationManagementClient.ts | 75 +- .../src/index.ts | 1 + .../src/models/index.ts | 30 +- .../src/operations/permissions.ts | 78 +- .../providerOperationsMetadataOperations.ts | 32 +- .../src/operations/roleAssignments.ts | 138 +- .../src/operations/roleDefinitions.ts | 32 +- .../src/pagingHelper.ts | 39 + .../test/sampleTest.ts | 39 +- .../tsconfig.json | 10 +- .../CHANGELOG.md | 12 + .../_meta.json | 6 +- .../package.json | 35 +- .../node/my_test/recording_sample_test.json | 4 + ...-commerce-profile-2020-09-01-hybrid.api.md | 22 +- .../sample.env | 4 + .../samples-dev/rateCardGetSample.ts | 39 + .../samples/v2/javascript/README.md | 50 + .../samples/v2/javascript/package.json | 32 + .../v2/javascript/rateCardGetSample.js | 36 + .../samples/v2/javascript/sample.env | 4 + .../samples/v2/typescript/README.md | 63 + .../samples/v2/typescript/package.json | 41 + .../samples/v2/typescript/sample.env | 4 + .../v2/typescript/src/rateCardGetSample.ts | 39 + .../samples/v2/typescript/tsconfig.json | 17 + .../src/index.ts | 1 + .../src/models/index.ts | 22 +- .../src/operations/usageAggregates.ts | 57 +- .../src/pagingHelper.ts | 39 + .../src/usageManagementClient.ts | 75 +- .../test/sampleTest.ts | 39 +- .../tsconfig.json | 10 +- .../CHANGELOG.md | 69 +- .../_meta.json | 6 +- .../package.json | 35 +- .../node/my_test/recording_sample_test.json | 4 + ...m-compute-profile-2020-09-01-hybrid.api.md | 821 +++--- .../sample.env | 4 + .../availabilitySetsCreateOrUpdateSample.ts | 51 + ...vailabilitySetsListBySubscriptionSample.ts | 44 + ...dedicatedHostGroupsCreateOrUpdateSample.ts | 53 + .../dedicatedHostGroupsGetSample.ts | 42 + .../dedicatedHostsCreateOrUpdateSample.ts | 54 + .../samples-dev/dedicatedHostsGetSample.ts | 44 + .../diskEncryptionSetsCreateOrUpdateSample.ts | 57 + .../diskEncryptionSetsDeleteSample.ts | 42 + .../diskEncryptionSetsGetSample.ts | 42 + ...EncryptionSetsListByResourceGroupSample.ts | 43 + .../diskEncryptionSetsListSample.ts | 39 + .../diskEncryptionSetsUpdateSample.ts | 56 + .../samples-dev/disksCreateOrUpdateSample.ts | 238 ++ .../samples-dev/disksGetSample.ts | 39 + .../disksListByResourceGroupSample.ts | 41 + .../samples-dev/disksListSample.ts | 39 + .../samples-dev/imagesCreateOrUpdateSample.ts | 414 +++ .../samples-dev/imagesGetSample.ts | 39 + .../imagesListByResourceGroupSample.ts | 41 + .../samples-dev/imagesListSample.ts | 39 + .../samples-dev/imagesUpdateSample.ts | 54 + ...lyticsExportRequestRateByIntervalSample.ts | 50 + ...gAnalyticsExportThrottledRequestsSample.ts | 52 + ...mityPlacementGroupsCreateOrUpdateSample.ts | 50 + .../proximityPlacementGroupsDeleteSample.ts | 42 + .../proximityPlacementGroupsGetSample.ts | 42 + ...lacementGroupsListByResourceGroupSample.ts | 43 + ...PlacementGroupsListBySubscriptionSample.ts | 39 + .../proximityPlacementGroupsUpdateSample.ts | 49 + .../snapshotsCreateOrUpdateSample.ts | 118 + .../samples-dev/snapshotsGetSample.ts | 39 + .../snapshotsListByResourceGroupSample.ts | 43 + .../samples-dev/snapshotsListSample.ts | 39 + .../samples-dev/sshPublicKeysCreateSample.ts | 50 + .../sshPublicKeysGenerateKeyPairSample.ts | 42 + .../samples-dev/sshPublicKeysGetSample.ts | 42 + ...lingUpgradesStartExtensionUpgradeSample.ts | 42 + ...caleSetVMExtensionsCreateOrUpdateSample.ts | 57 + ...MachineScaleSetVMExtensionsDeleteSample.ts | 46 + ...ualMachineScaleSetVMExtensionsGetSample.ts | 46 + ...alMachineScaleSetVMExtensionsListSample.ts | 44 + ...MachineScaleSetVMExtensionsUpdateSample.ts | 57 + ...MachineScaleSetVMSGetInstanceViewSample.ts | 44 + ...SetVMSRetrieveBootDiagnosticsDataSample.ts | 52 + ...achineScaleSetVMSSimulateEvictionSample.ts | 44 + ...ualMachineScaleSetsCreateOrUpdateSample.ts | 1567 +++++++++++ .../virtualMachineScaleSetsGetSample.ts | 42 + .../virtualMachinesAssessPatchesSample.ts | 42 + .../virtualMachinesCreateOrUpdateSample.ts | 1259 +++++++++ .../virtualMachinesDeleteSample.ts | 48 + .../virtualMachinesGeneralizeSample.ts | 42 + .../samples-dev/virtualMachinesGetSample.ts | 58 + .../virtualMachinesInstanceViewSample.ts | 64 + ...virtualMachinesListAvailableSizesSample.ts | 45 + .../virtualMachinesListByLocationSample.ts | 40 + .../virtualMachinesReapplySample.ts | 42 + .../virtualMachinesReimageSample.ts | 49 + ...chinesRetrieveBootDiagnosticsDataSample.ts | 50 + .../virtualMachinesSimulateEvictionSample.ts | 42 + .../virtualMachinesUpdateSample.ts | 81 + .../samples/v2/javascript/README.md | 168 ++ .../availabilitySetsCreateOrUpdateSample.js | 44 + ...vailabilitySetsListBySubscriptionSample.js | 38 + ...dedicatedHostGroupsCreateOrUpdateSample.js | 46 + .../dedicatedHostGroupsGetSample.js | 35 + .../dedicatedHostsCreateOrUpdateSample.js | 47 + .../v2/javascript/dedicatedHostsGetSample.js | 36 + .../diskEncryptionSetsCreateOrUpdateSample.js | 49 + .../diskEncryptionSetsDeleteSample.js | 38 + .../javascript/diskEncryptionSetsGetSample.js | 35 + ...EncryptionSetsListByResourceGroupSample.js | 37 + .../diskEncryptionSetsListSample.js | 36 + .../diskEncryptionSetsUpdateSample.js | 48 + .../javascript/disksCreateOrUpdateSample.js | 188 ++ .../samples/v2/javascript/disksGetSample.js | 35 + .../disksListByResourceGroupSample.js | 37 + .../samples/v2/javascript/disksListSample.js | 36 + .../javascript/imagesCreateOrUpdateSample.js | 373 +++ .../samples/v2/javascript/imagesGetSample.js | 35 + .../imagesListByResourceGroupSample.js | 37 + .../samples/v2/javascript/imagesListSample.js | 36 + .../v2/javascript/imagesUpdateSample.js | 42 + ...lyticsExportRequestRateByIntervalSample.js | 44 + ...gAnalyticsExportThrottledRequestsSample.js | 46 + .../samples/v2/javascript/package.json | 32 + ...mityPlacementGroupsCreateOrUpdateSample.js | 43 + .../proximityPlacementGroupsDeleteSample.js | 38 + .../proximityPlacementGroupsGetSample.js | 38 + ...lacementGroupsListByResourceGroupSample.js | 37 + ...PlacementGroupsListBySubscriptionSample.js | 36 + .../proximityPlacementGroupsUpdateSample.js | 42 + .../samples/v2/javascript/sample.env | 4 + .../snapshotsCreateOrUpdateSample.js | 105 + .../v2/javascript/snapshotsGetSample.js | 35 + .../snapshotsListByResourceGroupSample.js | 37 + .../v2/javascript/snapshotsListSample.js | 36 + .../javascript/sshPublicKeysCreateSample.js | 39 + .../sshPublicKeysGenerateKeyPairSample.js | 35 + .../v2/javascript/sshPublicKeysGetSample.js | 35 + ...lingUpgradesStartExtensionUpgradeSample.js | 39 + ...caleSetVMExtensionsCreateOrUpdateSample.js | 50 + ...MachineScaleSetVMExtensionsDeleteSample.js | 42 + ...ualMachineScaleSetVMExtensionsGetSample.js | 42 + ...alMachineScaleSetVMExtensionsListSample.js | 40 + ...MachineScaleSetVMExtensionsUpdateSample.js | 50 + ...MachineScaleSetVMSGetInstanceViewSample.js | 40 + ...SetVMSRetrieveBootDiagnosticsDataSample.js | 45 + ...achineScaleSetVMSSimulateEvictionSample.js | 40 + ...ualMachineScaleSetsCreateOrUpdateSample.js | 1487 +++++++++++ .../virtualMachineScaleSetsGetSample.js | 35 + .../virtualMachinesAssessPatchesSample.js | 35 + .../virtualMachinesCreateOrUpdateSample.js | 1180 +++++++++ .../javascript/virtualMachinesDeleteSample.js | 41 + .../virtualMachinesGeneralizeSample.js | 35 + .../v2/javascript/virtualMachinesGetSample.js | 52 + .../virtualMachinesInstanceViewSample.js | 52 + ...virtualMachinesListAvailableSizesSample.js | 38 + .../virtualMachinesListByLocationSample.js | 37 + .../virtualMachinesReapplySample.js | 35 + .../virtualMachinesReimageSample.js | 41 + ...chinesRetrieveBootDiagnosticsDataSample.js | 43 + .../virtualMachinesSimulateEvictionSample.js | 35 + .../javascript/virtualMachinesUpdateSample.js | 73 + .../samples/v2/typescript/README.md | 181 ++ .../samples/v2/typescript/package.json | 41 + .../samples/v2/typescript/sample.env | 4 + .../availabilitySetsCreateOrUpdateSample.ts | 51 + ...vailabilitySetsListBySubscriptionSample.ts | 44 + ...dedicatedHostGroupsCreateOrUpdateSample.ts | 53 + .../src/dedicatedHostGroupsGetSample.ts | 42 + .../src/dedicatedHostsCreateOrUpdateSample.ts | 54 + .../typescript/src/dedicatedHostsGetSample.ts | 44 + .../diskEncryptionSetsCreateOrUpdateSample.ts | 57 + .../src/diskEncryptionSetsDeleteSample.ts | 42 + .../src/diskEncryptionSetsGetSample.ts | 42 + ...EncryptionSetsListByResourceGroupSample.ts | 43 + .../src/diskEncryptionSetsListSample.ts | 39 + .../src/diskEncryptionSetsUpdateSample.ts | 56 + .../src/disksCreateOrUpdateSample.ts | 238 ++ .../v2/typescript/src/disksGetSample.ts | 39 + .../src/disksListByResourceGroupSample.ts | 41 + .../v2/typescript/src/disksListSample.ts | 39 + .../src/imagesCreateOrUpdateSample.ts | 414 +++ .../v2/typescript/src/imagesGetSample.ts | 39 + .../src/imagesListByResourceGroupSample.ts | 41 + .../v2/typescript/src/imagesListSample.ts | 39 + .../v2/typescript/src/imagesUpdateSample.ts | 54 + ...lyticsExportRequestRateByIntervalSample.ts | 50 + ...gAnalyticsExportThrottledRequestsSample.ts | 52 + ...mityPlacementGroupsCreateOrUpdateSample.ts | 50 + .../proximityPlacementGroupsDeleteSample.ts | 42 + .../src/proximityPlacementGroupsGetSample.ts | 42 + ...lacementGroupsListByResourceGroupSample.ts | 43 + ...PlacementGroupsListBySubscriptionSample.ts | 39 + .../proximityPlacementGroupsUpdateSample.ts | 49 + .../src/snapshotsCreateOrUpdateSample.ts | 118 + .../v2/typescript/src/snapshotsGetSample.ts | 39 + .../src/snapshotsListByResourceGroupSample.ts | 43 + .../v2/typescript/src/snapshotsListSample.ts | 39 + .../src/sshPublicKeysCreateSample.ts | 50 + .../src/sshPublicKeysGenerateKeyPairSample.ts | 42 + .../typescript/src/sshPublicKeysGetSample.ts | 42 + ...lingUpgradesStartExtensionUpgradeSample.ts | 42 + ...caleSetVMExtensionsCreateOrUpdateSample.ts | 57 + ...MachineScaleSetVMExtensionsDeleteSample.ts | 46 + ...ualMachineScaleSetVMExtensionsGetSample.ts | 46 + ...alMachineScaleSetVMExtensionsListSample.ts | 44 + ...MachineScaleSetVMExtensionsUpdateSample.ts | 57 + ...MachineScaleSetVMSGetInstanceViewSample.ts | 44 + ...SetVMSRetrieveBootDiagnosticsDataSample.ts | 52 + ...achineScaleSetVMSSimulateEvictionSample.ts | 44 + ...ualMachineScaleSetsCreateOrUpdateSample.ts | 1567 +++++++++++ .../src/virtualMachineScaleSetsGetSample.ts | 42 + .../src/virtualMachinesAssessPatchesSample.ts | 42 + .../virtualMachinesCreateOrUpdateSample.ts | 1259 +++++++++ .../src/virtualMachinesDeleteSample.ts | 48 + .../src/virtualMachinesGeneralizeSample.ts | 42 + .../src/virtualMachinesGetSample.ts | 58 + .../src/virtualMachinesInstanceViewSample.ts | 64 + ...virtualMachinesListAvailableSizesSample.ts | 45 + .../virtualMachinesListByLocationSample.ts | 40 + .../src/virtualMachinesReapplySample.ts | 42 + .../src/virtualMachinesReimageSample.ts | 49 + ...chinesRetrieveBootDiagnosticsDataSample.ts | 50 + .../virtualMachinesSimulateEvictionSample.ts | 42 + .../src/virtualMachinesUpdateSample.ts | 81 + .../samples/v2/typescript/tsconfig.json | 17 + .../src/computeManagementClient.ts | 41 +- .../src/index.ts | 1 + .../src/models/index.ts | 437 +++- .../src/operations/availabilitySets.ts | 77 +- .../src/operations/dedicatedHostGroups.ts | 65 +- .../src/operations/dedicatedHosts.ts | 53 +- .../src/operations/diskEncryptionSets.ts | 77 +- .../src/operations/disks.ts | 85 +- .../src/operations/images.ts | 77 +- .../src/operations/logAnalytics.ts | 8 +- .../src/operations/operations.ts | 15 +- .../operations/proximityPlacementGroups.ts | 65 +- .../src/operations/snapshots.ts | 85 +- .../src/operations/sshPublicKeys.ts | 63 +- .../src/operations/usageOperations.ts | 30 +- .../virtualMachineExtensionImages.ts | 6 +- .../operations/virtualMachineExtensions.ts | 12 +- .../virtualMachineScaleSetExtensions.ts | 49 +- .../virtualMachineScaleSetRollingUpgrades.ts | 12 +- .../virtualMachineScaleSetVMExtensions.ts | 12 +- .../operations/virtualMachineScaleSetVMs.ts | 86 +- .../src/operations/virtualMachineScaleSets.ts | 189 +- .../src/operations/virtualMachineSizes.ts | 15 +- .../src/operations/virtualMachines.ts | 166 +- .../virtualMachineExtensionImages.ts | 4 +- .../src/pagingHelper.ts | 39 + .../test/sampleTest.ts | 39 +- .../tsconfig.json | 10 +- 444 files changed, 31214 insertions(+), 3353 deletions(-) create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/sample.env create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansCreateOrUpdateSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansDeleteSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansGetSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansListByResourceGroupSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansListSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansUpdateSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesCreateOrUpdateSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesDeleteSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesGetSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesListByResourceGroupSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesListSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesUpdateSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/providerListOperationsSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/verifyHostingEnvironmentVnetSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSlotV2Sample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationV2Sample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSlotV2Sample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesV2Sample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartNetworkTraceSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartNetworkTraceSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartWebSiteNetworkTraceOperationSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartWebSiteNetworkTraceOperationSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopNetworkTraceSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopNetworkTraceSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopWebSiteNetworkTraceSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopWebSiteNetworkTraceSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/README.md create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansCreateOrUpdateSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansDeleteSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansGetSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListByResourceGroupSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansUpdateSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesCreateOrUpdateSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesDeleteSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesGetSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListByResourceGroupSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesUpdateSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/package.json create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/providerListOperationsSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/verifyHostingEnvironmentVnetSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotV2Sample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationV2Sample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotV2Sample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesV2Sample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSlotSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSlotSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSlotSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSlotSample.js create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/README.md create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/package.json create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansCreateOrUpdateSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansDeleteSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansGetSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListByResourceGroupSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansUpdateSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesCreateOrUpdateSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesDeleteSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesGetSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListByResourceGroupSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesUpdateSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/providerListOperationsSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/verifyHostingEnvironmentVnetSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotV2Sample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationV2Sample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotV2Sample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesV2Sample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSlotSample.ts create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json create mode 100644 sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/pagingHelper.ts delete mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/sample.env create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/globalAdministratorElevateAccessSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/permissionsListForResourceGroupSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/permissionsListForResourceSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/providerOperationsMetadataGetSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/providerOperationsMetadataListSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsCreateByIdSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsCreateSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsDeleteByIdSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsDeleteSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsGetByIdSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsGetSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForResourceGroupSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForResourceSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForScopeSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsCreateOrUpdateSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsDeleteSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsGetByIdSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsGetSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsListSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/README.md create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/globalAdministratorElevateAccessSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/package.json create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceGroupSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataGetSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataListSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateByIdSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteByIdSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetByIdSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceGroupSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForScopeSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsCreateOrUpdateSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsDeleteSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetByIdSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsListSample.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/sample.env create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/README.md create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/package.json create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/sample.env create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/globalAdministratorElevateAccessSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceGroupSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataGetSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataListSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateByIdSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteByIdSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetByIdSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceGroupSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForScopeSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsCreateOrUpdateSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsDeleteSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetByIdSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsListSample.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/tsconfig.json create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/pagingHelper.ts create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/sample.env create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples-dev/rateCardGetSample.ts create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/README.md create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/package.json create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/rateCardGetSample.js create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/README.md create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/package.json create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/src/rateCardGetSample.ts create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json create mode 100644 sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/pagingHelper.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/sample.env create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/availabilitySetsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/availabilitySetsListBySubscriptionSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostGroupsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostGroupsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsDeleteSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/logAnalyticsExportRequestRateByIntervalSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/logAnalyticsExportThrottledRequestsSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsDeleteSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsListBySubscriptionSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysCreateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysGenerateKeyPairSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsDeleteSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSGetInstanceViewSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSSimulateEvictionSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesAssessPatchesSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesDeleteSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesGeneralizeSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesInstanceViewSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesListAvailableSizesSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesListByLocationSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesReapplySample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesReimageSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesRetrieveBootDiagnosticsDataSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesSimulateEvictionSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/README.md create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsListBySubscriptionSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsDeleteSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListByResourceGroupSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListByResourceGroupSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListByResourceGroupSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportRequestRateByIntervalSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportThrottledRequestsSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/package.json create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsDeleteSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListByResourceGroupSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListBySubscriptionSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListByResourceGroupSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysCreateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGenerateKeyPairSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsDeleteSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsListSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSGetInstanceViewSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSSimulateEvictionSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesAssessPatchesSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesCreateOrUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesDeleteSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGeneralizeSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGetSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesInstanceViewSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListAvailableSizesSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListByLocationSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReapplySample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReimageSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesRetrieveBootDiagnosticsDataSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesSimulateEvictionSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesUpdateSample.js create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/README.md create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/package.json create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsListBySubscriptionSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsDeleteSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportRequestRateByIntervalSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportThrottledRequestsSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsDeleteSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListBySubscriptionSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListByResourceGroupSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysCreateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGenerateKeyPairSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsDeleteSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsListSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSGetInstanceViewSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSSimulateEvictionSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesAssessPatchesSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesCreateOrUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesDeleteSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGeneralizeSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGetSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesInstanceViewSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListAvailableSizesSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListByLocationSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReapplySample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReimageSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesRetrieveBootDiagnosticsDataSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesSimulateEvictionSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesUpdateSample.ts create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json create mode 100644 sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/pagingHelper.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 4c5b532b089..7f8d5282614 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3784,7 +3784,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.0.0-dev.20221218 + typescript: 5.0.0-dev.20221219 dev: false /downlevel-dts/0.7.0: @@ -8488,8 +8488,8 @@ packages: hasBin: true dev: false - /typescript/5.0.0-dev.20221218: - resolution: {integrity: sha512-H9OjIoDzurBIgB+Gq/9aAudpSKtfaN+dRCwWc/Ugg8B6/p5VA5KFlnwm2sLjOyTzApusKKUJUpV+u/hXEfxaOA==} + /typescript/5.0.0-dev.20221219: + resolution: {integrity: sha512-/ZglDGQtpeVudCAVJuEdM8K8vUCA1yPMpsk3y08/ZXn6dxk/D1hy59FEI25/EHqsACElN++9CoKzkJS1wBTiRw==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -9891,7 +9891,7 @@ packages: dev: false file:projects/arm-appservice-profile-2020-09-01-hybrid.tgz: - resolution: {integrity: sha512-5MygL1hdb+v5sTzCGHfUVLFZjxzWkSlG8RH7EuVbaU8oxNQrpMpqYrG1/DgjwuMnaHUIZNjyav8c+eh7nnZT9Q==, tarball: file:projects/arm-appservice-profile-2020-09-01-hybrid.tgz} + resolution: {integrity: sha512-4hgR3nTbpaNCjhsBvryqC6HtxauC2JPA+wVySCBSc6RUkW4Z+rWC2PAGX66QSd/XV8vnrbmHWWMkf/J1Aw7AwQ==, tarball: file:projects/arm-appservice-profile-2020-09-01-hybrid.tgz} name: '@rush-temp/arm-appservice-profile-2020-09-01-hybrid' version: 0.0.0 dependencies: @@ -9902,18 +9902,20 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.4 + '@types/node': 14.18.33 + chai: 4.3.7 cross-env: 7.0.3 + dotenv: 8.6.0 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_1225c068d0546e507df7db46196a6444 tslib: 2.4.1 - typescript: 4.2.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - - encoding - supports-color dev: false @@ -9987,7 +9989,7 @@ packages: dev: false file:projects/arm-authorization-profile-2020-09-01-hybrid.tgz: - resolution: {integrity: sha512-qkNdkK2xrC1E4v0Q37U2JJBI9LCwLTIlks3/anrG2SM6FSwR2N/ZA0ltRnDZtP3cpSW9CRiEo7Mj0eOBm/or0g==, tarball: file:projects/arm-authorization-profile-2020-09-01-hybrid.tgz} + resolution: {integrity: sha512-SuwN4FnyqC5zSSTUXYhOXdZD9+tjgVBM7CYTPn37TdiFWSCctsuI3RQFYjhqNa+7nLEvSPcZz0zfRtUDTLahNw==, tarball: file:projects/arm-authorization-profile-2020-09-01-hybrid.tgz} name: '@rush-temp/arm-authorization-profile-2020-09-01-hybrid' version: 0.0.0 dependencies: @@ -9998,18 +10000,20 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.4 + '@types/node': 14.18.33 + chai: 4.3.7 cross-env: 7.0.3 + dotenv: 8.6.0 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_1225c068d0546e507df7db46196a6444 tslib: 2.4.1 - typescript: 4.2.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - - encoding - supports-color dev: false @@ -10442,7 +10446,7 @@ packages: dev: false file:projects/arm-commerce-profile-2020-09-01-hybrid.tgz: - resolution: {integrity: sha512-k+sV8xO6YyYDcty4EfUymWWzpR5rBP/WnTBlPHMqG+3RXZyce8deQnQJKevOTPv1o1uQNhzwxkcDSrxnu1y9jw==, tarball: file:projects/arm-commerce-profile-2020-09-01-hybrid.tgz} + resolution: {integrity: sha512-U9Q9QlA0JYRNANmV5FiVoAvBYyXsd4GInoGP5aQhVAL2A1N6GQcyOGvH03zm5NBKrR+W+RU3WP8WFShW6hpxQA==, tarball: file:projects/arm-commerce-profile-2020-09-01-hybrid.tgz} name: '@rush-temp/arm-commerce-profile-2020-09-01-hybrid' version: 0.0.0 dependencies: @@ -10453,18 +10457,20 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.4 + '@types/node': 14.18.33 + chai: 4.3.7 cross-env: 7.0.3 + dotenv: 8.6.0 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_1225c068d0546e507df7db46196a6444 tslib: 2.4.1 - typescript: 4.2.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - - encoding - supports-color dev: false @@ -10580,7 +10586,7 @@ packages: dev: false file:projects/arm-compute-profile-2020-09-01-hybrid.tgz: - resolution: {integrity: sha512-DWlew1VsOFbfvamVVvZm/ioj5NaILePfoEOFdEG4P8LyBMAR3Z+c7BJFNt4gTEzzefeK2G+fxDwUuRIz7S6w+g==, tarball: file:projects/arm-compute-profile-2020-09-01-hybrid.tgz} + resolution: {integrity: sha512-ulg+sgzXZwUU0lDu7Um7/HCU9NIXktZ1K7E2NUiQFk6+FFe9D1rT6066pV4uPaKwebXwNBe8DyaR8UVn2VuWTA==, tarball: file:projects/arm-compute-profile-2020-09-01-hybrid.tgz} name: '@rush-temp/arm-compute-profile-2020-09-01-hybrid' version: 0.0.0 dependencies: @@ -10591,18 +10597,20 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.4 + '@types/node': 14.18.33 + chai: 4.3.7 cross-env: 7.0.3 + dotenv: 8.6.0 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_1225c068d0546e507df7db46196a6444 tslib: 2.4.1 - typescript: 4.2.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - - encoding - supports-color dev: false diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/CHANGELOG.md b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/CHANGELOG.md index 9bf8410b3e8..cc0170eeecd 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/CHANGELOG.md +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/CHANGELOG.md @@ -1,5 +1,117 @@ # Release History +## 2.1.0 (2022-12-16) + +**Features** + + - Added Interface AppServicePlan + - Added Interface AppServicePlanPatchResource + - Added Interface AzureStoragePropertyDictionaryResource + - Added Interface BackupItem + - Added Interface BackupRequest + - Added Interface BillingMeter + - Added Interface Certificate + - Added Interface CertificatePatchResource + - Added Interface ConnectionStringDictionary + - Added Interface ContinuousWebJob + - Added Interface CustomHostnameAnalysisResult + - Added Interface DeletedAppRestoreRequest + - Added Interface Deployment + - Added Interface FunctionEnvelope + - Added Interface FunctionSecrets + - Added Interface GeoRegion + - Added Interface HostNameBinding + - Added Interface HybridConnection + - Added Interface HybridConnectionKey + - Added Interface HybridConnectionLimits + - Added Interface Identifier + - Added Interface MigrateMySqlRequest + - Added Interface MigrateMySqlStatus + - Added Interface MSDeploy + - Added Interface MSDeployLog + - Added Interface MSDeployStatus + - Added Interface NetworkFeatures + - Added Interface PremierAddOn + - Added Interface PremierAddOnOffer + - Added Interface PremierAddOnPatchResource + - Added Interface PrivateAccess + - Added Interface ProcessInfo + - Added Interface ProcessModuleInfo + - Added Interface ProcessThreadInfo + - Added Interface PublicCertificate + - Added Interface PushSettings + - Added Interface Recommendation + - Added Interface RecommendationRule + - Added Interface RelayServiceConnectionEntity + - Added Interface ResourceMetricDefinition + - Added Interface RestoreRequest + - Added Interface Site + - Added Interface SiteAuthSettings + - Added Interface SiteConfigResource + - Added Interface SiteConfigurationSnapshotInfo + - Added Interface SiteExtensionInfo + - Added Interface SiteInstance + - Added Interface SiteLogsConfig + - Added Interface SitePatchResource + - Added Interface SitePhpErrorLogFlag + - Added Interface SiteSourceControl + - Added Interface SlotConfigNamesResource + - Added Interface SlotDifference + - Added Interface Snapshot + - Added Interface SnapshotRestoreRequest + - Added Interface SourceControl + - Added Interface StorageMigrationOptions + - Added Interface StorageMigrationResponse + - Added Interface StringDictionary + - Added Interface SwiftVirtualNetwork + - Added Interface TriggeredJobHistory + - Added Interface TriggeredJobRun + - Added Interface TriggeredWebJob + - Added Interface User + - Added Interface VnetGateway + - Added Interface VnetInfo + - Added Interface VnetParameters + - Added Interface VnetRoute + - Added Interface VnetValidationFailureDetails + - Added Interface VnetValidationTestFailure + - Added Interface WebJob + - Added function getContinuationToken + - Interface AppServicePlansListMetricsNextOptionalParams no longer has parameter details + - Interface AppServicePlansListMetricsNextOptionalParams no longer has parameter filter + - Interface AppServicePlansListNextOptionalParams no longer has parameter detailed + - Interface AppServicePlansListUsagesNextOptionalParams no longer has parameter filter + - Interface AppServicePlansListWebAppsNextOptionalParams no longer has parameter filter + - Interface AppServicePlansListWebAppsNextOptionalParams no longer has parameter skipToken + - Interface AppServicePlansListWebAppsNextOptionalParams no longer has parameter top + - Interface ListBillingMetersNextOptionalParams no longer has parameter billingLocation + - Interface ListBillingMetersNextOptionalParams no longer has parameter osType + - Interface ListGeoRegionsNextOptionalParams no longer has parameter linuxDynamicWorkersEnabled + - Interface ListGeoRegionsNextOptionalParams no longer has parameter linuxWorkersEnabled + - Interface ListGeoRegionsNextOptionalParams no longer has parameter sku + - Interface ListGeoRegionsNextOptionalParams no longer has parameter xenonWorkersEnabled + - Interface ProviderGetAvailableStacksNextOptionalParams no longer has parameter osTypeSelected + - Interface ProviderGetAvailableStacksOnPremNextOptionalParams no longer has parameter osTypeSelected + - Interface RecommendationsListHistoryForHostingEnvironmentNextOptionalParams no longer has parameter expiredOnly + - Interface RecommendationsListHistoryForHostingEnvironmentNextOptionalParams no longer has parameter filter + - Interface RecommendationsListHistoryForWebAppNextOptionalParams no longer has parameter expiredOnly + - Interface RecommendationsListHistoryForWebAppNextOptionalParams no longer has parameter filter + - Interface RecommendationsListNextOptionalParams no longer has parameter featured + - Interface RecommendationsListNextOptionalParams no longer has parameter filter + - Interface RecommendationsListRecommendedRulesForHostingEnvironmentNextOptionalParams no longer has parameter featured + - Interface RecommendationsListRecommendedRulesForHostingEnvironmentNextOptionalParams no longer has parameter filter + - Interface RecommendationsListRecommendedRulesForWebAppNextOptionalParams no longer has parameter featured + - Interface RecommendationsListRecommendedRulesForWebAppNextOptionalParams no longer has parameter filter + - Interface WebAppsListByResourceGroupNextOptionalParams no longer has parameter includeSlots + - Interface WebAppsListMetricsNextOptionalParams no longer has parameter details + - Interface WebAppsListMetricsNextOptionalParams no longer has parameter filter + - Interface WebAppsListMetricsSlotNextOptionalParams no longer has parameter details + - Interface WebAppsListMetricsSlotNextOptionalParams no longer has parameter filter + - Interface WebAppsListPerfMonCountersNextOptionalParams no longer has parameter filter + - Interface WebAppsListPerfMonCountersSlotNextOptionalParams no longer has parameter filter + - Interface WebAppsListUsagesNextOptionalParams no longer has parameter filter + - Interface WebAppsListUsagesSlotNextOptionalParams no longer has parameter filter + + ## 2.0.0 (2022-03-11) The package of @azure/arm-appservice-profile-2020-09-01-hybrid is using our next generation design principles since version 2.0.0, which contains breaking changes. diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/_meta.json b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/_meta.json index 2f2a4f71929..ec3355f5b45 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/_meta.json +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/_meta.json @@ -1,8 +1,8 @@ { "commit": "1067b78669466324a1a2666adf053433c61e7f77", "readme": "specification/web/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\web\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --tag=profile-hybrid-2020-09-01 --profile-content=profile-hybrid-2020-09-01", + "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\\web\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.5 --generate-sample=true --profile-content=profile-hybrid-2020-09-01", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.1.1", - "use": "@autorest/typescript@6.0.0-beta.16" + "release_tool": "@azure-tools/js-sdk-release-tools@2.5.4", + "use": "@autorest/typescript@6.0.0-rc.5" } \ No newline at end of file diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/package.json b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/package.json index dfebb3ebefa..801bda7a8dd 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/package.json +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for WebSiteManagementClient.", - "version": "2.0.0", + "version": "2.1.0", "engines": { "node": ">=14.0.0" }, @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -36,13 +36,19 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.2.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "@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", + "dotenv": "^8.2.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid", "repository": { @@ -93,9 +99,8 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", - "integration-test:browser": "echo skipped", - "docs": "echo skipped" + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, "//metadata": { @@ -106,5 +111,13 @@ } ] }, - "autoPublish": true + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-appservice-profile-2020-09-01-hybrid?view=azure-node-preview" + } } diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json new file mode 100644 index 00000000000..f721723386d --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/review/arm-appservice-profile-2020-09-01-hybrid.api.md b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/review/arm-appservice-profile-2020-09-01-hybrid.api.md index 6b3d568cdc8..42271c01256 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/review/arm-appservice-profile-2020-09-01-hybrid.api.md +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/review/arm-appservice-profile-2020-09-01-hybrid.api.md @@ -86,28 +86,28 @@ export interface AppServiceEnvironment { } // @public -export type AppServicePlan = Resource & { +export interface AppServicePlan extends Resource { + freeOfferExpirationTime?: Date; + readonly geoRegion?: string; + hostingEnvironmentProfile?: HostingEnvironmentProfile; + hyperV?: boolean; + isSpot?: boolean; + isXenon?: boolean; + maximumElasticWorkerCount?: number; + readonly maximumNumberOfWorkers?: number; + readonly numberOfSites?: number; + perSiteScaling?: boolean; + readonly provisioningState?: ProvisioningState; + reserved?: boolean; + readonly resourceGroup?: string; sku?: SkuDescription; - workerTierName?: string; + spotExpirationTime?: Date; readonly status?: StatusOptions; readonly subscription?: string; - hostingEnvironmentProfile?: HostingEnvironmentProfile; - readonly maximumNumberOfWorkers?: number; - readonly geoRegion?: string; - perSiteScaling?: boolean; - maximumElasticWorkerCount?: number; - readonly numberOfSites?: number; - isSpot?: boolean; - spotExpirationTime?: Date; - freeOfferExpirationTime?: Date; - readonly resourceGroup?: string; - reserved?: boolean; - isXenon?: boolean; - hyperV?: boolean; targetWorkerCount?: number; targetWorkerSizeId?: number; - readonly provisioningState?: ProvisioningState; -}; + workerTierName?: string; +} // @public export interface AppServicePlanCollection { @@ -116,27 +116,27 @@ export interface AppServicePlanCollection { } // @public -export type AppServicePlanPatchResource = ProxyOnlyResource & { - workerTierName?: string; +export interface AppServicePlanPatchResource extends ProxyOnlyResource { + freeOfferExpirationTime?: Date; + readonly geoRegion?: string; + hostingEnvironmentProfile?: HostingEnvironmentProfile; + hyperV?: boolean; + isSpot?: boolean; + isXenon?: boolean; + maximumElasticWorkerCount?: number; + readonly maximumNumberOfWorkers?: number; + readonly numberOfSites?: number; + perSiteScaling?: boolean; + readonly provisioningState?: ProvisioningState; + reserved?: boolean; + readonly resourceGroup?: string; + spotExpirationTime?: Date; readonly status?: StatusOptions; readonly subscription?: string; - hostingEnvironmentProfile?: HostingEnvironmentProfile; - readonly maximumNumberOfWorkers?: number; - readonly geoRegion?: string; - perSiteScaling?: boolean; - maximumElasticWorkerCount?: number; - readonly numberOfSites?: number; - isSpot?: boolean; - spotExpirationTime?: Date; - freeOfferExpirationTime?: Date; - readonly resourceGroup?: string; - reserved?: boolean; - isXenon?: boolean; - hyperV?: boolean; targetWorkerCount?: number; targetWorkerSizeId?: number; - readonly provisioningState?: ProvisioningState; -}; + workerTierName?: string; +} // @public export type AppServicePlanRestrictions = "None" | "Free" | "Shared" | "Basic" | "Standard" | "Premium"; @@ -310,8 +310,6 @@ export type AppServicePlansListMetricDefintionsResponse = ResourceMetricDefiniti // @public export interface AppServicePlansListMetricsNextOptionalParams extends coreClient.OperationOptions { - details?: boolean; - filter?: string; } // @public @@ -328,7 +326,6 @@ export type AppServicePlansListMetricsResponse = ResourceMetricCollection; // @public export interface AppServicePlansListNextOptionalParams extends coreClient.OperationOptions { - detailed?: boolean; } // @public @@ -351,7 +348,6 @@ export type AppServicePlansListRoutesForVnetResponse = VnetRoute[]; // @public export interface AppServicePlansListUsagesNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -388,9 +384,6 @@ export type AppServicePlansListWebAppsByHybridConnectionResponse = ResourceColle // @public export interface AppServicePlansListWebAppsNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - skipToken?: string; - top?: string; } // @public @@ -494,11 +487,11 @@ export interface AzureStorageInfoValue { } // @public -export type AzureStoragePropertyDictionaryResource = ProxyOnlyResource & { +export interface AzureStoragePropertyDictionaryResource extends ProxyOnlyResource { properties?: { [propertyName: string]: AzureStorageInfoValue; }; -}; +} // @public export type AzureStorageState = "Ok" | "InvalidCredentials" | "InvalidShare"; @@ -513,22 +506,22 @@ export interface AzureTableStorageApplicationLogsConfig { } // @public -export type BackupItem = ProxyOnlyResource & { +export interface BackupItem extends ProxyOnlyResource { readonly backupId?: number; - readonly storageAccountUrl?: string; readonly blobName?: string; - readonly namePropertiesName?: string; - readonly status?: BackupItemStatus; - readonly sizeInBytes?: number; - readonly created?: Date; - readonly log?: string; - readonly databases?: DatabaseBackupSetting[]; - readonly scheduled?: boolean; - readonly lastRestoreTimeStamp?: Date; - readonly finishedTimeStamp?: Date; readonly correlationId?: string; + readonly created?: Date; + readonly databases?: DatabaseBackupSetting[]; + readonly finishedTimeStamp?: Date; + readonly lastRestoreTimeStamp?: Date; + readonly log?: string; + readonly namePropertiesName?: string; + readonly scheduled?: boolean; + readonly sizeInBytes?: number; + readonly status?: BackupItemStatus; + readonly storageAccountUrl?: string; readonly websiteSizeInBytes?: number; -}; +} // @public export interface BackupItemCollection { @@ -540,13 +533,13 @@ export interface BackupItemCollection { export type BackupItemStatus = "InProgress" | "Failed" | "Succeeded" | "TimedOut" | "Created" | "Skipped" | "PartiallySucceeded" | "DeleteInProgress" | "DeleteFailed" | "Deleted"; // @public -export type BackupRequest = ProxyOnlyResource & { +export interface BackupRequest extends ProxyOnlyResource { backupName?: string; - enabled?: boolean; - storageAccountUrl?: string; backupSchedule?: BackupSchedule; databases?: DatabaseBackupSetting[]; -}; + enabled?: boolean; + storageAccountUrl?: string; +} // @public export type BackupRestoreOperationType = "Default" | "Clone" | "Relocation" | "Snapshot" | "CloudFS"; @@ -562,14 +555,14 @@ export interface BackupSchedule { } // @public -export type BillingMeter = ProxyOnlyResource & { - meterId?: string; +export interface BillingMeter extends ProxyOnlyResource { billingLocation?: string; - shortName?: string; friendlyName?: string; - resourceType?: string; + meterId?: string; osType?: string; -}; + resourceType?: string; + shortName?: string; +} // @public export interface BillingMeterCollection { @@ -588,27 +581,27 @@ export interface Capability { } // @public -export type Certificate = Resource & { - readonly friendlyName?: string; - readonly subjectName?: string; - hostNames?: string[]; - pfxBlob?: Uint8Array; - readonly siteName?: string; - readonly selfLink?: string; - readonly issuer?: string; - readonly issueDate?: Date; - readonly expirationDate?: Date; - password?: string; - readonly thumbprint?: string; - readonly valid?: boolean; +export interface Certificate extends Resource { readonly cerBlob?: Uint8Array; - readonly publicKeyHash?: string; + readonly expirationDate?: Date; + readonly friendlyName?: string; readonly hostingEnvironmentProfile?: HostingEnvironmentProfile; + hostNames?: string[]; + readonly issueDate?: Date; + readonly issuer?: string; keyVaultId?: string; keyVaultSecretName?: string; readonly keyVaultSecretStatus?: KeyVaultSecretStatus; + password?: string; + pfxBlob?: Uint8Array; + readonly publicKeyHash?: string; + readonly selfLink?: string; serverFarmId?: string; -}; + readonly siteName?: string; + readonly subjectName?: string; + readonly thumbprint?: string; + readonly valid?: boolean; +} // @public export interface CertificateCollection { @@ -617,27 +610,27 @@ export interface CertificateCollection { } // @public -export type CertificatePatchResource = ProxyOnlyResource & { - readonly friendlyName?: string; - readonly subjectName?: string; - hostNames?: string[]; - pfxBlob?: Uint8Array; - readonly siteName?: string; - readonly selfLink?: string; - readonly issuer?: string; - readonly issueDate?: Date; - readonly expirationDate?: Date; - password?: string; - readonly thumbprint?: string; - readonly valid?: boolean; +export interface CertificatePatchResource extends ProxyOnlyResource { readonly cerBlob?: Uint8Array; - readonly publicKeyHash?: string; + readonly expirationDate?: Date; + readonly friendlyName?: string; readonly hostingEnvironmentProfile?: HostingEnvironmentProfile; + hostNames?: string[]; + readonly issueDate?: Date; + readonly issuer?: string; keyVaultId?: string; keyVaultSecretName?: string; readonly keyVaultSecretStatus?: KeyVaultSecretStatus; + password?: string; + pfxBlob?: Uint8Array; + readonly publicKeyHash?: string; + readonly selfLink?: string; serverFarmId?: string; -}; + readonly siteName?: string; + readonly subjectName?: string; + readonly thumbprint?: string; + readonly valid?: boolean; +} // @public export interface Certificates { @@ -746,11 +739,11 @@ export interface Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserass export type ComputeModeOptions = "Shared" | "Dedicated" | "Dynamic"; // @public -export type ConnectionStringDictionary = ProxyOnlyResource & { +export interface ConnectionStringDictionary extends ProxyOnlyResource { properties?: { [propertyName: string]: ConnStringValueTypePair; }; -}; +} // @public export type ConnectionStringType = "MySql" | "SQLServer" | "SQLAzure" | "Custom" | "NotificationHub" | "ServiceBus" | "EventHub" | "ApiHub" | "DocDb" | "RedisCache" | "PostgreSQL"; @@ -769,20 +762,20 @@ export interface ConnStringValueTypePair { } // @public -export type ContinuousWebJob = ProxyOnlyResource & { - status?: ContinuousWebJobStatus; +export interface ContinuousWebJob extends ProxyOnlyResource { detailedStatus?: string; + error?: string; + extraInfoUrl?: string; logUrl?: string; runCommand?: string; - url?: string; - extraInfoUrl?: string; - webJobType?: WebJobType; - error?: string; - usingSdk?: boolean; settings?: { [propertyName: string]: Record; }; -}; + status?: ContinuousWebJobStatus; + url?: string; + usingSdk?: boolean; + webJobType?: WebJobType; +} // @public export interface ContinuousWebJobCollection { @@ -868,19 +861,19 @@ export interface CsmUsageQuotaCollection { } // @public -export type CustomHostnameAnalysisResult = ProxyOnlyResource & { - readonly isHostnameAlreadyVerified?: boolean; - readonly customDomainVerificationTest?: DnsVerificationTestResult; - readonly customDomainVerificationFailureInfo?: ErrorEntity; - readonly hasConflictOnScaleUnit?: boolean; - readonly hasConflictAcrossSubscription?: boolean; - readonly conflictingAppResourceId?: string; - cNameRecords?: string[]; - txtRecords?: string[]; - aRecords?: string[]; +export interface CustomHostnameAnalysisResult extends ProxyOnlyResource { alternateCNameRecords?: string[]; alternateTxtRecords?: string[]; -}; + aRecords?: string[]; + cNameRecords?: string[]; + readonly conflictingAppResourceId?: string; + readonly customDomainVerificationFailureInfo?: ErrorEntity; + readonly customDomainVerificationTest?: DnsVerificationTestResult; + readonly hasConflictAcrossSubscription?: boolean; + readonly hasConflictOnScaleUnit?: boolean; + readonly isHostnameAlreadyVerified?: boolean; + txtRecords?: string[]; +} // @public export type CustomHostNameDnsRecordType = "CName" | "A"; @@ -920,25 +913,25 @@ export interface DefaultErrorResponseErrorDetailsItem { } // @public -export type DeletedAppRestoreRequest = ProxyOnlyResource & { +export interface DeletedAppRestoreRequest extends ProxyOnlyResource { deletedSiteId?: string; recoverConfiguration?: boolean; snapshotTime?: string; useDRSecondary?: boolean; -}; +} // @public -export type Deployment = ProxyOnlyResource & { - status?: number; - message?: string; - author?: string; - deployer?: string; - authorEmail?: string; - startTime?: Date; - endTime?: Date; +export interface Deployment extends ProxyOnlyResource { active?: boolean; + author?: string; + authorEmail?: string; + deployer?: string; details?: string; -}; + endTime?: Date; + message?: string; + startTime?: Date; + status?: number; +} // @public export interface DeploymentCollection { @@ -1013,23 +1006,23 @@ export type FrequencyUnit = "Day" | "Hour"; export type FtpsState = string; // @public -export type FunctionEnvelope = ProxyOnlyResource & { - functionAppId?: string; - scriptRootPathHref?: string; - scriptHref?: string; - configHref?: string; - testDataHref?: string; - secretsFileHref?: string; - href?: string; +export interface FunctionEnvelope extends ProxyOnlyResource { config?: Record; + configHref?: string; files?: { [propertyName: string]: string; }; - testData?: string; + functionAppId?: string; + href?: string; invokeUrlTemplate?: string; - language?: string; isDisabled?: boolean; -}; + language?: string; + scriptHref?: string; + scriptRootPathHref?: string; + secretsFileHref?: string; + testData?: string; + testDataHref?: string; +} // @public export interface FunctionEnvelopeCollection { @@ -1038,10 +1031,10 @@ export interface FunctionEnvelopeCollection { } // @public -export type FunctionSecrets = ProxyOnlyResource & { +export interface FunctionSecrets extends ProxyOnlyResource { key?: string; triggerUrl?: string; -}; +} // @public export interface GeoDistribution { @@ -1050,10 +1043,10 @@ export interface GeoDistribution { } // @public -export type GeoRegion = ProxyOnlyResource & { +export interface GeoRegion extends ProxyOnlyResource { readonly description?: string; readonly displayName?: string; -}; +} // @public export interface GeoRegionCollection { @@ -1061,6 +1054,9 @@ export interface GeoRegionCollection { value: GeoRegion[]; } +// @public +export function getContinuationToken(page: unknown): string | undefined; + // @public export interface GetPublishingUserOptionalParams extends coreClient.OperationOptions { } @@ -1128,17 +1124,17 @@ export interface HostKeys { } // @public -export type HostNameBinding = ProxyOnlyResource & { - siteName?: string; - domainId?: string; +export interface HostNameBinding extends ProxyOnlyResource { azureResourceName?: string; azureResourceType?: AzureResourceType; customHostNameDnsRecordType?: CustomHostNameDnsRecordType; + domainId?: string; hostNameType?: HostNameType; + siteName?: string; sslState?: SslState; thumbprint?: string; readonly virtualIP?: string; -}; +} // @public export interface HostNameBindingCollection { @@ -1169,16 +1165,16 @@ export interface HttpLogsConfig { } // @public -export type HybridConnection = ProxyOnlyResource & { - serviceBusNamespace?: string; - relayName?: string; - relayArmUri?: string; +export interface HybridConnection extends ProxyOnlyResource { hostname?: string; port?: number; + relayArmUri?: string; + relayName?: string; sendKeyName?: string; sendKeyValue?: string; + serviceBusNamespace?: string; serviceBusSuffix?: string; -}; +} // @public export interface HybridConnectionCollection { @@ -1187,21 +1183,21 @@ export interface HybridConnectionCollection { } // @public -export type HybridConnectionKey = ProxyOnlyResource & { +export interface HybridConnectionKey extends ProxyOnlyResource { readonly sendKeyName?: string; readonly sendKeyValue?: string; -}; +} // @public -export type HybridConnectionLimits = ProxyOnlyResource & { +export interface HybridConnectionLimits extends ProxyOnlyResource { readonly current?: number; readonly maximum?: number; -}; +} // @public -export type Identifier = ProxyOnlyResource & { +export interface Identifier extends ProxyOnlyResource { idPropertiesId?: string; -}; +} // @public export interface IdentifierCollection { @@ -1243,196 +1239,128 @@ export type KeyVaultSecretStatus = "Initialized" | "WaitingOnCertificateOrder" | // @public export enum KnownCheckNameResourceTypes { - // (undocumented) HostingEnvironment = "HostingEnvironment", - // (undocumented) MicrosoftWebHostingEnvironments = "Microsoft.Web/hostingEnvironments", - // (undocumented) MicrosoftWebPublishingUsers = "Microsoft.Web/publishingUsers", - // (undocumented) MicrosoftWebSites = "Microsoft.Web/sites", - // (undocumented) MicrosoftWebSitesSlots = "Microsoft.Web/sites/slots", - // (undocumented) PublishingUser = "PublishingUser", - // (undocumented) Site = "Site", - // (undocumented) Slot = "Slot" } // @public export enum KnownDatabaseType { - // (undocumented) LocalMySql = "LocalMySql", - // (undocumented) MySql = "MySql", - // (undocumented) PostgreSql = "PostgreSql", - // (undocumented) SqlAzure = "SqlAzure" } // @public export enum KnownEnum11 { - // (undocumented) Linux = "Linux", - // (undocumented) LinuxFunctions = "LinuxFunctions", - // (undocumented) Windows = "Windows", - // (undocumented) WindowsFunctions = "WindowsFunctions" } // @public export enum KnownEnum12 { - // (undocumented) Linux = "Linux", - // (undocumented) LinuxFunctions = "LinuxFunctions", - // (undocumented) Windows = "Windows", - // (undocumented) WindowsFunctions = "WindowsFunctions" } // @public export enum KnownFtpsState { - // (undocumented) AllAllowed = "AllAllowed", - // (undocumented) Disabled = "Disabled", - // (undocumented) FtpsOnly = "FtpsOnly" } // @public export enum KnownInAvailabilityReasonType { - // (undocumented) AlreadyExists = "AlreadyExists", - // (undocumented) Invalid = "Invalid" } // @public export enum KnownManagedServiceIdentityType { - // (undocumented) None = "None", - // (undocumented) SystemAssigned = "SystemAssigned", - // (undocumented) SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", - // (undocumented) UserAssigned = "UserAssigned" } // @public export enum KnownPublishingProfileFormat { - // (undocumented) FileZilla3 = "FileZilla3", - // (undocumented) Ftp = "Ftp", - // (undocumented) WebDeploy = "WebDeploy" } // @public export enum KnownResourceScopeType { - // (undocumented) ServerFarm = "ServerFarm", - // (undocumented) Subscription = "Subscription", - // (undocumented) WebSite = "WebSite" } // @public export enum KnownRouteType { - // (undocumented) Default = "DEFAULT", - // (undocumented) Inherited = "INHERITED", - // (undocumented) Static = "STATIC" } // @public export enum KnownScmType { - // (undocumented) BitbucketGit = "BitbucketGit", - // (undocumented) BitbucketHg = "BitbucketHg", - // (undocumented) CodePlexGit = "CodePlexGit", - // (undocumented) CodePlexHg = "CodePlexHg", - // (undocumented) Dropbox = "Dropbox", - // (undocumented) ExternalGit = "ExternalGit", - // (undocumented) ExternalHg = "ExternalHg", - // (undocumented) GitHub = "GitHub", - // (undocumented) LocalGit = "LocalGit", - // (undocumented) None = "None", - // (undocumented) OneDrive = "OneDrive", - // (undocumented) Tfs = "Tfs", - // (undocumented) VSO = "VSO" } // @public export enum KnownSkuName { - // (undocumented) Basic = "Basic", - // (undocumented) Dynamic = "Dynamic", - // (undocumented) ElasticIsolated = "ElasticIsolated", - // (undocumented) ElasticPremium = "ElasticPremium", - // (undocumented) Free = "Free", - // (undocumented) Isolated = "Isolated", - // (undocumented) Premium = "Premium", - // (undocumented) PremiumV2 = "PremiumV2", - // (undocumented) Shared = "Shared", - // (undocumented) Standard = "Standard" } // @public export enum KnownSupportedTlsVersions { - // (undocumented) One0 = "1.0", - // (undocumented) One1 = "1.1", - // (undocumented) One2 = "1.2" } // @public export enum KnownValidateResourceTypes { - // (undocumented) ServerFarm = "ServerFarm", - // (undocumented) Site = "Site" } // @public export interface ListBillingMetersNextOptionalParams extends coreClient.OperationOptions { - billingLocation?: string; - osType?: string; } // @public @@ -1449,10 +1377,6 @@ export type ListBillingMetersResponse = BillingMeterCollection; // @public export interface ListGeoRegionsNextOptionalParams extends coreClient.OperationOptions { - linuxDynamicWorkersEnabled?: boolean; - linuxWorkersEnabled?: boolean; - sku?: SkuName; - xenonWorkersEnabled?: boolean; } // @public @@ -1596,39 +1520,39 @@ export interface MetricSpecification { } // @public -export type MigrateMySqlRequest = ProxyOnlyResource & { +export interface MigrateMySqlRequest extends ProxyOnlyResource { connectionString?: string; migrationType?: MySqlMigrationType; -}; +} // @public -export type MigrateMySqlStatus = ProxyOnlyResource & { +export interface MigrateMySqlStatus extends ProxyOnlyResource { + readonly localMySqlEnabled?: boolean; readonly migrationOperationStatus?: OperationStatus; readonly operationId?: string; - readonly localMySqlEnabled?: boolean; -}; +} // @public export interface MoveOptionalParams extends coreClient.OperationOptions { } // @public -export type MSDeploy = ProxyOnlyResource & { - packageUri?: string; +export interface MSDeploy extends ProxyOnlyResource { + appOffline?: boolean; connectionString?: string; dbType?: string; - setParametersXmlFileUri?: string; + packageUri?: string; setParameters?: { [propertyName: string]: string; }; + setParametersXmlFileUri?: string; skipAppData?: boolean; - appOffline?: boolean; -}; +} // @public -export type MSDeployLog = ProxyOnlyResource & { +export interface MSDeployLog extends ProxyOnlyResource { readonly entries?: MSDeployLogEntry[]; -}; +} // @public export interface MSDeployLogEntry { @@ -1644,13 +1568,13 @@ export type MSDeployLogEntryType = "Message" | "Warning" | "Error"; export type MSDeployProvisioningState = "accepted" | "running" | "succeeded" | "failed" | "canceled"; // @public -export type MSDeployStatus = ProxyOnlyResource & { +export interface MSDeployStatus extends ProxyOnlyResource { + readonly complete?: boolean; readonly deployer?: string; + readonly endTime?: Date; readonly provisioningState?: MSDeployProvisioningState; readonly startTime?: Date; - readonly endTime?: Date; - readonly complete?: boolean; -}; +} // @public export type MySqlMigrationType = "LocalToRemote" | "RemoteToLocal"; @@ -1675,12 +1599,12 @@ export interface NetworkAccessControlEntry { } // @public -export type NetworkFeatures = ProxyOnlyResource & { - readonly virtualNetworkName?: string; - readonly virtualNetworkConnection?: VnetInfo; +export interface NetworkFeatures extends ProxyOnlyResource { readonly hybridConnections?: RelayServiceConnectionEntity[]; readonly hybridConnectionsV2?: HybridConnection[]; -}; + readonly virtualNetworkConnection?: VnetInfo; + readonly virtualNetworkName?: string; +} // @public export interface NetworkTrace { @@ -1737,27 +1661,27 @@ export interface PerfMonSet { } // @public -export type PremierAddOn = Resource & { - sku?: string; - product?: string; - vendor?: string; - marketplacePublisher?: string; +export interface PremierAddOn extends Resource { marketplaceOffer?: string; -}; + marketplacePublisher?: string; + product?: string; + sku?: string; + vendor?: string; +} // @public -export type PremierAddOnOffer = ProxyOnlyResource & { - sku?: string; +export interface PremierAddOnOffer extends ProxyOnlyResource { + legalTermsUrl?: string; + marketplaceOffer?: string; + marketplacePublisher?: string; + privacyPolicyUrl?: string; product?: string; - vendor?: string; promoCodeRequired?: boolean; quota?: number; + sku?: string; + vendor?: string; webHostingPlanRestrictions?: AppServicePlanRestrictions; - privacyPolicyUrl?: string; - legalTermsUrl?: string; - marketplacePublisher?: string; - marketplaceOffer?: string; -}; +} // @public export interface PremierAddOnOfferCollection { @@ -1766,19 +1690,19 @@ export interface PremierAddOnOfferCollection { } // @public -export type PremierAddOnPatchResource = ProxyOnlyResource & { - sku?: string; - product?: string; - vendor?: string; - marketplacePublisher?: string; +export interface PremierAddOnPatchResource extends ProxyOnlyResource { marketplaceOffer?: string; -}; + marketplacePublisher?: string; + product?: string; + sku?: string; + vendor?: string; +} // @public -export type PrivateAccess = ProxyOnlyResource & { +export interface PrivateAccess extends ProxyOnlyResource { enabled?: boolean; virtualNetworks?: PrivateAccessVirtualNetwork[]; -}; +} // @public export interface PrivateAccessSubnet { @@ -1795,46 +1719,46 @@ export interface PrivateAccessVirtualNetwork { } // @public -export type ProcessInfo = ProxyOnlyResource & { - readonly identifier?: number; - deploymentName?: string; - href?: string; - minidump?: string; - isProfileRunning?: boolean; - isIisProfileRunning?: boolean; - iisProfileTimeoutInSeconds?: number; - parent?: string; +export interface ProcessInfo extends ProxyOnlyResource { children?: string[]; - threads?: ProcessThreadInfo[]; - openFileHandles?: string[]; - modules?: ProcessModuleInfo[]; - fileName?: string; commandLine?: string; - userName?: string; - handleCount?: number; - moduleCount?: number; - threadCount?: number; - startTime?: Date; - totalCpuTime?: string; - userCpuTime?: string; - privilegedCpuTime?: string; - workingSet?: number; - peakWorkingSet?: number; - privateMemory?: number; - virtualMemory?: number; - peakVirtualMemory?: number; - pagedSystemMemory?: number; - nonPagedSystemMemory?: number; - pagedMemory?: number; - peakPagedMemory?: number; - timeStamp?: Date; + deploymentName?: string; + description?: string; environmentVariables?: { [propertyName: string]: string; }; + fileName?: string; + handleCount?: number; + href?: string; + readonly identifier?: number; + iisProfileTimeoutInSeconds?: number; + isIisProfileRunning?: boolean; + isProfileRunning?: boolean; isScmSite?: boolean; isWebjob?: boolean; - description?: string; -}; + minidump?: string; + moduleCount?: number; + modules?: ProcessModuleInfo[]; + nonPagedSystemMemory?: number; + openFileHandles?: string[]; + pagedMemory?: number; + pagedSystemMemory?: number; + parent?: string; + peakPagedMemory?: number; + peakVirtualMemory?: number; + peakWorkingSet?: number; + privateMemory?: number; + privilegedCpuTime?: string; + startTime?: Date; + threadCount?: number; + threads?: ProcessThreadInfo[]; + timeStamp?: Date; + totalCpuTime?: string; + userCpuTime?: string; + userName?: string; + virtualMemory?: number; + workingSet?: number; +} // @public export interface ProcessInfoCollection { @@ -1843,19 +1767,19 @@ export interface ProcessInfoCollection { } // @public -export type ProcessModuleInfo = ProxyOnlyResource & { +export interface ProcessModuleInfo extends ProxyOnlyResource { baseAddress?: string; - fileName?: string; - href?: string; - filePath?: string; - moduleMemorySize?: number; - fileVersion?: string; fileDescription?: string; - product?: string; - productVersion?: string; + fileName?: string; + filePath?: string; + fileVersion?: string; + href?: string; isDebug?: boolean; language?: string; -}; + moduleMemorySize?: number; + product?: string; + productVersion?: string; +} // @public export interface ProcessModuleInfoCollection { @@ -1864,21 +1788,21 @@ export interface ProcessModuleInfoCollection { } // @public -export type ProcessThreadInfo = ProxyOnlyResource & { - readonly identifier?: number; +export interface ProcessThreadInfo extends ProxyOnlyResource { + basePriority?: number; + currentPriority?: number; href?: string; + readonly identifier?: number; + priorityLevel?: string; + priviledgedProcessorTime?: string; process?: string; startAddress?: string; - currentPriority?: number; - priorityLevel?: string; - basePriority?: number; startTime?: Date; + state?: string; totalProcessorTime?: string; userProcessorTime?: string; - priviledgedProcessorTime?: string; - state?: string; waitReason?: string; -}; +} // @public export interface ProcessThreadInfoCollection { @@ -1895,8 +1819,6 @@ export interface Provider { // @public export interface ProviderGetAvailableStacksNextOptionalParams extends coreClient.OperationOptions { - // (undocumented) - osTypeSelected?: Enum11; } // @public @@ -1904,8 +1826,6 @@ export type ProviderGetAvailableStacksNextResponse = ApplicationStackCollection; // @public export interface ProviderGetAvailableStacksOnPremNextOptionalParams extends coreClient.OperationOptions { - // (undocumented) - osTypeSelected?: Enum12; } // @public @@ -1955,11 +1875,11 @@ export interface ProxyOnlyResource { } // @public -export type PublicCertificate = ProxyOnlyResource & { +export interface PublicCertificate extends ProxyOnlyResource { blob?: Uint8Array; publicCertificateLocation?: PublicCertificateLocation; readonly thumbprint?: string; -}; +} // @public export interface PublicCertificateCollection { @@ -1974,12 +1894,12 @@ export type PublicCertificateLocation = "CurrentUserMy" | "LocalMachineMy" | "Un export type PublishingProfileFormat = string; // @public -export type PushSettings = ProxyOnlyResource & { - isPushEnabled?: boolean; - tagWhitelistJson?: string; - tagsRequiringAuth?: string; +export interface PushSettings extends ProxyOnlyResource { dynamicTagsJson?: string; -}; + isPushEnabled?: boolean; + tagsRequiringAuth?: string; + tagWhitelistJson?: string; +} // @public export interface RampUpRule { @@ -1994,31 +1914,31 @@ export interface RampUpRule { } // @public -export type Recommendation = ProxyOnlyResource & { +export interface Recommendation extends ProxyOnlyResource { + actionName?: string; + bladeName?: string; + readonly categoryTags?: string[]; + channels?: Channels; creationTime?: Date; + displayName?: string; + enabled?: number; + endTime?: Date; + extensionName?: string; + forwardLink?: string; + isDynamic?: boolean; + level?: NotificationLevel; + message?: string; + nextNotificationTime?: Date; + notificationExpirationTime?: Date; + notifiedTime?: Date; recommendationId?: string; resourceId?: string; resourceScope?: ResourceScopeType; ruleName?: string; - displayName?: string; - message?: string; - level?: NotificationLevel; - channels?: Channels; - readonly categoryTags?: string[]; - actionName?: string; - enabled?: number; - states?: string[]; - startTime?: Date; - endTime?: Date; - nextNotificationTime?: Date; - notificationExpirationTime?: Date; - notifiedTime?: Date; score?: number; - isDynamic?: boolean; - extensionName?: string; - bladeName?: string; - forwardLink?: string; -}; + startTime?: Date; + states?: string[]; +} // @public export interface RecommendationCollection { @@ -2027,21 +1947,21 @@ export interface RecommendationCollection { } // @public -export type RecommendationRule = ProxyOnlyResource & { - recommendationName?: string; +export interface RecommendationRule extends ProxyOnlyResource { + actionName?: string; + bladeName?: string; + readonly categoryTags?: string[]; + channels?: Channels; + description?: string; displayName?: string; + extensionName?: string; + forwardLink?: string; + isDynamic?: boolean; + level?: NotificationLevel; message?: string; recommendationId?: string; - description?: string; - actionName?: string; - level?: NotificationLevel; - channels?: Channels; - readonly categoryTags?: string[]; - isDynamic?: boolean; - extensionName?: string; - bladeName?: string; - forwardLink?: string; -}; + recommendationName?: string; +} // @public export interface Recommendations { @@ -2102,8 +2022,6 @@ export type RecommendationsGetRuleDetailsByWebAppResponse = RecommendationRule; // @public export interface RecommendationsListHistoryForHostingEnvironmentNextOptionalParams extends coreClient.OperationOptions { - expiredOnly?: boolean; - filter?: string; } // @public @@ -2120,8 +2038,6 @@ export type RecommendationsListHistoryForHostingEnvironmentResponse = Recommenda // @public export interface RecommendationsListHistoryForWebAppNextOptionalParams extends coreClient.OperationOptions { - expiredOnly?: boolean; - filter?: string; } // @public @@ -2138,8 +2054,6 @@ export type RecommendationsListHistoryForWebAppResponse = RecommendationCollecti // @public export interface RecommendationsListNextOptionalParams extends coreClient.OperationOptions { - featured?: boolean; - filter?: string; } // @public @@ -2153,8 +2067,6 @@ export interface RecommendationsListOptionalParams extends coreClient.OperationO // @public export interface RecommendationsListRecommendedRulesForHostingEnvironmentNextOptionalParams extends coreClient.OperationOptions { - featured?: boolean; - filter?: string; } // @public @@ -2171,8 +2083,6 @@ export type RecommendationsListRecommendedRulesForHostingEnvironmentResponse = R // @public export interface RecommendationsListRecommendedRulesForWebAppNextOptionalParams extends coreClient.OperationOptions { - featured?: boolean; - filter?: string; } // @public @@ -2206,15 +2116,22 @@ export interface RecommendationsResetAllFiltersOptionalParams extends coreClient export type RedundancyMode = "None" | "Manual" | "Failover" | "ActiveActive" | "GeoRedundant"; // @public -export type RelayServiceConnectionEntity = ProxyOnlyResource & { - entityName?: string; - entityConnectionString?: string; - resourceType?: string; - resourceConnectionString?: string; - hostname?: string; - port?: number; +export interface RelayServiceConnectionEntity extends ProxyOnlyResource { + // (undocumented) biztalkUri?: string; -}; + // (undocumented) + entityConnectionString?: string; + // (undocumented) + entityName?: string; + // (undocumented) + hostname?: string; + // (undocumented) + port?: number; + // (undocumented) + resourceConnectionString?: string; + // (undocumented) + resourceType?: string; +} // @public export interface RequestsBasedTrigger { @@ -2266,15 +2183,15 @@ export interface ResourceMetricCollection { } // @public -export type ResourceMetricDefinition = ProxyOnlyResource & { - readonly unit?: string; - readonly primaryAggregationType?: string; +export interface ResourceMetricDefinition extends ProxyOnlyResource { readonly metricAvailabilities?: ResourceMetricAvailability[]; - readonly resourceUri?: string; + readonly primaryAggregationType?: string; readonly properties?: { [propertyName: string]: string; }; -}; + readonly resourceUri?: string; + readonly unit?: string; +} // @public export interface ResourceMetricDefinitionCollection { @@ -2323,19 +2240,19 @@ export interface ResourceNameAvailabilityRequest { export type ResourceScopeType = string; // @public -export type RestoreRequest = ProxyOnlyResource & { - storageAccountUrl?: string; +export interface RestoreRequest extends ProxyOnlyResource { + adjustConnectionStrings?: boolean; + appServicePlan?: string; blobName?: string; - overwrite?: boolean; - siteName?: string; databases?: DatabaseBackupSetting[]; + hostingEnvironment?: string; ignoreConflictingHostNames?: boolean; ignoreDatabases?: boolean; - appServicePlan?: string; operationType?: BackupRestoreOperationType; - adjustConnectionStrings?: boolean; - hostingEnvironment?: string; -}; + overwrite?: boolean; + siteName?: string; + storageAccountUrl?: string; +} // @public export type RouteType = string; @@ -2352,75 +2269,75 @@ export interface ServiceSpecification { } // @public -export type Site = Resource & { - identity?: ManagedServiceIdentity; - readonly state?: string; - readonly hostNames?: string[]; - readonly repositorySiteName?: string; - readonly usageState?: UsageState; - enabled?: boolean; - readonly enabledHostNames?: string[]; +export interface Site extends Resource { readonly availabilityState?: SiteAvailabilityState; - hostNameSslStates?: HostNameSslState[]; - serverFarmId?: string; - reserved?: boolean; - isXenon?: boolean; - hyperV?: boolean; - readonly lastModifiedTimeUtc?: Date; - siteConfig?: SiteConfig; - readonly trafficManagerHostNames?: string[]; - scmSiteAlsoStopped?: boolean; - readonly targetSwapSlot?: string; - hostingEnvironmentProfile?: HostingEnvironmentProfile; clientAffinityEnabled?: boolean; clientCertEnabled?: boolean; clientCertExclusionPaths?: string; - hostNamesDisabled?: boolean; - readonly outboundIpAddresses?: string; - readonly possibleOutboundIpAddresses?: string; + cloningInfo?: CloningInfo; containerSize?: number; dailyMemoryTimeQuota?: number; - readonly suspendedTill?: Date; - readonly maxNumberOfWorkers?: number; - cloningInfo?: CloningInfo; - readonly resourceGroup?: string; - readonly isDefaultContainer?: boolean; readonly defaultHostName?: string; - readonly slotSwapStatus?: SlotSwapStatus; - httpsOnly?: boolean; - redundancyMode?: RedundancyMode; - readonly inProgressOperationId?: string; + enabled?: boolean; + readonly enabledHostNames?: string[]; geoDistributions?: GeoDistribution[]; -}; + hostingEnvironmentProfile?: HostingEnvironmentProfile; + readonly hostNames?: string[]; + hostNamesDisabled?: boolean; + hostNameSslStates?: HostNameSslState[]; + httpsOnly?: boolean; + hyperV?: boolean; + identity?: ManagedServiceIdentity; + readonly inProgressOperationId?: string; + readonly isDefaultContainer?: boolean; + isXenon?: boolean; + readonly lastModifiedTimeUtc?: Date; + readonly maxNumberOfWorkers?: number; + readonly outboundIpAddresses?: string; + readonly possibleOutboundIpAddresses?: string; + redundancyMode?: RedundancyMode; + readonly repositorySiteName?: string; + reserved?: boolean; + readonly resourceGroup?: string; + scmSiteAlsoStopped?: boolean; + serverFarmId?: string; + siteConfig?: SiteConfig; + readonly slotSwapStatus?: SlotSwapStatus; + readonly state?: string; + readonly suspendedTill?: Date; + readonly targetSwapSlot?: string; + readonly trafficManagerHostNames?: string[]; + readonly usageState?: UsageState; +} // @public -export type SiteAuthSettings = ProxyOnlyResource & { - enabled?: boolean; - runtimeVersion?: string; - unauthenticatedClientAction?: UnauthenticatedClientAction; - tokenStoreEnabled?: boolean; +export interface SiteAuthSettings extends ProxyOnlyResource { + additionalLoginParams?: string[]; + allowedAudiences?: string[]; allowedExternalRedirectUrls?: string[]; - defaultProvider?: BuiltInAuthenticationProvider; - tokenRefreshExtensionHours?: number; clientId?: string; clientSecret?: string; clientSecretCertificateThumbprint?: string; - issuer?: string; - validateIssuer?: boolean; - allowedAudiences?: string[]; - additionalLoginParams?: string[]; - googleClientId?: string; - googleClientSecret?: string; - googleOAuthScopes?: string[]; + defaultProvider?: BuiltInAuthenticationProvider; + enabled?: boolean; facebookAppId?: string; facebookAppSecret?: string; facebookOAuthScopes?: string[]; - twitterConsumerKey?: string; - twitterConsumerSecret?: string; + googleClientId?: string; + googleClientSecret?: string; + googleOAuthScopes?: string[]; + issuer?: string; microsoftAccountClientId?: string; microsoftAccountClientSecret?: string; microsoftAccountOAuthScopes?: string[]; -}; + runtimeVersion?: string; + tokenRefreshExtensionHours?: number; + tokenStoreEnabled?: boolean; + twitterConsumerKey?: string; + twitterConsumerSecret?: string; + unauthenticatedClientAction?: UnauthenticatedClientAction; + validateIssuer?: boolean; +} // @public export type SiteAvailabilityState = "Normal" | "Limited" | "DisasterRecoveryMode"; @@ -2499,63 +2416,63 @@ export interface SiteConfig { } // @public -export type SiteConfigResource = ProxyOnlyResource & { - numberOfWorkers?: number; - defaultDocuments?: string[]; - netFrameworkVersion?: string; - phpVersion?: string; - pythonVersion?: string; - nodeVersion?: string; - linuxFxVersion?: string; - windowsFxVersion?: string; - requestTracingEnabled?: boolean; - requestTracingExpirationTime?: Date; - remoteDebuggingEnabled?: boolean; - remoteDebuggingVersion?: string; - httpLoggingEnabled?: boolean; - logsDirectorySizeLimit?: number; - detailedErrorLoggingEnabled?: boolean; - publishingUsername?: string; +export interface SiteConfigResource extends ProxyOnlyResource { + alwaysOn?: boolean; + apiDefinition?: ApiDefinitionInfo; + appCommandLine?: string; appSettings?: NameValuePair[]; + autoHealEnabled?: boolean; + autoHealRules?: AutoHealRules; + autoSwapSlotName?: string; azureStorageAccounts?: { [propertyName: string]: AzureStorageInfoValue; }; connectionStrings?: ConnStringInfo[]; - readonly machineKey?: SiteMachineKey; - handlerMappings?: HandlerMapping[]; + cors?: CorsSettings; + defaultDocuments?: string[]; + detailedErrorLoggingEnabled?: boolean; documentRoot?: string; - scmType?: ScmType; - use32BitWorkerProcess?: boolean; - webSocketsEnabled?: boolean; - alwaysOn?: boolean; - javaVersion?: string; + experiments?: Experiments; + ftpsState?: FtpsState; + handlerMappings?: HandlerMapping[]; + http20Enabled?: boolean; + httpLoggingEnabled?: boolean; + ipSecurityRestrictions?: IpSecurityRestriction[]; javaContainer?: string; javaContainerVersion?: string; - appCommandLine?: string; - managedPipelineMode?: ManagedPipelineMode; - virtualApplications?: VirtualApplication[]; - loadBalancing?: SiteLoadBalancing; - experiments?: Experiments; + javaVersion?: string; limits?: SiteLimits; - autoHealEnabled?: boolean; - autoHealRules?: AutoHealRules; - tracingOptions?: string; - vnetName?: string; - cors?: CorsSettings; - push?: PushSettings; - apiDefinition?: ApiDefinitionInfo; - autoSwapSlotName?: string; + linuxFxVersion?: string; + loadBalancing?: SiteLoadBalancing; localMySqlEnabled?: boolean; + logsDirectorySizeLimit?: number; + readonly machineKey?: SiteMachineKey; + managedPipelineMode?: ManagedPipelineMode; managedServiceIdentityId?: number; - xManagedServiceIdentityId?: number; - ipSecurityRestrictions?: IpSecurityRestriction[]; + minTlsVersion?: SupportedTlsVersions; + netFrameworkVersion?: string; + nodeVersion?: string; + numberOfWorkers?: number; + phpVersion?: string; + publishingUsername?: string; + push?: PushSettings; + pythonVersion?: string; + remoteDebuggingEnabled?: boolean; + remoteDebuggingVersion?: string; + requestTracingEnabled?: boolean; + requestTracingExpirationTime?: Date; + reservedInstanceCount?: number; scmIpSecurityRestrictions?: IpSecurityRestriction[]; scmIpSecurityRestrictionsUseMain?: boolean; - http20Enabled?: boolean; - minTlsVersion?: SupportedTlsVersions; - ftpsState?: FtpsState; - reservedInstanceCount?: number; -}; + scmType?: ScmType; + tracingOptions?: string; + use32BitWorkerProcess?: boolean; + virtualApplications?: VirtualApplication[]; + vnetName?: string; + webSocketsEnabled?: boolean; + windowsFxVersion?: string; + xManagedServiceIdentityId?: number; +} // @public export interface SiteConfigResourceCollection { @@ -2564,10 +2481,10 @@ export interface SiteConfigResourceCollection { } // @public -export type SiteConfigurationSnapshotInfo = ProxyOnlyResource & { - readonly time?: Date; +export interface SiteConfigurationSnapshotInfo extends ProxyOnlyResource { readonly snapshotId?: number; -}; + readonly time?: Date; +} // @public export interface SiteConfigurationSnapshotInfoCollection { @@ -2576,28 +2493,29 @@ export interface SiteConfigurationSnapshotInfoCollection { } // @public -export type SiteExtensionInfo = ProxyOnlyResource & { - extensionId?: string; - title?: string; - extensionType?: SiteExtensionType; - summary?: string; - description?: string; - version?: string; - extensionUrl?: string; - projectUrl?: string; - iconUrl?: string; - licenseUrl?: string; - feedUrl?: string; +export interface SiteExtensionInfo extends ProxyOnlyResource { authors?: string[]; - installerCommandLineParams?: string; - publishedDateTime?: Date; + comment?: string; + description?: string; downloadCount?: number; + extensionId?: string; + extensionType?: SiteExtensionType; + extensionUrl?: string; + feedUrl?: string; + iconUrl?: string; + installedDateTime?: Date; + installerCommandLineParams?: string; + licenseUrl?: string; localIsLatestVersion?: boolean; localPath?: string; - installedDateTime?: Date; + projectUrl?: string; provisioningState?: string; - comment?: string; -}; + publishedDateTime?: Date; + summary?: string; + // (undocumented) + title?: string; + version?: string; +} // @public export interface SiteExtensionInfoCollection { @@ -2609,9 +2527,9 @@ export interface SiteExtensionInfoCollection { export type SiteExtensionType = "Gallery" | "WebRoot"; // @public -export type SiteInstance = ProxyOnlyResource & { +export interface SiteInstance extends ProxyOnlyResource { readonly siteInstanceName?: string; -}; +} // @public export interface SiteLimits { @@ -2624,12 +2542,12 @@ export interface SiteLimits { export type SiteLoadBalancing = "WeightedRoundRobin" | "LeastRequests" | "LeastResponseTime" | "WeightedTotalTraffic" | "RequestHash"; // @public -export type SiteLogsConfig = ProxyOnlyResource & { +export interface SiteLogsConfig extends ProxyOnlyResource { applicationLogs?: ApplicationLogsConfig; - httpLogs?: HttpLogsConfig; - failedRequestsTracing?: EnabledConfig; detailedErrorMessages?: EnabledConfig; -}; + failedRequestsTracing?: EnabledConfig; + httpLogs?: HttpLogsConfig; +} // @public export interface SiteMachineKey { @@ -2640,63 +2558,63 @@ export interface SiteMachineKey { } // @public -export type SitePatchResource = ProxyOnlyResource & { - identity?: ManagedServiceIdentity; - readonly state?: string; - readonly hostNames?: string[]; - readonly repositorySiteName?: string; - readonly usageState?: UsageState; - enabled?: boolean; - readonly enabledHostNames?: string[]; +export interface SitePatchResource extends ProxyOnlyResource { readonly availabilityState?: SiteAvailabilityState; - hostNameSslStates?: HostNameSslState[]; - serverFarmId?: string; - reserved?: boolean; - isXenon?: boolean; - hyperV?: boolean; - readonly lastModifiedTimeUtc?: Date; - siteConfig?: SiteConfig; - readonly trafficManagerHostNames?: string[]; - scmSiteAlsoStopped?: boolean; - readonly targetSwapSlot?: string; - hostingEnvironmentProfile?: HostingEnvironmentProfile; clientAffinityEnabled?: boolean; clientCertEnabled?: boolean; clientCertExclusionPaths?: string; - hostNamesDisabled?: boolean; - readonly outboundIpAddresses?: string; - readonly possibleOutboundIpAddresses?: string; + cloningInfo?: CloningInfo; containerSize?: number; dailyMemoryTimeQuota?: number; - readonly suspendedTill?: Date; - readonly maxNumberOfWorkers?: number; - cloningInfo?: CloningInfo; - readonly resourceGroup?: string; - readonly isDefaultContainer?: boolean; readonly defaultHostName?: string; - readonly slotSwapStatus?: SlotSwapStatus; - httpsOnly?: boolean; - redundancyMode?: RedundancyMode; - readonly inProgressOperationId?: string; + enabled?: boolean; + readonly enabledHostNames?: string[]; geoDistributions?: GeoDistribution[]; -}; + hostingEnvironmentProfile?: HostingEnvironmentProfile; + readonly hostNames?: string[]; + hostNamesDisabled?: boolean; + hostNameSslStates?: HostNameSslState[]; + httpsOnly?: boolean; + hyperV?: boolean; + identity?: ManagedServiceIdentity; + readonly inProgressOperationId?: string; + readonly isDefaultContainer?: boolean; + isXenon?: boolean; + readonly lastModifiedTimeUtc?: Date; + readonly maxNumberOfWorkers?: number; + readonly outboundIpAddresses?: string; + readonly possibleOutboundIpAddresses?: string; + redundancyMode?: RedundancyMode; + readonly repositorySiteName?: string; + reserved?: boolean; + readonly resourceGroup?: string; + scmSiteAlsoStopped?: boolean; + serverFarmId?: string; + siteConfig?: SiteConfig; + readonly slotSwapStatus?: SlotSwapStatus; + readonly state?: string; + readonly suspendedTill?: Date; + readonly targetSwapSlot?: string; + readonly trafficManagerHostNames?: string[]; + readonly usageState?: UsageState; +} // @public -export type SitePhpErrorLogFlag = ProxyOnlyResource & { +export interface SitePhpErrorLogFlag extends ProxyOnlyResource { localLogErrors?: string; - masterLogErrors?: string; localLogErrorsMaxLength?: string; + masterLogErrors?: string; masterLogErrorsMaxLength?: string; -}; +} // @public -export type SiteSourceControl = ProxyOnlyResource & { - repoUrl?: string; +export interface SiteSourceControl extends ProxyOnlyResource { branch?: string; - isManualIntegration?: boolean; deploymentRollbackEnabled?: boolean; + isManualIntegration?: boolean; isMercurial?: boolean; -}; + repoUrl?: string; +} // @public export interface SkuCapacity { @@ -2728,22 +2646,22 @@ export interface SkuInfos { export type SkuName = string; // @public -export type SlotConfigNamesResource = ProxyOnlyResource & { - connectionStringNames?: string[]; +export interface SlotConfigNamesResource extends ProxyOnlyResource { appSettingNames?: string[]; azureStorageConfigNames?: string[]; -}; + connectionStringNames?: string[]; +} // @public -export type SlotDifference = ProxyOnlyResource & { - readonly level?: string; - readonly settingType?: string; +export interface SlotDifference extends ProxyOnlyResource { + readonly description?: string; readonly diffRule?: string; + readonly level?: string; readonly settingName?: string; + readonly settingType?: string; readonly valueInCurrentSlot?: string; readonly valueInTargetSlot?: string; - readonly description?: string; -}; +} // @public export interface SlotDifferenceCollection { @@ -2766,9 +2684,9 @@ export interface SlowRequestsBasedTrigger { } // @public -export type Snapshot = ProxyOnlyResource & { +export interface Snapshot extends ProxyOnlyResource { readonly time?: string; -}; +} // @public export interface SnapshotCollection { @@ -2783,22 +2701,22 @@ export interface SnapshotRecoverySource { } // @public -export type SnapshotRestoreRequest = ProxyOnlyResource & { - snapshotTime?: string; - recoverySource?: SnapshotRecoverySource; +export interface SnapshotRestoreRequest extends ProxyOnlyResource { + ignoreConflictingHostNames?: boolean; overwrite?: boolean; recoverConfiguration?: boolean; - ignoreConflictingHostNames?: boolean; + recoverySource?: SnapshotRecoverySource; + snapshotTime?: string; useDRSecondary?: boolean; -}; +} // @public -export type SourceControl = ProxyOnlyResource & { +export interface SourceControl extends ProxyOnlyResource { + expirationTime?: Date; + refreshToken?: string; token?: string; tokenSecret?: string; - refreshToken?: string; - expirationTime?: Date; -}; +} // @public export interface SourceControlCollection { @@ -2854,38 +2772,38 @@ export interface StatusCodesBasedTrigger { export type StatusOptions = "Ready" | "Pending" | "Creating"; // @public -export type StorageMigrationOptions = ProxyOnlyResource & { +export interface StorageMigrationOptions extends ProxyOnlyResource { azurefilesConnectionString?: string; azurefilesShare?: string; - switchSiteAfterMigration?: boolean; blockWriteAccessToSite?: boolean; -}; + switchSiteAfterMigration?: boolean; +} // @public -export type StorageMigrationResponse = ProxyOnlyResource & { +export interface StorageMigrationResponse extends ProxyOnlyResource { readonly operationId?: string; -}; +} // @public -export type StringDictionary = ProxyOnlyResource & { +export interface StringDictionary extends ProxyOnlyResource { properties?: { [propertyName: string]: string; }; -}; +} // @public export type SupportedTlsVersions = string; // @public -export type SwiftVirtualNetwork = ProxyOnlyResource & { +export interface SwiftVirtualNetwork extends ProxyOnlyResource { subnetResourceId?: string; swiftSupported?: boolean; -}; +} // @public -export type TriggeredJobHistory = ProxyOnlyResource & { +export interface TriggeredJobHistory extends ProxyOnlyResource { runs?: TriggeredJobRun[]; -}; +} // @public export interface TriggeredJobHistoryCollection { @@ -2894,35 +2812,35 @@ export interface TriggeredJobHistoryCollection { } // @public -export type TriggeredJobRun = ProxyOnlyResource & { +export interface TriggeredJobRun extends ProxyOnlyResource { + duration?: string; + endTime?: Date; + errorUrl?: string; + jobName?: string; + outputUrl?: string; + startTime?: Date; + status?: TriggeredWebJobStatus; + trigger?: string; + url?: string; webJobId?: string; webJobName?: string; - status?: TriggeredWebJobStatus; - startTime?: Date; - endTime?: Date; - duration?: string; - outputUrl?: string; - errorUrl?: string; - url?: string; - jobName?: string; - trigger?: string; -}; +} // @public -export type TriggeredWebJob = ProxyOnlyResource & { - latestRun?: TriggeredJobRun; - historyUrl?: string; - schedulerLogsUrl?: string; - runCommand?: string; - url?: string; - extraInfoUrl?: string; - webJobType?: WebJobType; +export interface TriggeredWebJob extends ProxyOnlyResource { error?: string; - usingSdk?: boolean; + extraInfoUrl?: string; + historyUrl?: string; + latestRun?: TriggeredJobRun; + runCommand?: string; + schedulerLogsUrl?: string; settings?: { [propertyName: string]: Record; }; -}; + url?: string; + usingSdk?: boolean; + webJobType?: WebJobType; +} // @public export interface TriggeredWebJobCollection { @@ -2954,13 +2872,13 @@ export type UpdateSourceControlResponse = SourceControl; export type UsageState = "Normal" | "Exceeded"; // @public -export type User = ProxyOnlyResource & { - publishingUserName?: string; +export interface User extends ProxyOnlyResource { publishingPassword?: string; publishingPasswordHash?: string; publishingPasswordHashSalt?: string; + publishingUserName?: string; scmUri?: string; -}; +} // @public export interface ValidateContainerSettingsOptionalParams extends coreClient.OperationOptions { @@ -3057,47 +2975,47 @@ export interface VirtualNetworkProfile { } // @public -export type VnetGateway = ProxyOnlyResource & { +export interface VnetGateway extends ProxyOnlyResource { vnetName?: string; vpnPackageUri?: string; -}; +} // @public -export type VnetInfo = ProxyOnlyResource & { - vnetResourceId?: string; - readonly certThumbprint?: string; +export interface VnetInfo extends ProxyOnlyResource { certBlob?: string; - readonly routes?: VnetRoute[]; - readonly resyncRequired?: boolean; + readonly certThumbprint?: string; dnsServers?: string; isSwift?: boolean; -}; + readonly resyncRequired?: boolean; + readonly routes?: VnetRoute[]; + vnetResourceId?: string; +} // @public -export type VnetParameters = ProxyOnlyResource & { - vnetResourceGroup?: string; +export interface VnetParameters extends ProxyOnlyResource { vnetName?: string; + vnetResourceGroup?: string; vnetSubnetName?: string; -}; +} // @public -export type VnetRoute = ProxyOnlyResource & { - startAddress?: string; +export interface VnetRoute extends ProxyOnlyResource { endAddress?: string; routeType?: RouteType; -}; + startAddress?: string; +} // @public -export type VnetValidationFailureDetails = ProxyOnlyResource & { +export interface VnetValidationFailureDetails extends ProxyOnlyResource { failed?: boolean; failedTests?: VnetValidationTestFailure[]; -}; +} // @public -export type VnetValidationTestFailure = ProxyOnlyResource & { - testName?: string; +export interface VnetValidationTestFailure extends ProxyOnlyResource { details?: string; -}; + testName?: string; +} // @public export interface WebAppCollection { @@ -4790,7 +4708,6 @@ export type WebAppsListBackupStatusSecretsSlotResponse = BackupItem; // @public export interface WebAppsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { - includeSlots?: boolean; } // @public @@ -5254,8 +5171,6 @@ export type WebAppsListMetricDefinitionsSlotResponse = ResourceMetricDefinitionC // @public export interface WebAppsListMetricsNextOptionalParams extends coreClient.OperationOptions { - details?: boolean; - filter?: string; } // @public @@ -5272,8 +5187,6 @@ export type WebAppsListMetricsResponse = ResourceMetricCollection; // @public export interface WebAppsListMetricsSlotNextOptionalParams extends coreClient.OperationOptions { - details?: boolean; - filter?: string; } // @public @@ -5315,7 +5228,6 @@ export interface WebAppsListOptionalParams extends coreClient.OperationOptions { // @public export interface WebAppsListPerfMonCountersNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -5331,7 +5243,6 @@ export type WebAppsListPerfMonCountersResponse = PerfMonCounterCollection; // @public export interface WebAppsListPerfMonCountersSlotNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -5753,7 +5664,6 @@ export type WebAppsListTriggeredWebJobsSlotResponse = TriggeredWebJobCollection; // @public export interface WebAppsListUsagesNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -5769,7 +5679,6 @@ export type WebAppsListUsagesResponse = CsmUsageQuotaCollection; // @public export interface WebAppsListUsagesSlotNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -6357,17 +6266,17 @@ export interface WebAppsUpdateVnetConnectionSlotOptionalParams extends coreClien export type WebAppsUpdateVnetConnectionSlotResponse = VnetInfo; // @public -export type WebJob = ProxyOnlyResource & { - runCommand?: string; - url?: string; - extraInfoUrl?: string; - webJobType?: WebJobType; +export interface WebJob extends ProxyOnlyResource { error?: string; - usingSdk?: boolean; + extraInfoUrl?: string; + runCommand?: string; settings?: { [propertyName: string]: Record; }; -}; + url?: string; + usingSdk?: boolean; + webJobType?: WebJobType; +} // @public export interface WebJobCollection { diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/sample.env b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/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/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansCreateOrUpdateSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansCreateOrUpdateSample.ts new file mode 100644 index 00000000000..bb410e96481 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansCreateOrUpdateSample.ts @@ -0,0 +1,56 @@ +/* + * 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 { + AppServicePlan, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an App Service Plan. + * + * @summary Creates or updates an App Service Plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateAppServicePlan.json + */ +async function createOrUpdateAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const appServicePlan: AppServicePlan = { + name: "testsf6141", + type: "Microsoft.Web/serverfarms", + id: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/testsf6141", + kind: "app", + location: "East US", + sku: { name: "P1", capacity: 1, family: "P", size: "P1", tier: "Premium" } + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.beginCreateOrUpdateAndWait( + resourceGroupName, + name, + appServicePlan + ); + console.log(result); +} + +async function main() { + createOrUpdateAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansDeleteSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansDeleteSample.ts new file mode 100644 index 00000000000..53364c8d8f0 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansDeleteSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete an App Service plan. + * + * @summary Delete an App Service plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteAppServicePlan.json + */ +async function deleteAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.delete(resourceGroupName, name); + console.log(result); +} + +async function main() { + deleteAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansGetSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansGetSample.ts new file mode 100644 index 00000000000..ead79b5faf4 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansGetSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get an App Service plan. + * + * @summary Get an App Service plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetAppServicePlan.json + */ +async function getAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.get(resourceGroupName, name); + console.log(result); +} + +async function main() { + getAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansListByResourceGroupSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansListByResourceGroupSample.ts new file mode 100644 index 00000000000..07ef30eb771 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansListByResourceGroupSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all App Service plans in a resource group. + * + * @summary Get all App Service plans in a resource group. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlansByResourceGroup.json + */ +async function listAppServicePlansByResourceGroup() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.appServicePlans.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAppServicePlansByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansListSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansListSample.ts new file mode 100644 index 00000000000..7e863003a35 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansListSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all App Service plans for a subscription. + * + * @summary Get all App Service plans for a subscription. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlans.json + */ +async function listAppServicePlans() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.appServicePlans.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAppServicePlans(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansUpdateSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansUpdateSample.ts new file mode 100644 index 00000000000..16d61c5c7c4 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/appServicePlansUpdateSample.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 { + AppServicePlanPatchResource, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an App Service Plan. + * + * @summary Creates or updates an App Service Plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchAppServicePlan.json + */ +async function patchServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const appServicePlan: AppServicePlanPatchResource = { + name: "testsf6141", + type: "Microsoft.Web/serverfarms", + id: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/testsf6141", + kind: "app" + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.update( + resourceGroupName, + name, + appServicePlan + ); + console.log(result); +} + +async function main() { + patchServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesCreateOrUpdateSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesCreateOrUpdateSample.ts new file mode 100644 index 00000000000..864bb5655ab --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesCreateOrUpdateSample.ts @@ -0,0 +1,62 @@ +/* + * 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 { + Certificate, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a certificate. + * + * @summary Create or update a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateCertificate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const certificateEnvelope: Certificate = { + name: "testc6282", + type: "Microsoft.Web/certificates", + expirationDate: new Date("2039-12-31T23:59:59+00:00"), + friendlyName: "", + hostNames: ["ServerCert"], + id: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/certificates/testc6282", + issueDate: new Date("2015-11-12T23:40:25+00:00"), + issuer: "CACert", + location: "East US", + password: "", + subjectName: "ServerCert", + thumbprint: "FE703D7411A44163B6D32B3AD9B03E175886EBFE" + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate( + resourceGroupName, + name, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesDeleteSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesDeleteSample.ts new file mode 100644 index 00000000000..f82c8024d3d --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesDeleteSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a certificate. + * + * @summary Delete a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteCertificate.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.delete(resourceGroupName, name); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesGetSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesGetSample.ts new file mode 100644 index 00000000000..e2a0fa1a928 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesGetSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a certificate. + * + * @summary Get a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetCertificate.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.get(resourceGroupName, name); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesListByResourceGroupSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesListByResourceGroupSample.ts new file mode 100644 index 00000000000..9fbe7ffec2c --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesListByResourceGroupSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all certificates in a resource group. + * + * @summary Get all certificates in a resource group. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificatesByResourceGroup.json + */ +async function listCertificatesByResourceGroup() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificates.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesListSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesListSample.ts new file mode 100644 index 00000000000..97c632a1e4c --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesListSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all certificates for a subscription. + * + * @summary Get all certificates for a subscription. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificates.json + */ +async function listCertificatesForSubscription() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificates.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesForSubscription(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesUpdateSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesUpdateSample.ts new file mode 100644 index 00000000000..54d5dd66037 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/certificatesUpdateSample.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 { + CertificatePatchResource, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a certificate. + * + * @summary Create or update a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchCertificate.json + */ +async function patchCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const certificateEnvelope: CertificatePatchResource = { + name: "testc6282", + type: "Microsoft.Web/certificates", + id: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/certificates/testc6282", + password: "" + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.update( + resourceGroupName, + name, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + patchCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/providerListOperationsSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/providerListOperationsSample.ts new file mode 100644 index 00000000000..6ee5682a612 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/providerListOperationsSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions + * + * @summary Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListOperations.json + */ +async function listOperations() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.provider.listOperations()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperations(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/verifyHostingEnvironmentVnetSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/verifyHostingEnvironmentVnetSample.ts new file mode 100644 index 00000000000..2c46f3b8911 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/verifyHostingEnvironmentVnetSample.ts @@ -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. +import { + VnetParameters, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + * + * @summary Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/VerifyHostingEnvironmentVnet.json + */ +async function verifyHostingEnvironmentVnet() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const parameters: VnetParameters = { + vnetName: "vNet123", + vnetResourceGroup: "vNet123rg", + vnetSubnetName: "vNet123SubNet" + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.verifyHostingEnvironmentVnet(parameters); + console.log(result); +} + +async function main() { + verifyHostingEnvironmentVnet(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSample.ts new file mode 100644 index 00000000000..8bd6144defa --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperation( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSlotSample.ts new file mode 100644 index 00000000000..a85be0c30e2 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSlotSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationSlot( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSlotV2Sample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSlotV2Sample.ts new file mode 100644 index 00000000000..7a89ee826a0 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationSlotV2Sample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationSlotV2( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationV2Sample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationV2Sample.ts new file mode 100644 index 00000000000..5de49416f25 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTraceOperationV2Sample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationV2( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSample.ts new file mode 100644 index 00000000000..7a1560c4767 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraces( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSlotSample.ts new file mode 100644 index 00000000000..b706a3bb316 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSlotSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesSlot( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSlotV2Sample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSlotV2Sample.ts new file mode 100644 index 00000000000..90ac1541d72 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesSlotV2Sample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesSlotV2( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesV2Sample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesV2Sample.ts new file mode 100644 index 00000000000..31ac3a0ce0c --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsGetNetworkTracesV2Sample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesV2( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartNetworkTraceSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartNetworkTraceSample.ts new file mode 100644 index 00000000000..4e1e1623475 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartNetworkTraceSample.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 { + WebAppsStartNetworkTraceOptionalParams, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const options: WebAppsStartNetworkTraceOptionalParams = { durationInSeconds }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartNetworkTraceAndWait( + resourceGroupName, + name, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartNetworkTraceSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartNetworkTraceSlotSample.ts new file mode 100644 index 00000000000..e4171c56694 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartNetworkTraceSlotSample.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 { + WebAppsStartNetworkTraceSlotOptionalParams, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const slot = "Production"; + const options: WebAppsStartNetworkTraceSlotOptionalParams = { + durationInSeconds + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartNetworkTraceSlotAndWait( + resourceGroupName, + name, + slot, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartWebSiteNetworkTraceOperationSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartWebSiteNetworkTraceOperationSample.ts new file mode 100644 index 00000000000..96666d57857 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartWebSiteNetworkTraceOperationSample.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 { + WebAppsStartWebSiteNetworkTraceOperationOptionalParams, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const options: WebAppsStartWebSiteNetworkTraceOperationOptionalParams = { + durationInSeconds + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartWebSiteNetworkTraceOperationAndWait( + resourceGroupName, + name, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartWebSiteNetworkTraceOperationSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartWebSiteNetworkTraceOperationSlotSample.ts new file mode 100644 index 00000000000..277aa98fc2d --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStartWebSiteNetworkTraceOperationSlotSample.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 { + WebAppsStartWebSiteNetworkTraceOperationSlotOptionalParams, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const slot = "Production"; + const options: WebAppsStartWebSiteNetworkTraceOperationSlotOptionalParams = { + durationInSeconds + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartWebSiteNetworkTraceOperationSlotAndWait( + resourceGroupName, + name, + slot, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopNetworkTraceSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopNetworkTraceSample.ts new file mode 100644 index 00000000000..4ea2670f81e --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopNetworkTraceSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopNetworkTrace(resourceGroupName, name); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopNetworkTraceSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopNetworkTraceSlotSample.ts new file mode 100644 index 00000000000..3a1ebe31925 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopNetworkTraceSlotSample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopNetworkTraceSlot( + resourceGroupName, + name, + slot + ); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopWebSiteNetworkTraceSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopWebSiteNetworkTraceSample.ts new file mode 100644 index 00000000000..90b78bf7abe --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopWebSiteNetworkTraceSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopWebSiteNetworkTrace( + resourceGroupName, + name + ); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopWebSiteNetworkTraceSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopWebSiteNetworkTraceSlotSample.ts new file mode 100644 index 00000000000..13d323bbd40 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples-dev/webAppsStopWebSiteNetworkTraceSlotSample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopWebSiteNetworkTraceSlot( + resourceGroupName, + name, + slot + ); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/README.md b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/README.md new file mode 100644 index 00000000000..ac1f679a19b --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/README.md @@ -0,0 +1,108 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [appServicePlansCreateOrUpdateSample.js][appserviceplanscreateorupdatesample] | Creates or updates an App Service Plan. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateAppServicePlan.json | +| [appServicePlansDeleteSample.js][appserviceplansdeletesample] | Delete an App Service plan. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteAppServicePlan.json | +| [appServicePlansGetSample.js][appserviceplansgetsample] | Get an App Service plan. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetAppServicePlan.json | +| [appServicePlansListByResourceGroupSample.js][appserviceplanslistbyresourcegroupsample] | Get all App Service plans in a resource group. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlansByResourceGroup.json | +| [appServicePlansListSample.js][appserviceplanslistsample] | Get all App Service plans for a subscription. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlans.json | +| [appServicePlansUpdateSample.js][appserviceplansupdatesample] | Creates or updates an App Service Plan. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchAppServicePlan.json | +| [certificatesCreateOrUpdateSample.js][certificatescreateorupdatesample] | Create or update a certificate. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateCertificate.json | +| [certificatesDeleteSample.js][certificatesdeletesample] | Delete a certificate. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteCertificate.json | +| [certificatesGetSample.js][certificatesgetsample] | Get a certificate. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetCertificate.json | +| [certificatesListByResourceGroupSample.js][certificateslistbyresourcegroupsample] | Get all certificates in a resource group. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificatesByResourceGroup.json | +| [certificatesListSample.js][certificateslistsample] | Get all certificates for a subscription. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificates.json | +| [certificatesUpdateSample.js][certificatesupdatesample] | Create or update a certificate. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchCertificate.json | +| [providerListOperationsSample.js][providerlistoperationssample] | Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListOperations.json | +| [verifyHostingEnvironmentVnetSample.js][verifyhostingenvironmentvnetsample] | Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/VerifyHostingEnvironmentVnet.json | +| [webAppsGetNetworkTraceOperationSample.js][webappsgetnetworktraceoperationsample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json | +| [webAppsGetNetworkTraceOperationSlotSample.js][webappsgetnetworktraceoperationslotsample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json | +| [webAppsGetNetworkTraceOperationSlotV2Sample.js][webappsgetnetworktraceoperationslotv2sample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json | +| [webAppsGetNetworkTraceOperationV2Sample.js][webappsgetnetworktraceoperationv2sample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json | +| [webAppsGetNetworkTracesSample.js][webappsgetnetworktracessample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json | +| [webAppsGetNetworkTracesSlotSample.js][webappsgetnetworktracesslotsample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json | +| [webAppsGetNetworkTracesSlotV2Sample.js][webappsgetnetworktracesslotv2sample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json | +| [webAppsGetNetworkTracesV2Sample.js][webappsgetnetworktracesv2sample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json | +| [webAppsStartNetworkTraceSample.js][webappsstartnetworktracesample] | Start capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json | +| [webAppsStartNetworkTraceSlotSample.js][webappsstartnetworktraceslotsample] | Start capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json | +| [webAppsStartWebSiteNetworkTraceOperationSample.js][webappsstartwebsitenetworktraceoperationsample] | Start capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json | +| [webAppsStartWebSiteNetworkTraceOperationSlotSample.js][webappsstartwebsitenetworktraceoperationslotsample] | Start capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json | +| [webAppsStopNetworkTraceSample.js][webappsstopnetworktracesample] | Stop ongoing capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json | +| [webAppsStopNetworkTraceSlotSample.js][webappsstopnetworktraceslotsample] | Stop ongoing capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json | +| [webAppsStopWebSiteNetworkTraceSample.js][webappsstopwebsitenetworktracesample] | Stop ongoing capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json | +| [webAppsStopWebSiteNetworkTraceSlotSample.js][webappsstopwebsitenetworktraceslotsample] | Stop ongoing capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.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 appServicePlansCreateOrUpdateSample.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 APPSERVICE_SUBSCRIPTION_ID="" APPSERVICE_RESOURCE_GROUP="" node appServicePlansCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[appserviceplanscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansCreateOrUpdateSample.js +[appserviceplansdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansDeleteSample.js +[appserviceplansgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansGetSample.js +[appserviceplanslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListByResourceGroupSample.js +[appserviceplanslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListSample.js +[appserviceplansupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansUpdateSample.js +[certificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesCreateOrUpdateSample.js +[certificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesDeleteSample.js +[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesGetSample.js +[certificateslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListByResourceGroupSample.js +[certificateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListSample.js +[certificatesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesUpdateSample.js +[providerlistoperationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/providerListOperationsSample.js +[verifyhostingenvironmentvnetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/verifyHostingEnvironmentVnetSample.js +[webappsgetnetworktraceoperationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSample.js +[webappsgetnetworktraceoperationslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotSample.js +[webappsgetnetworktraceoperationslotv2sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotV2Sample.js +[webappsgetnetworktraceoperationv2sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationV2Sample.js +[webappsgetnetworktracessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSample.js +[webappsgetnetworktracesslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotSample.js +[webappsgetnetworktracesslotv2sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotV2Sample.js +[webappsgetnetworktracesv2sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesV2Sample.js +[webappsstartnetworktracesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSample.js +[webappsstartnetworktraceslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSlotSample.js +[webappsstartwebsitenetworktraceoperationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSample.js +[webappsstartwebsitenetworktraceoperationslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSlotSample.js +[webappsstopnetworktracesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSample.js +[webappsstopnetworktraceslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSlotSample.js +[webappsstopwebsitenetworktracesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSample.js +[webappsstopwebsitenetworktraceslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSlotSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-appservice-profile-2020-09-01-hybrid?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/README.md diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansCreateOrUpdateSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansCreateOrUpdateSample.js new file mode 100644 index 00000000000..bb6caef6ba2 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansCreateOrUpdateSample.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates an App Service Plan. + * + * @summary Creates or updates an App Service Plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateAppServicePlan.json + */ +async function createOrUpdateAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const appServicePlan = { + name: "testsf6141", + type: "Microsoft.Web/serverfarms", + id: "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/testsf6141", + kind: "app", + location: "East US", + sku: { name: "P1", capacity: 1, family: "P", size: "P1", tier: "Premium" }, + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.beginCreateOrUpdateAndWait( + resourceGroupName, + name, + appServicePlan + ); + console.log(result); +} + +async function main() { + createOrUpdateAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansDeleteSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansDeleteSample.js new file mode 100644 index 00000000000..55af50e0229 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansDeleteSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete an App Service plan. + * + * @summary Delete an App Service plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteAppServicePlan.json + */ +async function deleteAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.delete(resourceGroupName, name); + console.log(result); +} + +async function main() { + deleteAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansGetSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansGetSample.js new file mode 100644 index 00000000000..89a0de19c65 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansGetSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get an App Service plan. + * + * @summary Get an App Service plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetAppServicePlan.json + */ +async function getAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.get(resourceGroupName, name); + console.log(result); +} + +async function main() { + getAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListByResourceGroupSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListByResourceGroupSample.js new file mode 100644 index 00000000000..fc3c9eaa285 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListByResourceGroupSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all App Service plans in a resource group. + * + * @summary Get all App Service plans in a resource group. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlansByResourceGroup.json + */ +async function listAppServicePlansByResourceGroup() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.appServicePlans.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAppServicePlansByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListSample.js new file mode 100644 index 00000000000..5d96ec54fb8 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansListSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all App Service plans for a subscription. + * + * @summary Get all App Service plans for a subscription. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlans.json + */ +async function listAppServicePlans() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.appServicePlans.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAppServicePlans(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansUpdateSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansUpdateSample.js new file mode 100644 index 00000000000..eb1d026151d --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/appServicePlansUpdateSample.js @@ -0,0 +1,42 @@ +/* + * 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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates an App Service Plan. + * + * @summary Creates or updates an App Service Plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchAppServicePlan.json + */ +async function patchServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const appServicePlan = { + name: "testsf6141", + type: "Microsoft.Web/serverfarms", + id: "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/testsf6141", + kind: "app", + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.update(resourceGroupName, name, appServicePlan); + console.log(result); +} + +async function main() { + patchServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesCreateOrUpdateSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesCreateOrUpdateSample.js new file mode 100644 index 00000000000..e4c02a011c5 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesCreateOrUpdateSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a certificate. + * + * @summary Create or update a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateCertificate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const certificateEnvelope = { + name: "testc6282", + type: "Microsoft.Web/certificates", + expirationDate: new Date("2039-12-31T23:59:59+00:00"), + friendlyName: "", + hostNames: ["ServerCert"], + id: "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/certificates/testc6282", + issueDate: new Date("2015-11-12T23:40:25+00:00"), + issuer: "CACert", + location: "East US", + password: "", + subjectName: "ServerCert", + thumbprint: "FE703D7411A44163B6D32B3AD9B03E175886EBFE", + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate( + resourceGroupName, + name, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesDeleteSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesDeleteSample.js new file mode 100644 index 00000000000..e190cab227f --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesDeleteSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a certificate. + * + * @summary Delete a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteCertificate.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.delete(resourceGroupName, name); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesGetSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesGetSample.js new file mode 100644 index 00000000000..0caa8040155 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesGetSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a certificate. + * + * @summary Get a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetCertificate.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.get(resourceGroupName, name); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListByResourceGroupSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListByResourceGroupSample.js new file mode 100644 index 00000000000..f2f2c6926da --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListByResourceGroupSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all certificates in a resource group. + * + * @summary Get all certificates in a resource group. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificatesByResourceGroup.json + */ +async function listCertificatesByResourceGroup() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificates.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListSample.js new file mode 100644 index 00000000000..99b92cc6f11 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesListSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all certificates for a subscription. + * + * @summary Get all certificates for a subscription. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificates.json + */ +async function listCertificatesForSubscription() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificates.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesForSubscription(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesUpdateSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesUpdateSample.js new file mode 100644 index 00000000000..fc69e1ab234 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/certificatesUpdateSample.js @@ -0,0 +1,42 @@ +/* + * 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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a certificate. + * + * @summary Create or update a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchCertificate.json + */ +async function patchCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const certificateEnvelope = { + name: "testc6282", + type: "Microsoft.Web/certificates", + id: "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/certificates/testc6282", + password: "", + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.update(resourceGroupName, name, certificateEnvelope); + console.log(result); +} + +async function main() { + patchCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/package.json b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/package.json new file mode 100644 index 00000000000..079c30ec069 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-appservice-profile-2020-09-01-hybrid-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/appservice/arm-appservice-profile-2020-09-01-hybrid" + }, + "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/appservice/arm-appservice-profile-2020-09-01-hybrid", + "dependencies": { + "@azure/arm-appservice-profile-2020-09-01-hybrid": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/providerListOperationsSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/providerListOperationsSample.js new file mode 100644 index 00000000000..621e7a0830c --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/providerListOperationsSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions + * + * @summary Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListOperations.json + */ +async function listOperations() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.provider.listOperations()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperations(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/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/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/verifyHostingEnvironmentVnetSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/verifyHostingEnvironmentVnetSample.js new file mode 100644 index 00000000000..043633250f2 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/verifyHostingEnvironmentVnetSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + * + * @summary Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/VerifyHostingEnvironmentVnet.json + */ +async function verifyHostingEnvironmentVnet() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const parameters = { + vnetName: "vNet123", + vnetResourceGroup: "vNet123rg", + vnetSubnetName: "vNet123SubNet", + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.verifyHostingEnvironmentVnet(parameters); + console.log(result); +} + +async function main() { + verifyHostingEnvironmentVnet(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSample.js new file mode 100644 index 00000000000..750ed617cc4 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperation( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotSample.js new file mode 100644 index 00000000000..523bec7643d --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationSlot( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotV2Sample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotV2Sample.js new file mode 100644 index 00000000000..eed5c8f2d50 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationSlotV2Sample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationSlotV2( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationV2Sample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationV2Sample.js new file mode 100644 index 00000000000..fb315999f79 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTraceOperationV2Sample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationV2( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSample.js new file mode 100644 index 00000000000..e1638d758fa --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraces(resourceGroupName, name, operationId); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotSample.js new file mode 100644 index 00000000000..2e0824ce6af --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesSlot( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotV2Sample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotV2Sample.js new file mode 100644 index 00000000000..afe09746b5c --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesSlotV2Sample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesSlotV2( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesV2Sample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesV2Sample.js new file mode 100644 index 00000000000..0e45ee92f2a --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsGetNetworkTracesV2Sample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesV2(resourceGroupName, name, operationId); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSample.js new file mode 100644 index 00000000000..c8904c713d6 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSample.js @@ -0,0 +1,42 @@ +/* + * 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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const options = { durationInSeconds }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartNetworkTraceAndWait( + resourceGroupName, + name, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSlotSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSlotSample.js new file mode 100644 index 00000000000..bc0a38b3036 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartNetworkTraceSlotSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const slot = "Production"; + const options = { + durationInSeconds, + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartNetworkTraceSlotAndWait( + resourceGroupName, + name, + slot, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSample.js new file mode 100644 index 00000000000..4dd15958f59 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSample.js @@ -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. +const { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const options = { + durationInSeconds, + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartWebSiteNetworkTraceOperationAndWait( + resourceGroupName, + name, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSlotSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSlotSample.js new file mode 100644 index 00000000000..aa3fec182ea --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStartWebSiteNetworkTraceOperationSlotSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const slot = "Production"; + const options = { + durationInSeconds, + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartWebSiteNetworkTraceOperationSlotAndWait( + resourceGroupName, + name, + slot, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSample.js new file mode 100644 index 00000000000..3e1b876f6b7 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopNetworkTrace(resourceGroupName, name); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSlotSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSlotSample.js new file mode 100644 index 00000000000..185011ed150 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopNetworkTraceSlotSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopNetworkTraceSlot(resourceGroupName, name, slot); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSample.js new file mode 100644 index 00000000000..d66c4adfe87 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopWebSiteNetworkTrace(resourceGroupName, name); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSlotSample.js b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSlotSample.js new file mode 100644 index 00000000000..ab2abe44d76 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/javascript/webAppsStopWebSiteNetworkTraceSlotSample.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 { WebSiteManagementClient } = require("@azure/arm-appservice-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopWebSiteNetworkTraceSlot(resourceGroupName, name, slot); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/README.md b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/README.md new file mode 100644 index 00000000000..d1d132dabed --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/README.md @@ -0,0 +1,121 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [appServicePlansCreateOrUpdateSample.ts][appserviceplanscreateorupdatesample] | Creates or updates an App Service Plan. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateAppServicePlan.json | +| [appServicePlansDeleteSample.ts][appserviceplansdeletesample] | Delete an App Service plan. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteAppServicePlan.json | +| [appServicePlansGetSample.ts][appserviceplansgetsample] | Get an App Service plan. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetAppServicePlan.json | +| [appServicePlansListByResourceGroupSample.ts][appserviceplanslistbyresourcegroupsample] | Get all App Service plans in a resource group. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlansByResourceGroup.json | +| [appServicePlansListSample.ts][appserviceplanslistsample] | Get all App Service plans for a subscription. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlans.json | +| [appServicePlansUpdateSample.ts][appserviceplansupdatesample] | Creates or updates an App Service Plan. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchAppServicePlan.json | +| [certificatesCreateOrUpdateSample.ts][certificatescreateorupdatesample] | Create or update a certificate. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateCertificate.json | +| [certificatesDeleteSample.ts][certificatesdeletesample] | Delete a certificate. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteCertificate.json | +| [certificatesGetSample.ts][certificatesgetsample] | Get a certificate. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetCertificate.json | +| [certificatesListByResourceGroupSample.ts][certificateslistbyresourcegroupsample] | Get all certificates in a resource group. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificatesByResourceGroup.json | +| [certificatesListSample.ts][certificateslistsample] | Get all certificates for a subscription. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificates.json | +| [certificatesUpdateSample.ts][certificatesupdatesample] | Create or update a certificate. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchCertificate.json | +| [providerListOperationsSample.ts][providerlistoperationssample] | Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListOperations.json | +| [verifyHostingEnvironmentVnetSample.ts][verifyhostingenvironmentvnetsample] | Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/VerifyHostingEnvironmentVnet.json | +| [webAppsGetNetworkTraceOperationSample.ts][webappsgetnetworktraceoperationsample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json | +| [webAppsGetNetworkTraceOperationSlotSample.ts][webappsgetnetworktraceoperationslotsample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json | +| [webAppsGetNetworkTraceOperationSlotV2Sample.ts][webappsgetnetworktraceoperationslotv2sample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json | +| [webAppsGetNetworkTraceOperationV2Sample.ts][webappsgetnetworktraceoperationv2sample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json | +| [webAppsGetNetworkTracesSample.ts][webappsgetnetworktracessample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json | +| [webAppsGetNetworkTracesSlotSample.ts][webappsgetnetworktracesslotsample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json | +| [webAppsGetNetworkTracesSlotV2Sample.ts][webappsgetnetworktracesslotv2sample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json | +| [webAppsGetNetworkTracesV2Sample.ts][webappsgetnetworktracesv2sample] | Gets a named operation for a network trace capturing (or deployment slot, if specified). x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json | +| [webAppsStartNetworkTraceSample.ts][webappsstartnetworktracesample] | Start capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json | +| [webAppsStartNetworkTraceSlotSample.ts][webappsstartnetworktraceslotsample] | Start capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json | +| [webAppsStartWebSiteNetworkTraceOperationSample.ts][webappsstartwebsitenetworktraceoperationsample] | Start capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json | +| [webAppsStartWebSiteNetworkTraceOperationSlotSample.ts][webappsstartwebsitenetworktraceoperationslotsample] | Start capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json | +| [webAppsStopNetworkTraceSample.ts][webappsstopnetworktracesample] | Stop ongoing capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json | +| [webAppsStopNetworkTraceSlotSample.ts][webappsstopnetworktraceslotsample] | Stop ongoing capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json | +| [webAppsStopWebSiteNetworkTraceSample.ts][webappsstopwebsitenetworktracesample] | Stop ongoing capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json | +| [webAppsStopWebSiteNetworkTraceSlotSample.ts][webappsstopwebsitenetworktraceslotsample] | Stop ongoing capturing network packets for the site. x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.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/appServicePlansCreateOrUpdateSample.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 APPSERVICE_SUBSCRIPTION_ID="" APPSERVICE_RESOURCE_GROUP="" node dist/appServicePlansCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[appserviceplanscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansCreateOrUpdateSample.ts +[appserviceplansdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansDeleteSample.ts +[appserviceplansgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansGetSample.ts +[appserviceplanslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListByResourceGroupSample.ts +[appserviceplanslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListSample.ts +[appserviceplansupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansUpdateSample.ts +[certificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesCreateOrUpdateSample.ts +[certificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesDeleteSample.ts +[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesGetSample.ts +[certificateslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListByResourceGroupSample.ts +[certificateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListSample.ts +[certificatesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesUpdateSample.ts +[providerlistoperationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/providerListOperationsSample.ts +[verifyhostingenvironmentvnetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/verifyHostingEnvironmentVnetSample.ts +[webappsgetnetworktraceoperationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSample.ts +[webappsgetnetworktraceoperationslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotSample.ts +[webappsgetnetworktraceoperationslotv2sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotV2Sample.ts +[webappsgetnetworktraceoperationv2sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationV2Sample.ts +[webappsgetnetworktracessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSample.ts +[webappsgetnetworktracesslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotSample.ts +[webappsgetnetworktracesslotv2sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotV2Sample.ts +[webappsgetnetworktracesv2sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesV2Sample.ts +[webappsstartnetworktracesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSample.ts +[webappsstartnetworktraceslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSlotSample.ts +[webappsstartwebsitenetworktraceoperationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSample.ts +[webappsstartwebsitenetworktraceoperationslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSlotSample.ts +[webappsstopnetworktracesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSample.ts +[webappsstopnetworktraceslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSlotSample.ts +[webappsstopwebsitenetworktracesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSample.ts +[webappsstopwebsitenetworktraceslotsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSlotSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-appservice-profile-2020-09-01-hybrid?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/package.json b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/package.json new file mode 100644 index 00000000000..9d99bfec847 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-appservice-profile-2020-09-01-hybrid-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "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/appservice/arm-appservice-profile-2020-09-01-hybrid" + }, + "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/appservice/arm-appservice-profile-2020-09-01-hybrid", + "dependencies": { + "@azure/arm-appservice-profile-2020-09-01-hybrid": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~4.8.0", + "rimraf": "latest" + } +} diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/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/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansCreateOrUpdateSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansCreateOrUpdateSample.ts new file mode 100644 index 00000000000..bb410e96481 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansCreateOrUpdateSample.ts @@ -0,0 +1,56 @@ +/* + * 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 { + AppServicePlan, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an App Service Plan. + * + * @summary Creates or updates an App Service Plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateAppServicePlan.json + */ +async function createOrUpdateAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const appServicePlan: AppServicePlan = { + name: "testsf6141", + type: "Microsoft.Web/serverfarms", + id: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/testsf6141", + kind: "app", + location: "East US", + sku: { name: "P1", capacity: 1, family: "P", size: "P1", tier: "Premium" } + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.beginCreateOrUpdateAndWait( + resourceGroupName, + name, + appServicePlan + ); + console.log(result); +} + +async function main() { + createOrUpdateAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansDeleteSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansDeleteSample.ts new file mode 100644 index 00000000000..53364c8d8f0 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansDeleteSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete an App Service plan. + * + * @summary Delete an App Service plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteAppServicePlan.json + */ +async function deleteAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.delete(resourceGroupName, name); + console.log(result); +} + +async function main() { + deleteAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansGetSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansGetSample.ts new file mode 100644 index 00000000000..ead79b5faf4 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansGetSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get an App Service plan. + * + * @summary Get an App Service plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetAppServicePlan.json + */ +async function getAppServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.get(resourceGroupName, name); + console.log(result); +} + +async function main() { + getAppServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListByResourceGroupSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListByResourceGroupSample.ts new file mode 100644 index 00000000000..07ef30eb771 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListByResourceGroupSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all App Service plans in a resource group. + * + * @summary Get all App Service plans in a resource group. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlansByResourceGroup.json + */ +async function listAppServicePlansByResourceGroup() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.appServicePlans.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAppServicePlansByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListSample.ts new file mode 100644 index 00000000000..7e863003a35 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansListSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all App Service plans for a subscription. + * + * @summary Get all App Service plans for a subscription. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListAppServicePlans.json + */ +async function listAppServicePlans() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.appServicePlans.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAppServicePlans(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansUpdateSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansUpdateSample.ts new file mode 100644 index 00000000000..16d61c5c7c4 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/appServicePlansUpdateSample.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 { + AppServicePlanPatchResource, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an App Service Plan. + * + * @summary Creates or updates an App Service Plan. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchAppServicePlan.json + */ +async function patchServicePlan() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testsf6141"; + const appServicePlan: AppServicePlanPatchResource = { + name: "testsf6141", + type: "Microsoft.Web/serverfarms", + id: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/testsf6141", + kind: "app" + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.appServicePlans.update( + resourceGroupName, + name, + appServicePlan + ); + console.log(result); +} + +async function main() { + patchServicePlan(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesCreateOrUpdateSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesCreateOrUpdateSample.ts new file mode 100644 index 00000000000..864bb5655ab --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesCreateOrUpdateSample.ts @@ -0,0 +1,62 @@ +/* + * 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 { + Certificate, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a certificate. + * + * @summary Create or update a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/CreateOrUpdateCertificate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const certificateEnvelope: Certificate = { + name: "testc6282", + type: "Microsoft.Web/certificates", + expirationDate: new Date("2039-12-31T23:59:59+00:00"), + friendlyName: "", + hostNames: ["ServerCert"], + id: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/certificates/testc6282", + issueDate: new Date("2015-11-12T23:40:25+00:00"), + issuer: "CACert", + location: "East US", + password: "", + subjectName: "ServerCert", + thumbprint: "FE703D7411A44163B6D32B3AD9B03E175886EBFE" + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate( + resourceGroupName, + name, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesDeleteSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesDeleteSample.ts new file mode 100644 index 00000000000..f82c8024d3d --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesDeleteSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a certificate. + * + * @summary Delete a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/DeleteCertificate.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.delete(resourceGroupName, name); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesGetSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesGetSample.ts new file mode 100644 index 00000000000..e2a0fa1a928 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesGetSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a certificate. + * + * @summary Get a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetCertificate.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.get(resourceGroupName, name); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListByResourceGroupSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListByResourceGroupSample.ts new file mode 100644 index 00000000000..9fbe7ffec2c --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListByResourceGroupSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all certificates in a resource group. + * + * @summary Get all certificates in a resource group. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificatesByResourceGroup.json + */ +async function listCertificatesByResourceGroup() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificates.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListSample.ts new file mode 100644 index 00000000000..97c632a1e4c --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesListSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all certificates for a subscription. + * + * @summary Get all certificates for a subscription. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListCertificates.json + */ +async function listCertificatesForSubscription() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificates.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesForSubscription(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesUpdateSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesUpdateSample.ts new file mode 100644 index 00000000000..54d5dd66037 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/certificatesUpdateSample.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 { + CertificatePatchResource, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a certificate. + * + * @summary Create or update a certificate. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/PatchCertificate.json + */ +async function patchCertificate() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "testc6282"; + const certificateEnvelope: CertificatePatchResource = { + name: "testc6282", + type: "Microsoft.Web/certificates", + id: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/certificates/testc6282", + password: "" + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.certificates.update( + resourceGroupName, + name, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + patchCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/providerListOperationsSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/providerListOperationsSample.ts new file mode 100644 index 00000000000..6ee5682a612 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/providerListOperationsSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions + * + * @summary Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/ListOperations.json + */ +async function listOperations() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.provider.listOperations()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperations(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/verifyHostingEnvironmentVnetSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/verifyHostingEnvironmentVnetSample.ts new file mode 100644 index 00000000000..2c46f3b8911 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/verifyHostingEnvironmentVnetSample.ts @@ -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. +import { + VnetParameters, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + * + * @summary Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/VerifyHostingEnvironmentVnet.json + */ +async function verifyHostingEnvironmentVnet() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const parameters: VnetParameters = { + vnetName: "vNet123", + vnetResourceGroup: "vNet123rg", + vnetSubnetName: "vNet123SubNet" + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.verifyHostingEnvironmentVnet(parameters); + console.log(result); +} + +async function main() { + verifyHostingEnvironmentVnet(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSample.ts new file mode 100644 index 00000000000..8bd6144defa --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperation( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotSample.ts new file mode 100644 index 00000000000..a85be0c30e2 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationSlot( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotV2Sample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotV2Sample.ts new file mode 100644 index 00000000000..7a89ee826a0 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationSlotV2Sample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationSlotV2( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationV2Sample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationV2Sample.ts new file mode 100644 index 00000000000..5de49416f25 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTraceOperationV2Sample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraceOperation.json + */ +async function getTheCurrentStatusOfANetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraceOperationV2( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getTheCurrentStatusOfANetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSample.ts new file mode 100644 index 00000000000..7a1560c4767 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTraces( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotSample.ts new file mode 100644 index 00000000000..b706a3bb316 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesSlot( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotV2Sample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotV2Sample.ts new file mode 100644 index 00000000000..90ac1541d72 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesSlotV2Sample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesSlotV2( + resourceGroupName, + name, + operationId, + slot + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesV2Sample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesV2Sample.ts new file mode 100644 index 00000000000..31ac3a0ce0c --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsGetNetworkTracesV2Sample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a named operation for a network trace capturing (or deployment slot, if specified). + * + * @summary Gets a named operation for a network trace capturing (or deployment slot, if specified). + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/GetWebSiteNetworkTraces.json + */ +async function getNetworkTracesForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const operationId = "c291433b-53ad-4c49-8cae-0a293eae1c6d"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.getNetworkTracesV2( + resourceGroupName, + name, + operationId + ); + console.log(result); +} + +async function main() { + getNetworkTracesForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSample.ts new file mode 100644 index 00000000000..4e1e1623475 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSample.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 { + WebAppsStartNetworkTraceOptionalParams, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const options: WebAppsStartNetworkTraceOptionalParams = { durationInSeconds }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartNetworkTraceAndWait( + resourceGroupName, + name, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSlotSample.ts new file mode 100644 index 00000000000..e4171c56694 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartNetworkTraceSlotSample.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 { + WebAppsStartNetworkTraceSlotOptionalParams, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const slot = "Production"; + const options: WebAppsStartNetworkTraceSlotOptionalParams = { + durationInSeconds + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartNetworkTraceSlotAndWait( + resourceGroupName, + name, + slot, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSample.ts new file mode 100644 index 00000000000..96666d57857 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSample.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 { + WebAppsStartWebSiteNetworkTraceOperationOptionalParams, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const options: WebAppsStartWebSiteNetworkTraceOperationOptionalParams = { + durationInSeconds + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartWebSiteNetworkTraceOperationAndWait( + resourceGroupName, + name, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSlotSample.ts new file mode 100644 index 00000000000..277aa98fc2d --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStartWebSiteNetworkTraceOperationSlotSample.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 { + WebAppsStartWebSiteNetworkTraceOperationSlotOptionalParams, + WebSiteManagementClient +} from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start capturing network packets for the site. + * + * @summary Start capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StartWebSiteNetworkTraceOperation.json + */ +async function startANewNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const durationInSeconds = 60; + const slot = "Production"; + const options: WebAppsStartWebSiteNetworkTraceOperationSlotOptionalParams = { + durationInSeconds + }; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.beginStartWebSiteNetworkTraceOperationSlotAndWait( + resourceGroupName, + name, + slot, + options + ); + console.log(result); +} + +async function main() { + startANewNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSample.ts new file mode 100644 index 00000000000..4ea2670f81e --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopNetworkTrace(resourceGroupName, name); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSlotSample.ts new file mode 100644 index 00000000000..3a1ebe31925 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopNetworkTraceSlotSample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopNetworkTraceSlot( + resourceGroupName, + name, + slot + ); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSample.ts new file mode 100644 index 00000000000..90b78bf7abe --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSample.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 { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopWebSiteNetworkTrace( + resourceGroupName, + name + ); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSlotSample.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSlotSample.ts new file mode 100644 index 00000000000..13d323bbd40 --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/src/webAppsStopWebSiteNetworkTraceSlotSample.ts @@ -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. +import { WebSiteManagementClient } from "@azure/arm-appservice-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Stop ongoing capturing network packets for the site. + * + * @summary Stop ongoing capturing network packets for the site. + * x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2018-02-01/examples/StopWebSiteNetworkTrace.json + */ +async function stopACurrentlyRunningNetworkTraceOperationForASite() { + const subscriptionId = + process.env["APPSERVICE_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPSERVICE_RESOURCE_GROUP"] || "testrg123"; + const name = "SampleApp"; + const slot = "Production"; + const credential = new DefaultAzureCredential(); + const client = new WebSiteManagementClient(credential, subscriptionId); + const result = await client.webApps.stopWebSiteNetworkTraceSlot( + resourceGroupName, + name, + slot + ); + console.log(result); +} + +async function main() { + stopACurrentlyRunningNetworkTraceOperationForASite(); +} + +main().catch(console.error); diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json new file mode 100644 index 00000000000..e26ce2a6d8f --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/samples/v2/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/appservice/arm-appservice-profile-2020-09-01-hybrid/src/index.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/index.ts index 64dc74bf07d..87519daf296 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/index.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { WebSiteManagementClient } from "./webSiteManagementClient"; export * from "./operationsInterfaces"; diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/models/index.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/models/index.ts index 39087f2258f..a17f3528cb1 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/models/index.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/models/index.ts @@ -1977,7 +1977,7 @@ export interface RecommendationCollection { } /** SSL certificate for an app. */ -export type Certificate = Resource & { +export interface Certificate extends Resource { /** * Friendly name of the certificate. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2055,10 +2055,10 @@ export type Certificate = Resource & { readonly keyVaultSecretStatus?: KeyVaultSecretStatus; /** Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". */ serverFarmId?: string; -}; +} /** A web app, a mobile app backend, or an API app. */ -export type Site = Resource & { +export interface Site extends Resource { /** Managed service identity. */ identity?: ManagedServiceIdentity; /** @@ -2197,10 +2197,10 @@ export type Site = Resource & { readonly inProgressOperationId?: string; /** GeoDistributions for this site */ geoDistributions?: GeoDistribution[]; -}; +} /** Premier add-on. */ -export type PremierAddOn = Resource & { +export interface PremierAddOn extends Resource { /** Premier add on SKU. */ sku?: string; /** Premier add on Product. */ @@ -2211,10 +2211,10 @@ export type PremierAddOn = Resource & { marketplacePublisher?: string; /** Premier add on Marketplace offer. */ marketplaceOffer?: string; -}; +} /** App Service plan. */ -export type AppServicePlan = Resource & { +export interface AppServicePlan extends Resource { /** Description of a SKU for a scalable resource. */ sku?: SkuDescription; /** Target worker tier assigned to the App Service plan. */ @@ -2279,10 +2279,10 @@ export type AppServicePlan = Resource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningState?: ProvisioningState; -}; +} /** ARM resource for a certificate. */ -export type CertificatePatchResource = ProxyOnlyResource & { +export interface CertificatePatchResource extends ProxyOnlyResource { /** * Friendly name of the certificate. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2360,10 +2360,10 @@ export type CertificatePatchResource = ProxyOnlyResource & { readonly keyVaultSecretStatus?: KeyVaultSecretStatus; /** Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". */ serverFarmId?: string; -}; +} /** Push settings for the App. */ -export type PushSettings = ProxyOnlyResource & { +export interface PushSettings extends ProxyOnlyResource { /** Gets or sets a flag indicating whether the Push endpoint is enabled. */ isPushEnabled?: boolean; /** Gets or sets a JSON string containing a list of tags that are whitelisted for use by the push registration endpoint. */ @@ -2377,10 +2377,10 @@ export type PushSettings = ProxyOnlyResource & { tagsRequiringAuth?: string; /** Gets or sets a JSON string containing a list of dynamic tags that will be evaluated from user claims in the push registration endpoint. */ dynamicTagsJson?: string; -}; +} /** ARM resource for a site. */ -export type SitePatchResource = ProxyOnlyResource & { +export interface SitePatchResource extends ProxyOnlyResource { /** Managed service identity. */ identity?: ManagedServiceIdentity; /** @@ -2519,10 +2519,10 @@ export type SitePatchResource = ProxyOnlyResource & { readonly inProgressOperationId?: string; /** GeoDistributions for this site */ geoDistributions?: GeoDistribution[]; -}; +} /** Custom domain analysis. */ -export type CustomHostnameAnalysisResult = ProxyOnlyResource & { +export interface CustomHostnameAnalysisResult extends ProxyOnlyResource { /** * true if hostname is already verified; otherwise, false. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2563,10 +2563,10 @@ export type CustomHostnameAnalysisResult = ProxyOnlyResource & { alternateCNameRecords?: string[]; /** Alternate TXT records controller can see for this hostname. */ alternateTxtRecords?: string[]; -}; +} /** Description of a backup which will be performed. */ -export type BackupRequest = ProxyOnlyResource & { +export interface BackupRequest extends ProxyOnlyResource { /** Name of the backup. */ backupName?: string; /** True if the backup schedule is enabled (must be included in that case), false if the backup schedule should be disabled. */ @@ -2577,10 +2577,10 @@ export type BackupRequest = ProxyOnlyResource & { backupSchedule?: BackupSchedule; /** Databases included in the backup. */ databases?: DatabaseBackupSetting[]; -}; +} /** Backup description. */ -export type BackupItem = ProxyOnlyResource & { +export interface BackupItem extends ProxyOnlyResource { /** * Id of the backup. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2651,10 +2651,10 @@ export type BackupItem = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly websiteSizeInBytes?: number; -}; +} /** Description of a restore request. */ -export type RestoreRequest = ProxyOnlyResource & { +export interface RestoreRequest extends ProxyOnlyResource { /** SAS URL to the container. */ storageAccountUrl?: string; /** Name of a blob which contains the backup. */ @@ -2680,10 +2680,10 @@ export type RestoreRequest = ProxyOnlyResource & { adjustConnectionStrings?: boolean; /** App Service Environment name, if needed (only when restoring an app to an App Service Environment). */ hostingEnvironment?: string; -}; +} /** Web app configuration ARM resource. */ -export type SiteConfigResource = ProxyOnlyResource & { +export interface SiteConfigResource extends ProxyOnlyResource { /** Number of workers. */ numberOfWorkers?: number; /** Default documents. */ @@ -2796,16 +2796,16 @@ export type SiteConfigResource = ProxyOnlyResource & { * This setting only applies to the Consumption Plan */ reservedInstanceCount?: number; -}; +} /** String dictionary resource. */ -export type StringDictionary = ProxyOnlyResource & { +export interface StringDictionary extends ProxyOnlyResource { /** Settings. */ properties?: { [propertyName: string]: string }; -}; +} /** Configuration settings for the Azure App Service Authentication / Authorization feature. */ -export type SiteAuthSettings = ProxyOnlyResource & { +export interface SiteAuthSettings extends ProxyOnlyResource { /** true if the Authentication / Authorization feature is enabled for the current app; otherwise, false. */ enabled?: boolean; /** @@ -2942,22 +2942,23 @@ export type SiteAuthSettings = ProxyOnlyResource & { * Microsoft Account Scopes and permissions documentation: https://msdn.microsoft.com/en-us/library/dn631845.aspx */ microsoftAccountOAuthScopes?: string[]; -}; +} /** AzureStorageInfo dictionary resource. */ -export type AzureStoragePropertyDictionaryResource = ProxyOnlyResource & { +export interface AzureStoragePropertyDictionaryResource + extends ProxyOnlyResource { /** Azure storage accounts. */ properties?: { [propertyName: string]: AzureStorageInfoValue }; -}; +} /** String dictionary resource. */ -export type ConnectionStringDictionary = ProxyOnlyResource & { +export interface ConnectionStringDictionary extends ProxyOnlyResource { /** Connection strings. */ properties?: { [propertyName: string]: ConnStringValueTypePair }; -}; +} /** Configuration of App Service site logs. */ -export type SiteLogsConfig = ProxyOnlyResource & { +export interface SiteLogsConfig extends ProxyOnlyResource { /** Application logs configuration. */ applicationLogs?: ApplicationLogsConfig; /** HTTP logs configuration. */ @@ -2966,10 +2967,10 @@ export type SiteLogsConfig = ProxyOnlyResource & { failedRequestsTracing?: EnabledConfig; /** Detailed error messages configuration. */ detailedErrorMessages?: EnabledConfig; -}; +} /** User credentials used for publishing activity. */ -export type User = ProxyOnlyResource & { +export interface User extends ProxyOnlyResource { /** Username used for publishing. */ publishingUserName?: string; /** @@ -2989,20 +2990,20 @@ export type User = ProxyOnlyResource & { publishingPasswordHashSalt?: string; /** Url of SCM site. */ scmUri?: string; -}; +} /** Slot Config names azure resource. */ -export type SlotConfigNamesResource = ProxyOnlyResource & { +export interface SlotConfigNamesResource extends ProxyOnlyResource { /** List of connection string names. */ connectionStringNames?: string[]; /** List of application settings names. */ appSettingNames?: string[]; /** List of external Azure storage account identifiers. */ azureStorageConfigNames?: string[]; -}; +} /** A snapshot of a web app configuration. */ -export type SiteConfigurationSnapshotInfo = ProxyOnlyResource & { +export interface SiteConfigurationSnapshotInfo extends ProxyOnlyResource { /** * The time the snapshot was taken. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3013,10 +3014,10 @@ export type SiteConfigurationSnapshotInfo = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly snapshotId?: number; -}; +} /** Continuous Web Job Information. */ -export type ContinuousWebJob = ProxyOnlyResource & { +export interface ContinuousWebJob extends ProxyOnlyResource { /** Job status. */ status?: ContinuousWebJobStatus; /** Detailed status. */ @@ -3037,10 +3038,10 @@ export type ContinuousWebJob = ProxyOnlyResource & { usingSdk?: boolean; /** Job settings. */ settings?: { [propertyName: string]: Record }; -}; +} /** User credentials used for publishing activity. */ -export type Deployment = ProxyOnlyResource & { +export interface Deployment extends ProxyOnlyResource { /** Deployment status. */ status?: number; /** Details about deployment status. */ @@ -3059,16 +3060,16 @@ export type Deployment = ProxyOnlyResource & { active?: boolean; /** Details on deployment. */ details?: string; -}; +} /** A domain specific resource identifier. */ -export type Identifier = ProxyOnlyResource & { +export interface Identifier extends ProxyOnlyResource { /** String representation of the identity. */ idPropertiesId?: string; -}; +} /** MSDeploy ARM response */ -export type MSDeployStatus = ProxyOnlyResource & { +export interface MSDeployStatus extends ProxyOnlyResource { /** * Username of deployer * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3094,10 +3095,10 @@ export type MSDeployStatus = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly complete?: boolean; -}; +} /** MSDeploy ARM PUT information */ -export type MSDeploy = ProxyOnlyResource & { +export interface MSDeploy extends ProxyOnlyResource { /** Package URI */ packageUri?: string; /** SQL Connection String */ @@ -3120,19 +3121,19 @@ export type MSDeploy = ProxyOnlyResource & { * Setting is false by default. */ appOffline?: boolean; -}; +} /** MSDeploy log */ -export type MSDeployLog = ProxyOnlyResource & { +export interface MSDeployLog extends ProxyOnlyResource { /** * List of log entry messages * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly entries?: MSDeployLogEntry[]; -}; +} /** Function information. */ -export type FunctionEnvelope = ProxyOnlyResource & { +export interface FunctionEnvelope extends ProxyOnlyResource { /** Function App ID. */ functionAppId?: string; /** Script root path URI. */ @@ -3159,18 +3160,18 @@ export type FunctionEnvelope = ProxyOnlyResource & { language?: string; /** Value indicating whether the function is disabled */ isDisabled?: boolean; -}; +} /** Function secrets. */ -export type FunctionSecrets = ProxyOnlyResource & { +export interface FunctionSecrets extends ProxyOnlyResource { /** Secret key. */ key?: string; /** Trigger URL. */ triggerUrl?: string; -}; +} /** A hostname binding object. */ -export type HostNameBinding = ProxyOnlyResource & { +export interface HostNameBinding extends ProxyOnlyResource { /** App Service app name. */ siteName?: string; /** Fully qualified ARM domain resource URI. */ @@ -3192,10 +3193,10 @@ export type HostNameBinding = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly virtualIP?: string; -}; +} /** Hybrid Connection contract. This is used to configure a Hybrid Connection. */ -export type HybridConnection = ProxyOnlyResource & { +export interface HybridConnection extends ProxyOnlyResource { /** The name of the Service Bus namespace. */ serviceBusNamespace?: string; /** The name of the Service Bus relay. */ @@ -3215,10 +3216,10 @@ export type HybridConnection = ProxyOnlyResource & { sendKeyValue?: string; /** The suffix for the service bus endpoint. By default this is .servicebus.windows.net */ serviceBusSuffix?: string; -}; +} /** Hybrid Connection key contract. This has the send key name and value for a Hybrid Connection. */ -export type HybridConnectionKey = ProxyOnlyResource & { +export interface HybridConnectionKey extends ProxyOnlyResource { /** * The name of the send key. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3229,10 +3230,10 @@ export type HybridConnectionKey = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly sendKeyValue?: string; -}; +} /** Hybrid Connection for an App Service app. */ -export type RelayServiceConnectionEntity = ProxyOnlyResource & { +export interface RelayServiceConnectionEntity extends ProxyOnlyResource { entityName?: string; entityConnectionString?: string; resourceType?: string; @@ -3240,19 +3241,19 @@ export type RelayServiceConnectionEntity = ProxyOnlyResource & { hostname?: string; port?: number; biztalkUri?: string; -}; +} /** Instance of an app. */ -export type SiteInstance = ProxyOnlyResource & { +export interface SiteInstance extends ProxyOnlyResource { /** * Name of instance. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly siteInstanceName?: string; -}; +} /** Process Thread Information. */ -export type ProcessThreadInfo = ProxyOnlyResource & { +export interface ProcessThreadInfo extends ProxyOnlyResource { /** * Site extension ID. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3282,10 +3283,10 @@ export type ProcessThreadInfo = ProxyOnlyResource & { state?: string; /** Wait reason. */ waitReason?: string; -}; +} /** Process Module Information. */ -export type ProcessModuleInfo = ProxyOnlyResource & { +export interface ProcessModuleInfo extends ProxyOnlyResource { /** Base address. Used as module identifier in ARM resource URI. */ baseAddress?: string; /** File name. */ @@ -3308,10 +3309,10 @@ export type ProcessModuleInfo = ProxyOnlyResource & { isDebug?: boolean; /** Module language (locale). */ language?: string; -}; +} /** Process Information. */ -export type ProcessInfo = ProxyOnlyResource & { +export interface ProcessInfo extends ProxyOnlyResource { /** * ARM Identifier for deployment. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3387,10 +3388,10 @@ export type ProcessInfo = ProxyOnlyResource & { isWebjob?: boolean; /** Description of process. */ description?: string; -}; +} /** Metadata for the metrics. */ -export type ResourceMetricDefinition = ProxyOnlyResource & { +export interface ResourceMetricDefinition extends ProxyOnlyResource { /** * Unit of the metric. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3416,10 +3417,10 @@ export type ResourceMetricDefinition = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly properties?: { [propertyName: string]: string }; -}; +} /** Options for app content migration. */ -export type StorageMigrationOptions = ProxyOnlyResource & { +export interface StorageMigrationOptions extends ProxyOnlyResource { /** AzureFiles connection string. */ azurefilesConnectionString?: string; /** AzureFiles share. */ @@ -3428,27 +3429,27 @@ export type StorageMigrationOptions = ProxyOnlyResource & { switchSiteAfterMigration?: boolean; /** true if the app should be read only during copy operation; otherwise, false. */ blockWriteAccessToSite?: boolean; -}; +} /** Response for a migration of app content request. */ -export type StorageMigrationResponse = ProxyOnlyResource & { +export interface StorageMigrationResponse extends ProxyOnlyResource { /** * When server starts the migration process, it will return an operation ID identifying that particular migration operation. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly operationId?: string; -}; +} /** MySQL migration request. */ -export type MigrateMySqlRequest = ProxyOnlyResource & { +export interface MigrateMySqlRequest extends ProxyOnlyResource { /** Connection string to the remote MySQL database. */ connectionString?: string; /** The type of migration operation to be done */ migrationType?: MySqlMigrationType; -}; +} /** MySQL migration status. */ -export type MigrateMySqlStatus = ProxyOnlyResource & { +export interface MigrateMySqlStatus extends ProxyOnlyResource { /** * Status of the migration task. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3464,18 +3465,18 @@ export type MigrateMySqlStatus = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly localMySqlEnabled?: boolean; -}; +} /** Swift Virtual Network Contract. This is used to enable the new Swift way of doing virtual network integration. */ -export type SwiftVirtualNetwork = ProxyOnlyResource & { +export interface SwiftVirtualNetwork extends ProxyOnlyResource { /** The Virtual Network subnet's resource ID. This is the subnet that this Web App will join. This subnet must have a delegation to Microsoft.Web/serverFarms defined first. */ subnetResourceId?: string; /** A flag that specifies if the scale unit this Web App is on supports Swift integration. */ swiftSupported?: boolean; -}; +} /** Virtual Network route contract used to pass routing information for a Virtual Network. */ -export type VnetRoute = ProxyOnlyResource & { +export interface VnetRoute extends ProxyOnlyResource { /** The starting address for this route. This may also include a CIDR notation, in which case the end address must not be specified. */ startAddress?: string; /** The ending address for this route. If the start address is specified in CIDR notation, this must be omitted. */ @@ -3489,10 +3490,10 @@ export type VnetRoute = ProxyOnlyResource & { * These values will be used for syncing an app's routes with those from a Virtual Network. */ routeType?: RouteType; -}; +} /** Virtual Network information contract. */ -export type VnetInfo = ProxyOnlyResource & { +export interface VnetInfo extends ProxyOnlyResource { /** The Virtual Network's resource ID. */ vnetResourceId?: string; /** @@ -3519,10 +3520,10 @@ export type VnetInfo = ProxyOnlyResource & { dnsServers?: string; /** Flag that is used to denote if this is VNET injection */ isSwift?: boolean; -}; +} /** Full view of network features for an app (presently VNET integration and Hybrid Connections). */ -export type NetworkFeatures = ProxyOnlyResource & { +export interface NetworkFeatures extends ProxyOnlyResource { /** * The Virtual Network name. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3543,10 +3544,10 @@ export type NetworkFeatures = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly hybridConnectionsV2?: HybridConnection[]; -}; +} /** Used for getting PHP error logging flag. */ -export type SitePhpErrorLogFlag = ProxyOnlyResource & { +export interface SitePhpErrorLogFlag extends ProxyOnlyResource { /** Local log_errors setting. */ localLogErrors?: string; /** Master log_errors setting. */ @@ -3555,10 +3556,10 @@ export type SitePhpErrorLogFlag = ProxyOnlyResource & { localLogErrorsMaxLength?: string; /** Master log_errors_max_len setting. */ masterLogErrorsMaxLength?: string; -}; +} /** ARM resource for a PremierAddOn. */ -export type PremierAddOnPatchResource = ProxyOnlyResource & { +export interface PremierAddOnPatchResource extends ProxyOnlyResource { /** Premier add on SKU. */ sku?: string; /** Premier add on Product. */ @@ -3569,18 +3570,18 @@ export type PremierAddOnPatchResource = ProxyOnlyResource & { marketplacePublisher?: string; /** Premier add on Marketplace offer. */ marketplaceOffer?: string; -}; +} /** Description of the parameters of Private Access for a Web Site. */ -export type PrivateAccess = ProxyOnlyResource & { +export interface PrivateAccess extends ProxyOnlyResource { /** Whether private access is enabled or not. */ enabled?: boolean; /** The Virtual Networks (and subnets) allowed to access the site privately. */ virtualNetworks?: PrivateAccessVirtualNetwork[]; -}; +} /** Public certificate object */ -export type PublicCertificate = ProxyOnlyResource & { +export interface PublicCertificate extends ProxyOnlyResource { /** Public Certificate byte array */ blob?: Uint8Array; /** Public Certificate Location */ @@ -3590,10 +3591,10 @@ export type PublicCertificate = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly thumbprint?: string; -}; +} /** Details about restoring a deleted app. */ -export type DeletedAppRestoreRequest = ProxyOnlyResource & { +export interface DeletedAppRestoreRequest extends ProxyOnlyResource { /** * ARM resource ID of the deleted app. Example: * /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} @@ -3608,10 +3609,10 @@ export type DeletedAppRestoreRequest = ProxyOnlyResource & { snapshotTime?: string; /** If true, the snapshot is retrieved from DRSecondary endpoint. */ useDRSecondary?: boolean; -}; +} /** Details about app recovery operation. */ -export type SnapshotRestoreRequest = ProxyOnlyResource & { +export interface SnapshotRestoreRequest extends ProxyOnlyResource { /** Point in time in which the app restore should be done, formatted as a DateTime string. */ snapshotTime?: string; /** @@ -3630,10 +3631,10 @@ export type SnapshotRestoreRequest = ProxyOnlyResource & { ignoreConflictingHostNames?: boolean; /** If true, the snapshot is retrieved from DRSecondary endpoint. */ useDRSecondary?: boolean; -}; +} /** Site Extension Information. */ -export type SiteExtensionInfo = ProxyOnlyResource & { +export interface SiteExtensionInfo extends ProxyOnlyResource { /** Site extension ID. */ extensionId?: string; title?: string; @@ -3673,10 +3674,10 @@ export type SiteExtensionInfo = ProxyOnlyResource & { provisioningState?: string; /** Site Extension comment. */ comment?: string; -}; +} /** A setting difference between two deployment slots of an app. */ -export type SlotDifference = ProxyOnlyResource & { +export interface SlotDifference extends ProxyOnlyResource { /** * Level of the difference: Information, Warning or Error. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3712,19 +3713,19 @@ export type SlotDifference = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly description?: string; -}; +} /** A snapshot of an app. */ -export type Snapshot = ProxyOnlyResource & { +export interface Snapshot extends ProxyOnlyResource { /** * The time the snapshot was taken. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly time?: string; -}; +} /** Source control configuration for an app. */ -export type SiteSourceControl = ProxyOnlyResource & { +export interface SiteSourceControl extends ProxyOnlyResource { /** Repository or source control URL. */ repoUrl?: string; /** Name of branch to use for deployment. */ @@ -3735,10 +3736,10 @@ export type SiteSourceControl = ProxyOnlyResource & { deploymentRollbackEnabled?: boolean; /** true for a Mercurial repository; false for a Git repository. */ isMercurial?: boolean; -}; +} /** Triggered Web Job Run Information. */ -export type TriggeredJobRun = ProxyOnlyResource & { +export interface TriggeredJobRun extends ProxyOnlyResource { /** Job ID. */ webJobId?: string; /** Job name. */ @@ -3761,10 +3762,10 @@ export type TriggeredJobRun = ProxyOnlyResource & { jobName?: string; /** Job trigger. */ trigger?: string; -}; +} /** Triggered Web Job Information. */ -export type TriggeredWebJob = ProxyOnlyResource & { +export interface TriggeredWebJob extends ProxyOnlyResource { /** Latest job run information. */ latestRun?: TriggeredJobRun; /** History URL. */ @@ -3785,24 +3786,24 @@ export type TriggeredWebJob = ProxyOnlyResource & { usingSdk?: boolean; /** Job settings. */ settings?: { [propertyName: string]: Record }; -}; +} /** Triggered Web Job History. List of Triggered Web Job Run Information elements. */ -export type TriggeredJobHistory = ProxyOnlyResource & { +export interface TriggeredJobHistory extends ProxyOnlyResource { /** List of triggered web job runs. */ runs?: TriggeredJobRun[]; -}; +} /** The Virtual Network gateway contract. This is used to give the Virtual Network gateway access to the VPN package. */ -export type VnetGateway = ProxyOnlyResource & { +export interface VnetGateway extends ProxyOnlyResource { /** The Virtual Network name. */ vnetName?: string; /** The URI where the VPN package can be downloaded. */ vpnPackageUri?: string; -}; +} /** Web Job Information. */ -export type WebJob = ProxyOnlyResource & { +export interface WebJob extends ProxyOnlyResource { /** Run command. */ runCommand?: string; /** Job URL. */ @@ -3817,10 +3818,10 @@ export type WebJob = ProxyOnlyResource & { usingSdk?: boolean; /** Job settings. */ settings?: { [propertyName: string]: Record }; -}; +} /** The source control OAuth token. */ -export type SourceControl = ProxyOnlyResource & { +export interface SourceControl extends ProxyOnlyResource { /** OAuth access token. */ token?: string; /** OAuth access token secret. */ @@ -3829,10 +3830,10 @@ export type SourceControl = ProxyOnlyResource & { refreshToken?: string; /** OAuth token expiration. */ expirationTime?: Date; -}; +} /** App Service billing entity that contains information about meter which the Azure billing system utilizes to charge users for services. */ -export type BillingMeter = ProxyOnlyResource & { +export interface BillingMeter extends ProxyOnlyResource { /** Meter GUID onboarded in Commerce */ meterId?: string; /** Azure Location of billable resource */ @@ -3845,10 +3846,10 @@ export type BillingMeter = ProxyOnlyResource & { resourceType?: string; /** App Service OS type meter used for */ osType?: string; -}; +} /** Geographical region. */ -export type GeoRegion = ProxyOnlyResource & { +export interface GeoRegion extends ProxyOnlyResource { /** * Region description. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3859,10 +3860,10 @@ export type GeoRegion = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly displayName?: string; -}; +} /** Premier add-on offer. */ -export type PremierAddOnOffer = ProxyOnlyResource & { +export interface PremierAddOnOffer extends ProxyOnlyResource { /** Premier add on SKU. */ sku?: string; /** Premier add on offer Product. */ @@ -3883,36 +3884,36 @@ export type PremierAddOnOffer = ProxyOnlyResource & { marketplacePublisher?: string; /** Marketplace offer. */ marketplaceOffer?: string; -}; +} /** The required set of inputs to validate a VNET */ -export type VnetParameters = ProxyOnlyResource & { +export interface VnetParameters extends ProxyOnlyResource { /** The Resource Group of the VNET to be validated */ vnetResourceGroup?: string; /** The name of the VNET to be validated */ vnetName?: string; /** The subnet name to be validated */ vnetSubnetName?: string; -}; +} /** A class that describes a test that failed during NSG and UDR validation. */ -export type VnetValidationTestFailure = ProxyOnlyResource & { +export interface VnetValidationTestFailure extends ProxyOnlyResource { /** The name of the test that failed. */ testName?: string; /** The details of what caused the failure, e.g. the blocking rule name, etc. */ details?: string; -}; +} /** A class that describes the reason for a validation failure. */ -export type VnetValidationFailureDetails = ProxyOnlyResource & { +export interface VnetValidationFailureDetails extends ProxyOnlyResource { /** A flag describing whether or not validation failed. */ failed?: boolean; /** A list of tests that failed in the validation. */ failedTests?: VnetValidationTestFailure[]; -}; +} /** ARM resource for a app service plan. */ -export type AppServicePlanPatchResource = ProxyOnlyResource & { +export interface AppServicePlanPatchResource extends ProxyOnlyResource { /** Target worker tier assigned to the App Service plan. */ workerTierName?: string; /** @@ -3975,10 +3976,10 @@ export type AppServicePlanPatchResource = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningState?: ProvisioningState; -}; +} /** Hybrid Connection limits contract. This is used to return the plan limits of Hybrid Connections. */ -export type HybridConnectionLimits = ProxyOnlyResource & { +export interface HybridConnectionLimits extends ProxyOnlyResource { /** * The current number of Hybrid Connections. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3989,10 +3990,10 @@ export type HybridConnectionLimits = ProxyOnlyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly maximum?: number; -}; +} /** Represents a recommendation result generated by the recommendation engine. */ -export type Recommendation = ProxyOnlyResource & { +export interface Recommendation extends ProxyOnlyResource { /** Timestamp when this instance was created. */ creationTime?: Date; /** A GUID value that each recommendation object is associated with. */ @@ -4042,10 +4043,10 @@ export type Recommendation = ProxyOnlyResource & { bladeName?: string; /** Forward link to an external document associated with the rule. */ forwardLink?: string; -}; +} /** Represents a recommendation rule that the recommendation engine can perform. */ -export type RecommendationRule = ProxyOnlyResource & { +export interface RecommendationRule extends ProxyOnlyResource { /** Unique name of the rule. */ recommendationName?: string; /** UI friendly name of the rule. */ @@ -4078,22 +4079,35 @@ export type RecommendationRule = ProxyOnlyResource & { bladeName?: string; /** Forward link to an external document associated with the rule. Applicable to dynamic rule only. */ forwardLink?: string; -}; +} /** Known values of {@link ScmType} that the service accepts. */ export enum KnownScmType { + /** None */ None = "None", + /** Dropbox */ Dropbox = "Dropbox", + /** Tfs */ Tfs = "Tfs", + /** LocalGit */ LocalGit = "LocalGit", + /** GitHub */ GitHub = "GitHub", + /** CodePlexGit */ CodePlexGit = "CodePlexGit", + /** CodePlexHg */ CodePlexHg = "CodePlexHg", + /** BitbucketGit */ BitbucketGit = "BitbucketGit", + /** BitbucketHg */ BitbucketHg = "BitbucketHg", + /** ExternalGit */ ExternalGit = "ExternalGit", + /** ExternalHg */ ExternalHg = "ExternalHg", + /** OneDrive */ OneDrive = "OneDrive", + /** VSO */ VSO = "VSO" } @@ -4120,8 +4134,11 @@ export type ScmType = string; /** Known values of {@link SupportedTlsVersions} that the service accepts. */ export enum KnownSupportedTlsVersions { + /** One0 */ One0 = "1.0", + /** One1 */ One1 = "1.1", + /** One2 */ One2 = "1.2" } @@ -4138,8 +4155,11 @@ export type SupportedTlsVersions = string; /** Known values of {@link FtpsState} that the service accepts. */ export enum KnownFtpsState { + /** AllAllowed */ AllAllowed = "AllAllowed", + /** FtpsOnly */ FtpsOnly = "FtpsOnly", + /** Disabled */ Disabled = "Disabled" } @@ -4156,9 +4176,13 @@ export type FtpsState = string; /** Known values of {@link ManagedServiceIdentityType} that the service accepts. */ export enum KnownManagedServiceIdentityType { + /** SystemAssigned */ SystemAssigned = "SystemAssigned", + /** UserAssigned */ UserAssigned = "UserAssigned", + /** SystemAssignedUserAssigned */ SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + /** None */ None = "None" } @@ -4176,9 +4200,13 @@ export type ManagedServiceIdentityType = string; /** Known values of {@link DatabaseType} that the service accepts. */ export enum KnownDatabaseType { + /** SqlAzure */ SqlAzure = "SqlAzure", + /** MySql */ MySql = "MySql", + /** LocalMySql */ LocalMySql = "LocalMySql", + /** PostgreSql */ PostgreSql = "PostgreSql" } @@ -4196,8 +4224,11 @@ export type DatabaseType = string; /** Known values of {@link RouteType} that the service accepts. */ export enum KnownRouteType { + /** Default */ Default = "DEFAULT", + /** Inherited */ Inherited = "INHERITED", + /** Static */ Static = "STATIC" } @@ -4214,8 +4245,11 @@ export type RouteType = string; /** Known values of {@link PublishingProfileFormat} that the service accepts. */ export enum KnownPublishingProfileFormat { + /** FileZilla3 */ FileZilla3 = "FileZilla3", + /** WebDeploy */ WebDeploy = "WebDeploy", + /** Ftp */ Ftp = "Ftp" } @@ -4232,13 +4266,21 @@ export type PublishingProfileFormat = string; /** Known values of {@link CheckNameResourceTypes} that the service accepts. */ export enum KnownCheckNameResourceTypes { + /** Site */ Site = "Site", + /** Slot */ Slot = "Slot", + /** HostingEnvironment */ HostingEnvironment = "HostingEnvironment", + /** PublishingUser */ PublishingUser = "PublishingUser", + /** MicrosoftWebSites */ MicrosoftWebSites = "Microsoft.Web/sites", + /** MicrosoftWebSitesSlots */ MicrosoftWebSitesSlots = "Microsoft.Web/sites/slots", + /** MicrosoftWebHostingEnvironments */ MicrosoftWebHostingEnvironments = "Microsoft.Web/hostingEnvironments", + /** MicrosoftWebPublishingUsers */ MicrosoftWebPublishingUsers = "Microsoft.Web/publishingUsers" } @@ -4260,7 +4302,9 @@ export type CheckNameResourceTypes = string; /** Known values of {@link InAvailabilityReasonType} that the service accepts. */ export enum KnownInAvailabilityReasonType { + /** Invalid */ Invalid = "Invalid", + /** AlreadyExists */ AlreadyExists = "AlreadyExists" } @@ -4276,15 +4320,25 @@ export type InAvailabilityReasonType = string; /** Known values of {@link SkuName} that the service accepts. */ export enum KnownSkuName { + /** Free */ Free = "Free", + /** Shared */ Shared = "Shared", + /** Basic */ Basic = "Basic", + /** Standard */ Standard = "Standard", + /** Premium */ Premium = "Premium", + /** Dynamic */ Dynamic = "Dynamic", + /** Isolated */ Isolated = "Isolated", + /** PremiumV2 */ PremiumV2 = "PremiumV2", + /** ElasticPremium */ ElasticPremium = "ElasticPremium", + /** ElasticIsolated */ ElasticIsolated = "ElasticIsolated" } @@ -4308,7 +4362,9 @@ export type SkuName = string; /** Known values of {@link ValidateResourceTypes} that the service accepts. */ export enum KnownValidateResourceTypes { + /** ServerFarm */ ServerFarm = "ServerFarm", + /** Site */ Site = "Site" } @@ -4324,9 +4380,13 @@ export type ValidateResourceTypes = string; /** Known values of {@link Enum11} that the service accepts. */ export enum KnownEnum11 { + /** Windows */ Windows = "Windows", + /** Linux */ Linux = "Linux", + /** WindowsFunctions */ WindowsFunctions = "WindowsFunctions", + /** LinuxFunctions */ LinuxFunctions = "LinuxFunctions" } @@ -4344,9 +4404,13 @@ export type Enum11 = string; /** Known values of {@link Enum12} that the service accepts. */ export enum KnownEnum12 { + /** Windows */ Windows = "Windows", + /** Linux */ Linux = "Linux", + /** WindowsFunctions */ WindowsFunctions = "WindowsFunctions", + /** LinuxFunctions */ LinuxFunctions = "LinuxFunctions" } @@ -4364,8 +4428,11 @@ export type Enum12 = string; /** Known values of {@link ResourceScopeType} that the service accepts. */ export enum KnownResourceScopeType { + /** ServerFarm */ ServerFarm = "ServerFarm", + /** Subscription */ Subscription = "Subscription", + /** WebSite */ WebSite = "WebSite" } @@ -7335,10 +7402,7 @@ export type WebAppsListNextResponse = WebAppCollection; /** Optional parameters. */ export interface WebAppsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions { - /** Specify true to include deployment slots in results. The default is false, which only gives you the production slot of all apps. */ - includeSlots?: boolean; -} + extends coreClient.OperationOptions {} /** Contains response data for the listByResourceGroupNext operation. */ export type WebAppsListByResourceGroupNextResponse = WebAppCollection; @@ -7436,22 +7500,14 @@ export type WebAppsListMetricDefinitionsNextResponse = ResourceMetricDefinitionC /** Optional parameters. */ export interface WebAppsListMetricsNextOptionalParams - extends coreClient.OperationOptions { - /** Specify "true" to include metric details in the response. It is "false" by default. */ - details?: boolean; - /** Return only metrics specified in the filter (using OData syntax). For example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listMetricsNext operation. */ export type WebAppsListMetricsNextResponse = ResourceMetricCollection; /** Optional parameters. */ export interface WebAppsListPerfMonCountersNextOptionalParams - extends coreClient.OperationOptions { - /** Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listPerfMonCountersNext operation. */ export type WebAppsListPerfMonCountersNextResponse = PerfMonCounterCollection; @@ -7591,22 +7647,14 @@ export type WebAppsListMetricDefinitionsSlotNextResponse = ResourceMetricDefinit /** Optional parameters. */ export interface WebAppsListMetricsSlotNextOptionalParams - extends coreClient.OperationOptions { - /** Specify "true" to include metric details in the response. It is "false" by default. */ - details?: boolean; - /** Return only metrics specified in the filter (using OData syntax). For example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listMetricsSlotNext operation. */ export type WebAppsListMetricsSlotNextResponse = ResourceMetricCollection; /** Optional parameters. */ export interface WebAppsListPerfMonCountersSlotNextOptionalParams - extends coreClient.OperationOptions { - /** Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listPerfMonCountersSlotNext operation. */ export type WebAppsListPerfMonCountersSlotNextResponse = PerfMonCounterCollection; @@ -7683,10 +7731,7 @@ export type WebAppsListTriggeredWebJobHistorySlotNextResponse = TriggeredJobHist /** Optional parameters. */ export interface WebAppsListUsagesSlotNextOptionalParams - extends coreClient.OperationOptions { - /** Return only information specified in the filter (using OData syntax). For example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listUsagesSlotNext operation. */ export type WebAppsListUsagesSlotNextResponse = CsmUsageQuotaCollection; @@ -7735,10 +7780,7 @@ export type WebAppsListTriggeredWebJobHistoryNextResponse = TriggeredJobHistoryC /** Optional parameters. */ export interface WebAppsListUsagesNextOptionalParams - extends coreClient.OperationOptions { - /** Return only information specified in the filter (using OData syntax). For example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listUsagesNext operation. */ export type WebAppsListUsagesNextResponse = CsmUsageQuotaCollection; @@ -7886,28 +7928,14 @@ export type ListSourceControlsNextResponse = SourceControlCollection; /** Optional parameters. */ export interface ListBillingMetersNextOptionalParams - extends coreClient.OperationOptions { - /** Azure Location of billable resource */ - billingLocation?: string; - /** App Service OS type meters used for */ - osType?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listBillingMetersNext operation. */ export type ListBillingMetersNextResponse = BillingMeterCollection; /** Optional parameters. */ export interface ListGeoRegionsNextOptionalParams - extends coreClient.OperationOptions { - /** Name of SKU used to filter the regions. */ - sku?: SkuName; - /** Specify true if you want to filter to only regions that support Linux workers. */ - linuxWorkersEnabled?: boolean; - /** Specify true if you want to filter to only regions that support Xenon workers. */ - xenonWorkersEnabled?: boolean; - /** Specify true if you want to filter to only regions that support Linux Consumption Workers. */ - linuxDynamicWorkersEnabled?: boolean; -} + extends coreClient.OperationOptions {} /** Contains response data for the listGeoRegionsNext operation. */ export type ListGeoRegionsNextResponse = GeoRegionCollection; @@ -8145,13 +8173,7 @@ export interface AppServicePlansRebootWorkerOptionalParams /** Optional parameters. */ export interface AppServicePlansListNextOptionalParams - extends coreClient.OperationOptions { - /** - * Specify true to return all App Service plan properties. The default is false, which returns a subset of the properties. - * Retrieval of all properties may increase the API latency. - */ - detailed?: boolean; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type AppServicePlansListNextResponse = AppServicePlanCollection; @@ -8186,36 +8208,21 @@ export type AppServicePlansListMetricDefintionsNextResponse = ResourceMetricDefi /** Optional parameters. */ export interface AppServicePlansListMetricsNextOptionalParams - extends coreClient.OperationOptions { - /** Specify true to include instance details. The default is false. */ - details?: boolean; - /** Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listMetricsNext operation. */ export type AppServicePlansListMetricsNextResponse = ResourceMetricCollection; /** Optional parameters. */ export interface AppServicePlansListWebAppsNextOptionalParams - extends coreClient.OperationOptions { - /** Supported filter: $filter=state eq running. Returns only web apps that are currently running */ - filter?: string; - /** Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list */ - skipToken?: string; - /** List page size. If specified, results are paged. */ - top?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listWebAppsNext operation. */ export type AppServicePlansListWebAppsNextResponse = WebAppCollection; /** Optional parameters. */ export interface AppServicePlansListUsagesNextOptionalParams - extends coreClient.OperationOptions { - /** Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listUsagesNext operation. */ export type AppServicePlansListUsagesNextResponse = CsmUsageQuotaCollection; @@ -8247,9 +8254,7 @@ export type ProviderGetAvailableStacksOnPremResponse = ApplicationStackCollectio /** Optional parameters. */ export interface ProviderGetAvailableStacksNextOptionalParams - extends coreClient.OperationOptions { - osTypeSelected?: Enum11; -} + extends coreClient.OperationOptions {} /** Contains response data for the getAvailableStacksNext operation. */ export type ProviderGetAvailableStacksNextResponse = ApplicationStackCollection; @@ -8263,9 +8268,7 @@ export type ProviderListOperationsNextResponse = CsmOperationCollection; /** Optional parameters. */ export interface ProviderGetAvailableStacksOnPremNextOptionalParams - extends coreClient.OperationOptions { - osTypeSelected?: Enum12; -} + extends coreClient.OperationOptions {} /** Contains response data for the getAvailableStacksOnPremNext operation. */ export type ProviderGetAvailableStacksOnPremNextResponse = ApplicationStackCollection; @@ -8388,60 +8391,35 @@ export interface RecommendationsDisableRecommendationForSiteOptionalParams /** Optional parameters. */ export interface RecommendationsListNextOptionalParams - extends coreClient.OperationOptions { - /** Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D] */ - filter?: string; - /** Specify true to return only the most critical recommendations. The default is false, which returns all recommendations. */ - featured?: boolean; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type RecommendationsListNextResponse = RecommendationCollection; /** Optional parameters. */ export interface RecommendationsListHistoryForHostingEnvironmentNextOptionalParams - extends coreClient.OperationOptions { - /** Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D] */ - filter?: string; - /** Specify false to return all recommendations. The default is true, which returns only expired recommendations. */ - expiredOnly?: boolean; -} + extends coreClient.OperationOptions {} /** Contains response data for the listHistoryForHostingEnvironmentNext operation. */ export type RecommendationsListHistoryForHostingEnvironmentNextResponse = RecommendationCollection; /** Optional parameters. */ export interface RecommendationsListRecommendedRulesForHostingEnvironmentNextOptionalParams - extends coreClient.OperationOptions { - /** Return only channels specified in the filter. Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' */ - filter?: string; - /** Specify true to return only the most critical recommendations. The default is false, which returns all recommendations. */ - featured?: boolean; -} + extends coreClient.OperationOptions {} /** Contains response data for the listRecommendedRulesForHostingEnvironmentNext operation. */ export type RecommendationsListRecommendedRulesForHostingEnvironmentNextResponse = RecommendationCollection; /** Optional parameters. */ export interface RecommendationsListHistoryForWebAppNextOptionalParams - extends coreClient.OperationOptions { - /** Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D] */ - filter?: string; - /** Specify false to return all recommendations. The default is true, which returns only expired recommendations. */ - expiredOnly?: boolean; -} + extends coreClient.OperationOptions {} /** Contains response data for the listHistoryForWebAppNext operation. */ export type RecommendationsListHistoryForWebAppNextResponse = RecommendationCollection; /** Optional parameters. */ export interface RecommendationsListRecommendedRulesForWebAppNextOptionalParams - extends coreClient.OperationOptions { - /** Return only channels specified in the filter. Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' */ - filter?: string; - /** Specify true to return only the most critical recommendations. The default is false, which returns all recommendations. */ - featured?: boolean; -} + extends coreClient.OperationOptions {} /** Contains response data for the listRecommendedRulesForWebAppNext operation. */ export type RecommendationsListRecommendedRulesForWebAppNextResponse = RecommendationCollection; diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/models/mappers.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/models/mappers.ts index 7530182d43d..d4d316837af 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/models/mappers.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/models/mappers.ts @@ -3906,7 +3906,7 @@ export const ResourceNameAvailabilityRequest: coreClient.CompositeMapper = { name: "String" } }, - type: { + typeParam: { serializedName: "type", required: true, xmlName: "type", diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/appServicePlans.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/appServicePlans.ts index 043ea1e1cd6..83140988c8a 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/appServicePlans.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/appServicePlans.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AppServicePlans } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,27 +19,33 @@ import { AppServicePlan, AppServicePlansListNextOptionalParams, AppServicePlansListOptionalParams, + AppServicePlansListResponse, AppServicePlansListByResourceGroupNextOptionalParams, AppServicePlansListByResourceGroupOptionalParams, + AppServicePlansListByResourceGroupResponse, AppServicePlansListWebAppsByHybridConnectionNextOptionalParams, AppServicePlansListWebAppsByHybridConnectionOptionalParams, + AppServicePlansListWebAppsByHybridConnectionResponse, HybridConnection, AppServicePlansListHybridConnectionsNextOptionalParams, AppServicePlansListHybridConnectionsOptionalParams, + AppServicePlansListHybridConnectionsResponse, ResourceMetricDefinition, AppServicePlansListMetricDefintionsNextOptionalParams, AppServicePlansListMetricDefintionsOptionalParams, + AppServicePlansListMetricDefintionsResponse, ResourceMetric, AppServicePlansListMetricsNextOptionalParams, AppServicePlansListMetricsOptionalParams, + AppServicePlansListMetricsResponse, Site, AppServicePlansListWebAppsNextOptionalParams, AppServicePlansListWebAppsOptionalParams, + AppServicePlansListWebAppsResponse, CsmUsageQuota, AppServicePlansListUsagesNextOptionalParams, AppServicePlansListUsagesOptionalParams, - AppServicePlansListResponse, - AppServicePlansListByResourceGroupResponse, + AppServicePlansListUsagesResponse, AppServicePlansGetOptionalParams, AppServicePlansGetResponse, AppServicePlansCreateOrUpdateOptionalParams, @@ -54,17 +61,11 @@ import { AppServicePlansDeleteHybridConnectionOptionalParams, AppServicePlansListHybridConnectionKeysOptionalParams, AppServicePlansListHybridConnectionKeysResponse, - AppServicePlansListWebAppsByHybridConnectionResponse, AppServicePlansGetHybridConnectionPlanLimitOptionalParams, AppServicePlansGetHybridConnectionPlanLimitResponse, - AppServicePlansListHybridConnectionsResponse, - AppServicePlansListMetricDefintionsResponse, - AppServicePlansListMetricsResponse, AppServicePlansRestartWebAppsOptionalParams, - AppServicePlansListWebAppsResponse, AppServicePlansGetServerFarmSkusOptionalParams, AppServicePlansGetServerFarmSkusResponse, - AppServicePlansListUsagesResponse, AppServicePlansListVnetsOptionalParams, AppServicePlansListVnetsResponse, AppServicePlansGetVnetFromServerFarmOptionalParams, @@ -123,22 +124,34 @@ export class AppServicePlansImpl implements AppServicePlans { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: AppServicePlansListOptionalParams + options?: AppServicePlansListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AppServicePlansListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -167,19 +180,33 @@ export class AppServicePlansImpl implements AppServicePlans { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: AppServicePlansListByResourceGroupOptionalParams + options?: AppServicePlansListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AppServicePlansListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -187,7 +214,9 @@ export class AppServicePlansImpl implements AppServicePlans { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -232,13 +261,17 @@ export class AppServicePlansImpl implements AppServicePlans { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listWebAppsByHybridConnectionPagingPage( resourceGroupName, name, namespaceName, relayName, - options + options, + settings ); } }; @@ -249,17 +282,24 @@ export class AppServicePlansImpl implements AppServicePlans { name: string, namespaceName: string, relayName: string, - options?: AppServicePlansListWebAppsByHybridConnectionOptionalParams + options?: AppServicePlansListWebAppsByHybridConnectionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listWebAppsByHybridConnection( - resourceGroupName, - name, - namespaceName, - relayName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AppServicePlansListWebAppsByHybridConnectionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listWebAppsByHybridConnection( + resourceGroupName, + name, + namespaceName, + relayName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listWebAppsByHybridConnectionNext( resourceGroupName, @@ -270,7 +310,9 @@ export class AppServicePlansImpl implements AppServicePlans { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -315,11 +357,15 @@ export class AppServicePlansImpl implements AppServicePlans { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listHybridConnectionsPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -328,15 +374,22 @@ export class AppServicePlansImpl implements AppServicePlans { private async *listHybridConnectionsPagingPage( resourceGroupName: string, name: string, - options?: AppServicePlansListHybridConnectionsOptionalParams + options?: AppServicePlansListHybridConnectionsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listHybridConnections( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AppServicePlansListHybridConnectionsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listHybridConnections( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listHybridConnectionsNext( resourceGroupName, @@ -345,7 +398,9 @@ export class AppServicePlansImpl implements AppServicePlans { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -386,11 +441,15 @@ export class AppServicePlansImpl implements AppServicePlans { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listMetricDefintionsPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -399,15 +458,22 @@ export class AppServicePlansImpl implements AppServicePlans { private async *listMetricDefintionsPagingPage( resourceGroupName: string, name: string, - options?: AppServicePlansListMetricDefintionsOptionalParams + options?: AppServicePlansListMetricDefintionsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listMetricDefintions( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AppServicePlansListMetricDefintionsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listMetricDefintions( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listMetricDefintionsNext( resourceGroupName, @@ -416,7 +482,9 @@ export class AppServicePlansImpl implements AppServicePlans { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -453,8 +521,16 @@ export class AppServicePlansImpl implements AppServicePlans { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listMetricsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listMetricsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -462,11 +538,18 @@ export class AppServicePlansImpl implements AppServicePlans { private async *listMetricsPagingPage( resourceGroupName: string, name: string, - options?: AppServicePlansListMetricsOptionalParams + options?: AppServicePlansListMetricsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listMetrics(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AppServicePlansListMetricsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listMetrics(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listMetricsNext( resourceGroupName, @@ -475,7 +558,9 @@ export class AppServicePlansImpl implements AppServicePlans { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -512,8 +597,16 @@ export class AppServicePlansImpl implements AppServicePlans { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listWebAppsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listWebAppsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -521,11 +614,18 @@ export class AppServicePlansImpl implements AppServicePlans { private async *listWebAppsPagingPage( resourceGroupName: string, name: string, - options?: AppServicePlansListWebAppsOptionalParams + options?: AppServicePlansListWebAppsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listWebApps(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AppServicePlansListWebAppsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listWebApps(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listWebAppsNext( resourceGroupName, @@ -534,7 +634,9 @@ export class AppServicePlansImpl implements AppServicePlans { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -571,8 +673,16 @@ export class AppServicePlansImpl implements AppServicePlans { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listUsagesPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listUsagesPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -580,11 +690,18 @@ export class AppServicePlansImpl implements AppServicePlans { private async *listUsagesPagingPage( resourceGroupName: string, name: string, - options?: AppServicePlansListUsagesOptionalParams + options?: AppServicePlansListUsagesOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listUsages(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AppServicePlansListUsagesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listUsages(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listUsagesNext( resourceGroupName, @@ -593,7 +710,9 @@ export class AppServicePlansImpl implements AppServicePlans { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -715,10 +834,12 @@ export class AppServicePlansImpl implements AppServicePlans { { resourceGroupName, name, appServicePlan, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -2053,7 +2174,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.detailed], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2073,7 +2193,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2094,7 +2213,6 @@ const listWebAppsByHybridConnectionNextOperationSpec: coreClient.OperationSpec = bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2118,7 +2236,6 @@ const listHybridConnectionsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2140,7 +2257,6 @@ const listMetricDefintionsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2162,11 +2278,6 @@ const listMetricsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.details, - Parameters.filter - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2188,12 +2299,6 @@ const listWebAppsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.skipToken, - Parameters.top - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2215,7 +2320,6 @@ const listUsagesNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/certificates.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/certificates.ts index 3943a20bf62..43468ef998c 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/certificates.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/certificates.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Certificates } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { Certificate, CertificatesListNextOptionalParams, CertificatesListOptionalParams, + CertificatesListResponse, CertificatesListByResourceGroupNextOptionalParams, CertificatesListByResourceGroupOptionalParams, - CertificatesListResponse, CertificatesListByResourceGroupResponse, CertificatesGetOptionalParams, CertificatesGetResponse, @@ -60,22 +61,34 @@ export class CertificatesImpl implements Certificates { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: CertificatesListOptionalParams + options?: CertificatesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: CertificatesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -104,19 +117,33 @@ export class CertificatesImpl implements Certificates { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: CertificatesListByResourceGroupOptionalParams + options?: CertificatesListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: CertificatesListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -124,7 +151,9 @@ export class CertificatesImpl implements Certificates { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -404,7 +433,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -424,7 +452,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/provider.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/provider.ts index 9e357dae692..74f0b477ffd 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/provider.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/provider.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Provider } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,13 +17,13 @@ import { ApplicationStack, ProviderGetAvailableStacksNextOptionalParams, ProviderGetAvailableStacksOptionalParams, + ProviderGetAvailableStacksResponse, CsmOperationDescription, ProviderListOperationsNextOptionalParams, ProviderListOperationsOptionalParams, + ProviderListOperationsResponse, ProviderGetAvailableStacksOnPremNextOptionalParams, ProviderGetAvailableStacksOnPremOptionalParams, - ProviderGetAvailableStacksResponse, - ProviderListOperationsResponse, ProviderGetAvailableStacksOnPremResponse, ProviderGetAvailableStacksNextResponse, ProviderListOperationsNextResponse, @@ -57,22 +58,34 @@ export class ProviderImpl implements Provider { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.getAvailableStacksPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.getAvailableStacksPagingPage(options, settings); } }; } private async *getAvailableStacksPagingPage( - options?: ProviderGetAvailableStacksOptionalParams + options?: ProviderGetAvailableStacksOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._getAvailableStacks(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ProviderGetAvailableStacksResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getAvailableStacks(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._getAvailableStacksNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -100,22 +113,34 @@ export class ProviderImpl implements Provider { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listOperationsPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listOperationsPagingPage(options, settings); } }; } private async *listOperationsPagingPage( - options?: ProviderListOperationsOptionalParams + options?: ProviderListOperationsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listOperations(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ProviderListOperationsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listOperations(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listOperationsNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -142,25 +167,37 @@ export class ProviderImpl implements Provider { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.getAvailableStacksOnPremPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.getAvailableStacksOnPremPagingPage(options, settings); } }; } private async *getAvailableStacksOnPremPagingPage( - options?: ProviderGetAvailableStacksOnPremOptionalParams + options?: ProviderGetAvailableStacksOnPremOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._getAvailableStacksOnPrem(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ProviderGetAvailableStacksOnPremResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getAvailableStacksOnPrem(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._getAvailableStacksOnPremNext( continuationToken, options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -321,7 +358,6 @@ const getAvailableStacksNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.osTypeSelected], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer @@ -337,7 +373,6 @@ const listOperationsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer @@ -353,7 +388,6 @@ const getAvailableStacksOnPremNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.osTypeSelected1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/recommendations.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/recommendations.ts index 20a497e853f..2bd6f9e804a 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/recommendations.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/recommendations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Recommendations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,26 +17,26 @@ import { Recommendation, RecommendationsListNextOptionalParams, RecommendationsListOptionalParams, + RecommendationsListResponse, RecommendationsListHistoryForHostingEnvironmentNextOptionalParams, RecommendationsListHistoryForHostingEnvironmentOptionalParams, + RecommendationsListHistoryForHostingEnvironmentResponse, RecommendationsListRecommendedRulesForHostingEnvironmentNextOptionalParams, RecommendationsListRecommendedRulesForHostingEnvironmentOptionalParams, + RecommendationsListRecommendedRulesForHostingEnvironmentResponse, RecommendationsListHistoryForWebAppNextOptionalParams, RecommendationsListHistoryForWebAppOptionalParams, + RecommendationsListHistoryForWebAppResponse, RecommendationsListRecommendedRulesForWebAppNextOptionalParams, RecommendationsListRecommendedRulesForWebAppOptionalParams, - RecommendationsListResponse, + RecommendationsListRecommendedRulesForWebAppResponse, RecommendationsResetAllFiltersOptionalParams, RecommendationsDisableRecommendationForSubscriptionOptionalParams, - RecommendationsListHistoryForHostingEnvironmentResponse, - RecommendationsListRecommendedRulesForHostingEnvironmentResponse, RecommendationsDisableAllForHostingEnvironmentOptionalParams, RecommendationsResetAllFiltersForHostingEnvironmentOptionalParams, RecommendationsGetRuleDetailsByHostingEnvironmentOptionalParams, RecommendationsGetRuleDetailsByHostingEnvironmentResponse, RecommendationsDisableRecommendationForHostingEnvironmentOptionalParams, - RecommendationsListHistoryForWebAppResponse, - RecommendationsListRecommendedRulesForWebAppResponse, RecommendationsDisableAllForWebAppOptionalParams, RecommendationsResetAllFiltersForWebAppOptionalParams, RecommendationsGetRuleDetailsByWebAppOptionalParams, @@ -76,22 +77,34 @@ export class RecommendationsImpl implements Recommendations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: RecommendationsListOptionalParams + options?: RecommendationsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RecommendationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -126,11 +139,15 @@ export class RecommendationsImpl implements Recommendations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listHistoryForHostingEnvironmentPagingPage( resourceGroupName, hostingEnvironmentName, - options + options, + settings ); } }; @@ -139,15 +156,22 @@ export class RecommendationsImpl implements Recommendations { private async *listHistoryForHostingEnvironmentPagingPage( resourceGroupName: string, hostingEnvironmentName: string, - options?: RecommendationsListHistoryForHostingEnvironmentOptionalParams + options?: RecommendationsListHistoryForHostingEnvironmentOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listHistoryForHostingEnvironment( - resourceGroupName, - hostingEnvironmentName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RecommendationsListHistoryForHostingEnvironmentResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listHistoryForHostingEnvironment( + resourceGroupName, + hostingEnvironmentName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listHistoryForHostingEnvironmentNext( resourceGroupName, @@ -156,7 +180,9 @@ export class RecommendationsImpl implements Recommendations { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -197,11 +223,15 @@ export class RecommendationsImpl implements Recommendations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listRecommendedRulesForHostingEnvironmentPagingPage( resourceGroupName, hostingEnvironmentName, - options + options, + settings ); } }; @@ -210,15 +240,22 @@ export class RecommendationsImpl implements Recommendations { private async *listRecommendedRulesForHostingEnvironmentPagingPage( resourceGroupName: string, hostingEnvironmentName: string, - options?: RecommendationsListRecommendedRulesForHostingEnvironmentOptionalParams + options?: RecommendationsListRecommendedRulesForHostingEnvironmentOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listRecommendedRulesForHostingEnvironment( - resourceGroupName, - hostingEnvironmentName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RecommendationsListRecommendedRulesForHostingEnvironmentResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listRecommendedRulesForHostingEnvironment( + resourceGroupName, + hostingEnvironmentName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listRecommendedRulesForHostingEnvironmentNext( resourceGroupName, @@ -227,7 +264,9 @@ export class RecommendationsImpl implements Recommendations { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -268,11 +307,15 @@ export class RecommendationsImpl implements Recommendations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listHistoryForWebAppPagingPage( resourceGroupName, siteName, - options + options, + settings ); } }; @@ -281,15 +324,22 @@ export class RecommendationsImpl implements Recommendations { private async *listHistoryForWebAppPagingPage( resourceGroupName: string, siteName: string, - options?: RecommendationsListHistoryForWebAppOptionalParams + options?: RecommendationsListHistoryForWebAppOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listHistoryForWebApp( - resourceGroupName, - siteName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RecommendationsListHistoryForWebAppResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listHistoryForWebApp( + resourceGroupName, + siteName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listHistoryForWebAppNext( resourceGroupName, @@ -298,7 +348,9 @@ export class RecommendationsImpl implements Recommendations { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -339,11 +391,15 @@ export class RecommendationsImpl implements Recommendations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listRecommendedRulesForWebAppPagingPage( resourceGroupName, siteName, - options + options, + settings ); } }; @@ -352,15 +408,22 @@ export class RecommendationsImpl implements Recommendations { private async *listRecommendedRulesForWebAppPagingPage( resourceGroupName: string, siteName: string, - options?: RecommendationsListRecommendedRulesForWebAppOptionalParams + options?: RecommendationsListRecommendedRulesForWebAppOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listRecommendedRulesForWebApp( - resourceGroupName, - siteName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RecommendationsListRecommendedRulesForWebAppResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listRecommendedRulesForWebApp( + resourceGroupName, + siteName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listRecommendedRulesForWebAppNext( resourceGroupName, @@ -369,7 +432,9 @@ export class RecommendationsImpl implements Recommendations { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1042,11 +1107,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.featured - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1066,11 +1126,6 @@ const listHistoryForHostingEnvironmentNextOperationSpec: coreClient.OperationSpe bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.expiredOnly - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1092,11 +1147,6 @@ const listRecommendedRulesForHostingEnvironmentNextOperationSpec: coreClient.Ope bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.featured - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1118,11 +1168,6 @@ const listHistoryForWebAppNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.expiredOnly - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1144,11 +1189,6 @@ const listRecommendedRulesForWebAppNextOperationSpec: coreClient.OperationSpec = bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.featured - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/webApps.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/webApps.ts index 72c1adabc58..8e43d3f2f6d 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/webApps.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/operations/webApps.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { WebApps } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,144 +19,199 @@ import { Site, WebAppsListNextOptionalParams, WebAppsListOptionalParams, + WebAppsListResponse, WebAppsListByResourceGroupNextOptionalParams, WebAppsListByResourceGroupOptionalParams, + WebAppsListByResourceGroupResponse, BackupItem, WebAppsListBackupsNextOptionalParams, WebAppsListBackupsOptionalParams, + WebAppsListBackupsResponse, SiteConfigResource, WebAppsListConfigurationsNextOptionalParams, WebAppsListConfigurationsOptionalParams, + WebAppsListConfigurationsResponse, SiteConfigurationSnapshotInfo, WebAppsListConfigurationSnapshotInfoNextOptionalParams, WebAppsListConfigurationSnapshotInfoOptionalParams, + WebAppsListConfigurationSnapshotInfoResponse, ContinuousWebJob, WebAppsListContinuousWebJobsNextOptionalParams, WebAppsListContinuousWebJobsOptionalParams, + WebAppsListContinuousWebJobsResponse, Deployment, WebAppsListDeploymentsNextOptionalParams, WebAppsListDeploymentsOptionalParams, + WebAppsListDeploymentsResponse, Identifier, WebAppsListDomainOwnershipIdentifiersNextOptionalParams, WebAppsListDomainOwnershipIdentifiersOptionalParams, + WebAppsListDomainOwnershipIdentifiersResponse, FunctionEnvelope, WebAppsListFunctionsNextOptionalParams, WebAppsListFunctionsOptionalParams, + WebAppsListFunctionsResponse, HostNameBinding, WebAppsListHostNameBindingsNextOptionalParams, WebAppsListHostNameBindingsOptionalParams, + WebAppsListHostNameBindingsResponse, SiteInstance, WebAppsListInstanceIdentifiersNextOptionalParams, WebAppsListInstanceIdentifiersOptionalParams, + WebAppsListInstanceIdentifiersResponse, ProcessInfo, WebAppsListInstanceProcessesNextOptionalParams, WebAppsListInstanceProcessesOptionalParams, + WebAppsListInstanceProcessesResponse, ProcessModuleInfo, WebAppsListInstanceProcessModulesNextOptionalParams, WebAppsListInstanceProcessModulesOptionalParams, + WebAppsListInstanceProcessModulesResponse, ProcessThreadInfo, WebAppsListInstanceProcessThreadsNextOptionalParams, WebAppsListInstanceProcessThreadsOptionalParams, + WebAppsListInstanceProcessThreadsResponse, ResourceMetricDefinition, WebAppsListMetricDefinitionsNextOptionalParams, WebAppsListMetricDefinitionsOptionalParams, + WebAppsListMetricDefinitionsResponse, ResourceMetric, WebAppsListMetricsNextOptionalParams, WebAppsListMetricsOptionalParams, + WebAppsListMetricsResponse, PerfMonResponse, WebAppsListPerfMonCountersNextOptionalParams, WebAppsListPerfMonCountersOptionalParams, + WebAppsListPerfMonCountersResponse, WebAppsListProcessesNextOptionalParams, WebAppsListProcessesOptionalParams, + WebAppsListProcessesResponse, WebAppsListProcessModulesNextOptionalParams, WebAppsListProcessModulesOptionalParams, + WebAppsListProcessModulesResponse, WebAppsListProcessThreadsNextOptionalParams, WebAppsListProcessThreadsOptionalParams, + WebAppsListProcessThreadsResponse, PublicCertificate, WebAppsListPublicCertificatesNextOptionalParams, WebAppsListPublicCertificatesOptionalParams, + WebAppsListPublicCertificatesResponse, SiteExtensionInfo, WebAppsListSiteExtensionsNextOptionalParams, WebAppsListSiteExtensionsOptionalParams, + WebAppsListSiteExtensionsResponse, WebAppsListSlotsNextOptionalParams, WebAppsListSlotsOptionalParams, + WebAppsListSlotsResponse, WebAppsListBackupsSlotNextOptionalParams, WebAppsListBackupsSlotOptionalParams, + WebAppsListBackupsSlotResponse, WebAppsListConfigurationsSlotNextOptionalParams, WebAppsListConfigurationsSlotOptionalParams, + WebAppsListConfigurationsSlotResponse, WebAppsListConfigurationSnapshotInfoSlotNextOptionalParams, WebAppsListConfigurationSnapshotInfoSlotOptionalParams, + WebAppsListConfigurationSnapshotInfoSlotResponse, WebAppsListContinuousWebJobsSlotNextOptionalParams, WebAppsListContinuousWebJobsSlotOptionalParams, + WebAppsListContinuousWebJobsSlotResponse, WebAppsListDeploymentsSlotNextOptionalParams, WebAppsListDeploymentsSlotOptionalParams, + WebAppsListDeploymentsSlotResponse, WebAppsListDomainOwnershipIdentifiersSlotNextOptionalParams, WebAppsListDomainOwnershipIdentifiersSlotOptionalParams, + WebAppsListDomainOwnershipIdentifiersSlotResponse, WebAppsListInstanceFunctionsSlotNextOptionalParams, WebAppsListInstanceFunctionsSlotOptionalParams, + WebAppsListInstanceFunctionsSlotResponse, WebAppsListHostNameBindingsSlotNextOptionalParams, WebAppsListHostNameBindingsSlotOptionalParams, + WebAppsListHostNameBindingsSlotResponse, WebAppsListInstanceIdentifiersSlotNextOptionalParams, WebAppsListInstanceIdentifiersSlotOptionalParams, + WebAppsListInstanceIdentifiersSlotResponse, WebAppsListInstanceProcessesSlotNextOptionalParams, WebAppsListInstanceProcessesSlotOptionalParams, + WebAppsListInstanceProcessesSlotResponse, WebAppsListInstanceProcessModulesSlotNextOptionalParams, WebAppsListInstanceProcessModulesSlotOptionalParams, + WebAppsListInstanceProcessModulesSlotResponse, WebAppsListInstanceProcessThreadsSlotNextOptionalParams, WebAppsListInstanceProcessThreadsSlotOptionalParams, + WebAppsListInstanceProcessThreadsSlotResponse, WebAppsListMetricDefinitionsSlotNextOptionalParams, WebAppsListMetricDefinitionsSlotOptionalParams, + WebAppsListMetricDefinitionsSlotResponse, WebAppsListMetricsSlotNextOptionalParams, WebAppsListMetricsSlotOptionalParams, + WebAppsListMetricsSlotResponse, WebAppsListPerfMonCountersSlotNextOptionalParams, WebAppsListPerfMonCountersSlotOptionalParams, + WebAppsListPerfMonCountersSlotResponse, WebAppsListProcessesSlotNextOptionalParams, WebAppsListProcessesSlotOptionalParams, + WebAppsListProcessesSlotResponse, WebAppsListProcessModulesSlotNextOptionalParams, WebAppsListProcessModulesSlotOptionalParams, + WebAppsListProcessModulesSlotResponse, WebAppsListProcessThreadsSlotNextOptionalParams, WebAppsListProcessThreadsSlotOptionalParams, + WebAppsListProcessThreadsSlotResponse, WebAppsListPublicCertificatesSlotNextOptionalParams, WebAppsListPublicCertificatesSlotOptionalParams, + WebAppsListPublicCertificatesSlotResponse, WebAppsListSiteExtensionsSlotNextOptionalParams, WebAppsListSiteExtensionsSlotOptionalParams, + WebAppsListSiteExtensionsSlotResponse, SlotDifference, CsmSlotEntity, WebAppsListSlotDifferencesSlotNextOptionalParams, WebAppsListSlotDifferencesSlotOptionalParams, + WebAppsListSlotDifferencesSlotResponse, Snapshot, WebAppsListSnapshotsSlotNextOptionalParams, WebAppsListSnapshotsSlotOptionalParams, + WebAppsListSnapshotsSlotResponse, WebAppsListSnapshotsFromDRSecondarySlotNextOptionalParams, WebAppsListSnapshotsFromDRSecondarySlotOptionalParams, + WebAppsListSnapshotsFromDRSecondarySlotResponse, TriggeredWebJob, WebAppsListTriggeredWebJobsSlotNextOptionalParams, WebAppsListTriggeredWebJobsSlotOptionalParams, + WebAppsListTriggeredWebJobsSlotResponse, TriggeredJobHistory, WebAppsListTriggeredWebJobHistorySlotNextOptionalParams, WebAppsListTriggeredWebJobHistorySlotOptionalParams, + WebAppsListTriggeredWebJobHistorySlotResponse, CsmUsageQuota, WebAppsListUsagesSlotNextOptionalParams, WebAppsListUsagesSlotOptionalParams, + WebAppsListUsagesSlotResponse, WebJob, WebAppsListWebJobsSlotNextOptionalParams, WebAppsListWebJobsSlotOptionalParams, + WebAppsListWebJobsSlotResponse, WebAppsListSlotDifferencesFromProductionNextOptionalParams, WebAppsListSlotDifferencesFromProductionOptionalParams, + WebAppsListSlotDifferencesFromProductionResponse, WebAppsListSnapshotsNextOptionalParams, WebAppsListSnapshotsOptionalParams, + WebAppsListSnapshotsResponse, WebAppsListSnapshotsFromDRSecondaryNextOptionalParams, WebAppsListSnapshotsFromDRSecondaryOptionalParams, + WebAppsListSnapshotsFromDRSecondaryResponse, WebAppsListTriggeredWebJobsNextOptionalParams, WebAppsListTriggeredWebJobsOptionalParams, + WebAppsListTriggeredWebJobsResponse, WebAppsListTriggeredWebJobHistoryNextOptionalParams, WebAppsListTriggeredWebJobHistoryOptionalParams, + WebAppsListTriggeredWebJobHistoryResponse, WebAppsListUsagesNextOptionalParams, WebAppsListUsagesOptionalParams, + WebAppsListUsagesResponse, WebAppsListWebJobsNextOptionalParams, WebAppsListWebJobsOptionalParams, - WebAppsListResponse, - WebAppsListByResourceGroupResponse, + WebAppsListWebJobsResponse, WebAppsGetOptionalParams, WebAppsGetResponse, WebAppsCreateOrUpdateOptionalParams, @@ -170,7 +226,6 @@ import { BackupRequest, WebAppsBackupOptionalParams, WebAppsBackupResponse, - WebAppsListBackupsResponse, WebAppsGetBackupStatusOptionalParams, WebAppsGetBackupStatusResponse, WebAppsDeleteBackupOptionalParams, @@ -178,7 +233,6 @@ import { WebAppsListBackupStatusSecretsResponse, RestoreRequest, WebAppsRestoreOptionalParams, - WebAppsListConfigurationsResponse, StringDictionary, WebAppsUpdateApplicationSettingsOptionalParams, WebAppsUpdateApplicationSettingsResponse, @@ -231,7 +285,6 @@ import { WebAppsCreateOrUpdateConfigurationResponse, WebAppsUpdateConfigurationOptionalParams, WebAppsUpdateConfigurationResponse, - WebAppsListConfigurationSnapshotInfoResponse, WebAppsGetConfigurationSnapshotOptionalParams, WebAppsGetConfigurationSnapshotResponse, WebAppsRecoverSiteConfigurationSnapshotOptionalParams, @@ -239,13 +292,11 @@ import { WebAppsGetWebSiteContainerLogsResponse, WebAppsGetContainerLogsZipOptionalParams, WebAppsGetContainerLogsZipResponse, - WebAppsListContinuousWebJobsResponse, WebAppsGetContinuousWebJobOptionalParams, WebAppsGetContinuousWebJobResponse, WebAppsDeleteContinuousWebJobOptionalParams, WebAppsStartContinuousWebJobOptionalParams, WebAppsStopContinuousWebJobOptionalParams, - WebAppsListDeploymentsResponse, WebAppsGetDeploymentOptionalParams, WebAppsGetDeploymentResponse, WebAppsCreateDeploymentOptionalParams, @@ -255,7 +306,6 @@ import { WebAppsListDeploymentLogResponse, WebAppsDiscoverBackupOptionalParams, WebAppsDiscoverBackupResponse, - WebAppsListDomainOwnershipIdentifiersResponse, WebAppsGetDomainOwnershipIdentifierOptionalParams, WebAppsGetDomainOwnershipIdentifierResponse, WebAppsCreateOrUpdateDomainOwnershipIdentifierOptionalParams, @@ -270,7 +320,6 @@ import { WebAppsCreateMSDeployOperationResponse, WebAppsGetMSDeployLogOptionalParams, WebAppsGetMSDeployLogResponse, - WebAppsListFunctionsResponse, WebAppsGetFunctionsAdminTokenOptionalParams, WebAppsGetFunctionsAdminTokenResponse, WebAppsGetFunctionOptionalParams, @@ -293,7 +342,6 @@ import { WebAppsCreateOrUpdateHostSecretOptionalParams, WebAppsCreateOrUpdateHostSecretResponse, WebAppsDeleteHostSecretOptionalParams, - WebAppsListHostNameBindingsResponse, WebAppsGetHostNameBindingOptionalParams, WebAppsGetHostNameBindingResponse, WebAppsCreateOrUpdateHostNameBindingOptionalParams, @@ -321,31 +369,25 @@ import { WebAppsDeleteRelayServiceConnectionOptionalParams, WebAppsUpdateRelayServiceConnectionOptionalParams, WebAppsUpdateRelayServiceConnectionResponse, - WebAppsListInstanceIdentifiersResponse, WebAppsGetInstanceMsDeployStatusOptionalParams, WebAppsGetInstanceMsDeployStatusResponse, WebAppsCreateInstanceMSDeployOperationOptionalParams, WebAppsCreateInstanceMSDeployOperationResponse, WebAppsGetInstanceMSDeployLogOptionalParams, WebAppsGetInstanceMSDeployLogResponse, - WebAppsListInstanceProcessesResponse, WebAppsGetInstanceProcessOptionalParams, WebAppsGetInstanceProcessResponse, WebAppsDeleteInstanceProcessOptionalParams, WebAppsGetInstanceProcessDumpOptionalParams, WebAppsGetInstanceProcessDumpResponse, - WebAppsListInstanceProcessModulesResponse, WebAppsGetInstanceProcessModuleOptionalParams, WebAppsGetInstanceProcessModuleResponse, - WebAppsListInstanceProcessThreadsResponse, WebAppsGetInstanceProcessThreadOptionalParams, WebAppsGetInstanceProcessThreadResponse, WebAppsIsCloneableOptionalParams, WebAppsIsCloneableResponse, WebAppsListSyncFunctionTriggersOptionalParams, WebAppsListSyncFunctionTriggersResponse, - WebAppsListMetricDefinitionsResponse, - WebAppsListMetricsResponse, StorageMigrationOptions, WebAppsMigrateStorageOptionalParams, WebAppsMigrateStorageResponse, @@ -378,7 +420,6 @@ import { WebAppsGetNetworkTracesV2OptionalParams, WebAppsGetNetworkTracesV2Response, WebAppsGenerateNewSitePublishingPasswordOptionalParams, - WebAppsListPerfMonCountersResponse, WebAppsGetSitePhpErrorLogFlagOptionalParams, WebAppsGetSitePhpErrorLogFlagResponse, WebAppsListPremierAddOnsOptionalParams, @@ -397,19 +438,15 @@ import { PrivateAccess, WebAppsPutPrivateAccessVnetOptionalParams, WebAppsPutPrivateAccessVnetResponse, - WebAppsListProcessesResponse, WebAppsGetProcessOptionalParams, WebAppsGetProcessResponse, WebAppsDeleteProcessOptionalParams, WebAppsGetProcessDumpOptionalParams, WebAppsGetProcessDumpResponse, - WebAppsListProcessModulesResponse, WebAppsGetProcessModuleOptionalParams, WebAppsGetProcessModuleResponse, - WebAppsListProcessThreadsResponse, WebAppsGetProcessThreadOptionalParams, WebAppsGetProcessThreadResponse, - WebAppsListPublicCertificatesResponse, WebAppsGetPublicCertificateOptionalParams, WebAppsGetPublicCertificateResponse, WebAppsCreateOrUpdatePublicCertificateOptionalParams, @@ -425,13 +462,11 @@ import { WebAppsRestoreFromDeletedAppOptionalParams, SnapshotRestoreRequest, WebAppsRestoreSnapshotOptionalParams, - WebAppsListSiteExtensionsResponse, WebAppsGetSiteExtensionOptionalParams, WebAppsGetSiteExtensionResponse, WebAppsInstallSiteExtensionOptionalParams, WebAppsInstallSiteExtensionResponse, WebAppsDeleteSiteExtensionOptionalParams, - WebAppsListSlotsResponse, WebAppsGetSlotOptionalParams, WebAppsGetSlotResponse, WebAppsCreateOrUpdateSlotOptionalParams, @@ -444,14 +479,12 @@ import { WebAppsApplySlotConfigurationSlotOptionalParams, WebAppsBackupSlotOptionalParams, WebAppsBackupSlotResponse, - WebAppsListBackupsSlotResponse, WebAppsGetBackupStatusSlotOptionalParams, WebAppsGetBackupStatusSlotResponse, WebAppsDeleteBackupSlotOptionalParams, WebAppsListBackupStatusSecretsSlotOptionalParams, WebAppsListBackupStatusSecretsSlotResponse, WebAppsRestoreSlotOptionalParams, - WebAppsListConfigurationsSlotResponse, WebAppsUpdateApplicationSettingsSlotOptionalParams, WebAppsUpdateApplicationSettingsSlotResponse, WebAppsListApplicationSettingsSlotOptionalParams, @@ -493,7 +526,6 @@ import { WebAppsCreateOrUpdateConfigurationSlotResponse, WebAppsUpdateConfigurationSlotOptionalParams, WebAppsUpdateConfigurationSlotResponse, - WebAppsListConfigurationSnapshotInfoSlotResponse, WebAppsGetConfigurationSnapshotSlotOptionalParams, WebAppsGetConfigurationSnapshotSlotResponse, WebAppsRecoverSiteConfigurationSnapshotSlotOptionalParams, @@ -501,13 +533,11 @@ import { WebAppsGetWebSiteContainerLogsSlotResponse, WebAppsGetContainerLogsZipSlotOptionalParams, WebAppsGetContainerLogsZipSlotResponse, - WebAppsListContinuousWebJobsSlotResponse, WebAppsGetContinuousWebJobSlotOptionalParams, WebAppsGetContinuousWebJobSlotResponse, WebAppsDeleteContinuousWebJobSlotOptionalParams, WebAppsStartContinuousWebJobSlotOptionalParams, WebAppsStopContinuousWebJobSlotOptionalParams, - WebAppsListDeploymentsSlotResponse, WebAppsGetDeploymentSlotOptionalParams, WebAppsGetDeploymentSlotResponse, WebAppsCreateDeploymentSlotOptionalParams, @@ -517,7 +547,6 @@ import { WebAppsListDeploymentLogSlotResponse, WebAppsDiscoverBackupSlotOptionalParams, WebAppsDiscoverBackupSlotResponse, - WebAppsListDomainOwnershipIdentifiersSlotResponse, WebAppsGetDomainOwnershipIdentifierSlotOptionalParams, WebAppsGetDomainOwnershipIdentifierSlotResponse, WebAppsCreateOrUpdateDomainOwnershipIdentifierSlotOptionalParams, @@ -531,7 +560,6 @@ import { WebAppsCreateMSDeployOperationSlotResponse, WebAppsGetMSDeployLogSlotOptionalParams, WebAppsGetMSDeployLogSlotResponse, - WebAppsListInstanceFunctionsSlotResponse, WebAppsGetFunctionsAdminTokenSlotOptionalParams, WebAppsGetFunctionsAdminTokenSlotResponse, WebAppsGetInstanceFunctionSlotOptionalParams, @@ -553,7 +581,6 @@ import { WebAppsCreateOrUpdateHostSecretSlotOptionalParams, WebAppsCreateOrUpdateHostSecretSlotResponse, WebAppsDeleteHostSecretSlotOptionalParams, - WebAppsListHostNameBindingsSlotResponse, WebAppsGetHostNameBindingSlotOptionalParams, WebAppsGetHostNameBindingSlotResponse, WebAppsCreateOrUpdateHostNameBindingSlotOptionalParams, @@ -579,31 +606,25 @@ import { WebAppsDeleteRelayServiceConnectionSlotOptionalParams, WebAppsUpdateRelayServiceConnectionSlotOptionalParams, WebAppsUpdateRelayServiceConnectionSlotResponse, - WebAppsListInstanceIdentifiersSlotResponse, WebAppsGetInstanceMsDeployStatusSlotOptionalParams, WebAppsGetInstanceMsDeployStatusSlotResponse, WebAppsCreateInstanceMSDeployOperationSlotOptionalParams, WebAppsCreateInstanceMSDeployOperationSlotResponse, WebAppsGetInstanceMSDeployLogSlotOptionalParams, WebAppsGetInstanceMSDeployLogSlotResponse, - WebAppsListInstanceProcessesSlotResponse, WebAppsGetInstanceProcessSlotOptionalParams, WebAppsGetInstanceProcessSlotResponse, WebAppsDeleteInstanceProcessSlotOptionalParams, WebAppsGetInstanceProcessDumpSlotOptionalParams, WebAppsGetInstanceProcessDumpSlotResponse, - WebAppsListInstanceProcessModulesSlotResponse, WebAppsGetInstanceProcessModuleSlotOptionalParams, WebAppsGetInstanceProcessModuleSlotResponse, - WebAppsListInstanceProcessThreadsSlotResponse, WebAppsGetInstanceProcessThreadSlotOptionalParams, WebAppsGetInstanceProcessThreadSlotResponse, WebAppsIsCloneableSlotOptionalParams, WebAppsIsCloneableSlotResponse, WebAppsListSyncFunctionTriggersSlotOptionalParams, WebAppsListSyncFunctionTriggersSlotResponse, - WebAppsListMetricDefinitionsSlotResponse, - WebAppsListMetricsSlotResponse, WebAppsGetMigrateMySqlStatusSlotOptionalParams, WebAppsGetMigrateMySqlStatusSlotResponse, WebAppsGetSwiftVirtualNetworkConnectionSlotOptionalParams, @@ -629,7 +650,6 @@ import { WebAppsGetNetworkTracesSlotV2OptionalParams, WebAppsGetNetworkTracesSlotV2Response, WebAppsGenerateNewSitePublishingPasswordSlotOptionalParams, - WebAppsListPerfMonCountersSlotResponse, WebAppsGetSitePhpErrorLogFlagSlotOptionalParams, WebAppsGetSitePhpErrorLogFlagSlotResponse, WebAppsListPremierAddOnsSlotOptionalParams, @@ -645,19 +665,15 @@ import { WebAppsGetPrivateAccessSlotResponse, WebAppsPutPrivateAccessVnetSlotOptionalParams, WebAppsPutPrivateAccessVnetSlotResponse, - WebAppsListProcessesSlotResponse, WebAppsGetProcessSlotOptionalParams, WebAppsGetProcessSlotResponse, WebAppsDeleteProcessSlotOptionalParams, WebAppsGetProcessDumpSlotOptionalParams, WebAppsGetProcessDumpSlotResponse, - WebAppsListProcessModulesSlotResponse, WebAppsGetProcessModuleSlotOptionalParams, WebAppsGetProcessModuleSlotResponse, - WebAppsListProcessThreadsSlotResponse, WebAppsGetProcessThreadSlotOptionalParams, WebAppsGetProcessThreadSlotResponse, - WebAppsListPublicCertificatesSlotResponse, WebAppsGetPublicCertificateSlotOptionalParams, WebAppsGetPublicCertificateSlotResponse, WebAppsCreateOrUpdatePublicCertificateSlotOptionalParams, @@ -670,16 +686,12 @@ import { WebAppsRestoreFromBackupBlobSlotOptionalParams, WebAppsRestoreFromDeletedAppSlotOptionalParams, WebAppsRestoreSnapshotSlotOptionalParams, - WebAppsListSiteExtensionsSlotResponse, WebAppsGetSiteExtensionSlotOptionalParams, WebAppsGetSiteExtensionSlotResponse, WebAppsInstallSiteExtensionSlotOptionalParams, WebAppsInstallSiteExtensionSlotResponse, WebAppsDeleteSiteExtensionSlotOptionalParams, - WebAppsListSlotDifferencesSlotResponse, WebAppsSwapSlotOptionalParams, - WebAppsListSnapshotsSlotResponse, - WebAppsListSnapshotsFromDRSecondarySlotResponse, WebAppsGetSourceControlSlotOptionalParams, WebAppsGetSourceControlSlotResponse, SiteSourceControl, @@ -695,15 +707,12 @@ import { WebAppsStopNetworkTraceSlotOptionalParams, WebAppsSyncRepositorySlotOptionalParams, WebAppsSyncFunctionTriggersSlotOptionalParams, - WebAppsListTriggeredWebJobsSlotResponse, WebAppsGetTriggeredWebJobSlotOptionalParams, WebAppsGetTriggeredWebJobSlotResponse, WebAppsDeleteTriggeredWebJobSlotOptionalParams, - WebAppsListTriggeredWebJobHistorySlotResponse, WebAppsGetTriggeredWebJobHistorySlotOptionalParams, WebAppsGetTriggeredWebJobHistorySlotResponse, WebAppsRunTriggeredWebJobSlotOptionalParams, - WebAppsListUsagesSlotResponse, WebAppsListVnetConnectionsSlotOptionalParams, WebAppsListVnetConnectionsSlotResponse, WebAppsGetVnetConnectionSlotOptionalParams, @@ -721,13 +730,9 @@ import { WebAppsCreateOrUpdateVnetConnectionGatewaySlotResponse, WebAppsUpdateVnetConnectionGatewaySlotOptionalParams, WebAppsUpdateVnetConnectionGatewaySlotResponse, - WebAppsListWebJobsSlotResponse, WebAppsGetWebJobSlotOptionalParams, WebAppsGetWebJobSlotResponse, - WebAppsListSlotDifferencesFromProductionResponse, WebAppsSwapSlotWithProductionOptionalParams, - WebAppsListSnapshotsResponse, - WebAppsListSnapshotsFromDRSecondaryResponse, WebAppsGetSourceControlOptionalParams, WebAppsGetSourceControlResponse, WebAppsCreateOrUpdateSourceControlOptionalParams, @@ -742,15 +747,12 @@ import { WebAppsStopNetworkTraceOptionalParams, WebAppsSyncRepositoryOptionalParams, WebAppsSyncFunctionTriggersOptionalParams, - WebAppsListTriggeredWebJobsResponse, WebAppsGetTriggeredWebJobOptionalParams, WebAppsGetTriggeredWebJobResponse, WebAppsDeleteTriggeredWebJobOptionalParams, - WebAppsListTriggeredWebJobHistoryResponse, WebAppsGetTriggeredWebJobHistoryOptionalParams, WebAppsGetTriggeredWebJobHistoryResponse, WebAppsRunTriggeredWebJobOptionalParams, - WebAppsListUsagesResponse, WebAppsListVnetConnectionsOptionalParams, WebAppsListVnetConnectionsResponse, WebAppsGetVnetConnectionOptionalParams, @@ -766,7 +768,6 @@ import { WebAppsCreateOrUpdateVnetConnectionGatewayResponse, WebAppsUpdateVnetConnectionGatewayOptionalParams, WebAppsUpdateVnetConnectionGatewayResponse, - WebAppsListWebJobsResponse, WebAppsGetWebJobOptionalParams, WebAppsGetWebJobResponse, WebAppsListNextResponse, @@ -856,22 +857,34 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: WebAppsListOptionalParams + options?: WebAppsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -900,19 +913,33 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: WebAppsListByResourceGroupOptionalParams + options?: WebAppsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -920,7 +947,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -955,8 +984,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBackupsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBackupsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -964,11 +1001,18 @@ export class WebAppsImpl implements WebApps { private async *listBackupsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListBackupsOptionalParams + options?: WebAppsListBackupsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBackups(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListBackupsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBackups(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBackupsNext( resourceGroupName, @@ -977,7 +1021,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1018,11 +1064,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listConfigurationsPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -1031,15 +1081,18 @@ export class WebAppsImpl implements WebApps { private async *listConfigurationsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListConfigurationsOptionalParams + options?: WebAppsListConfigurationsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listConfigurations( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListConfigurationsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listConfigurations(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listConfigurationsNext( resourceGroupName, @@ -1048,7 +1101,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1090,11 +1145,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listConfigurationSnapshotInfoPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -1103,15 +1162,22 @@ export class WebAppsImpl implements WebApps { private async *listConfigurationSnapshotInfoPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListConfigurationSnapshotInfoOptionalParams + options?: WebAppsListConfigurationSnapshotInfoOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listConfigurationSnapshotInfo( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListConfigurationSnapshotInfoResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listConfigurationSnapshotInfo( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listConfigurationSnapshotInfoNext( resourceGroupName, @@ -1120,7 +1186,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1161,11 +1229,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listContinuousWebJobsPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -1174,15 +1246,22 @@ export class WebAppsImpl implements WebApps { private async *listContinuousWebJobsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListContinuousWebJobsOptionalParams + options?: WebAppsListContinuousWebJobsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listContinuousWebJobs( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListContinuousWebJobsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listContinuousWebJobs( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listContinuousWebJobsNext( resourceGroupName, @@ -1191,7 +1270,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1232,8 +1313,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listDeploymentsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listDeploymentsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -1241,11 +1330,18 @@ export class WebAppsImpl implements WebApps { private async *listDeploymentsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListDeploymentsOptionalParams + options?: WebAppsListDeploymentsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listDeployments(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListDeploymentsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listDeployments(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listDeploymentsNext( resourceGroupName, @@ -1254,7 +1350,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1295,11 +1393,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listDomainOwnershipIdentifiersPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -1308,15 +1410,22 @@ export class WebAppsImpl implements WebApps { private async *listDomainOwnershipIdentifiersPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListDomainOwnershipIdentifiersOptionalParams + options?: WebAppsListDomainOwnershipIdentifiersOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listDomainOwnershipIdentifiers( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListDomainOwnershipIdentifiersResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listDomainOwnershipIdentifiers( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listDomainOwnershipIdentifiersNext( resourceGroupName, @@ -1325,7 +1434,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1362,8 +1473,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listFunctionsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listFunctionsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -1371,11 +1490,18 @@ export class WebAppsImpl implements WebApps { private async *listFunctionsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListFunctionsOptionalParams + options?: WebAppsListFunctionsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listFunctions(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListFunctionsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listFunctions(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listFunctionsNext( resourceGroupName, @@ -1384,7 +1510,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1425,11 +1553,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listHostNameBindingsPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -1438,15 +1570,22 @@ export class WebAppsImpl implements WebApps { private async *listHostNameBindingsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListHostNameBindingsOptionalParams + options?: WebAppsListHostNameBindingsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listHostNameBindings( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListHostNameBindingsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listHostNameBindings( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listHostNameBindingsNext( resourceGroupName, @@ -1455,7 +1594,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1496,11 +1637,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceIdentifiersPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -1509,15 +1654,22 @@ export class WebAppsImpl implements WebApps { private async *listInstanceIdentifiersPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListInstanceIdentifiersOptionalParams + options?: WebAppsListInstanceIdentifiersOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceIdentifiers( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceIdentifiersResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceIdentifiers( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceIdentifiersNext( resourceGroupName, @@ -1526,7 +1678,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1572,12 +1726,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceProcessesPagingPage( resourceGroupName, name, instanceId, - options + options, + settings ); } }; @@ -1587,16 +1745,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, instanceId: string, - options?: WebAppsListInstanceProcessesOptionalParams + options?: WebAppsListInstanceProcessesOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceProcesses( - resourceGroupName, - name, - instanceId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceProcessesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceProcesses( + resourceGroupName, + name, + instanceId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceProcessesNext( resourceGroupName, @@ -1606,7 +1771,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1656,13 +1823,17 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceProcessModulesPagingPage( resourceGroupName, name, processId, instanceId, - options + options, + settings ); } }; @@ -1673,17 +1844,24 @@ export class WebAppsImpl implements WebApps { name: string, processId: string, instanceId: string, - options?: WebAppsListInstanceProcessModulesOptionalParams + options?: WebAppsListInstanceProcessModulesOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceProcessModules( - resourceGroupName, - name, - processId, - instanceId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceProcessModulesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceProcessModules( + resourceGroupName, + name, + processId, + instanceId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceProcessModulesNext( resourceGroupName, @@ -1694,7 +1872,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1746,13 +1926,17 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceProcessThreadsPagingPage( resourceGroupName, name, processId, instanceId, - options + options, + settings ); } }; @@ -1763,17 +1947,24 @@ export class WebAppsImpl implements WebApps { name: string, processId: string, instanceId: string, - options?: WebAppsListInstanceProcessThreadsOptionalParams + options?: WebAppsListInstanceProcessThreadsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceProcessThreads( - resourceGroupName, - name, - processId, - instanceId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceProcessThreadsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceProcessThreads( + resourceGroupName, + name, + processId, + instanceId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceProcessThreadsNext( resourceGroupName, @@ -1784,7 +1975,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1829,11 +2022,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listMetricDefinitionsPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -1842,15 +2039,22 @@ export class WebAppsImpl implements WebApps { private async *listMetricDefinitionsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListMetricDefinitionsOptionalParams + options?: WebAppsListMetricDefinitionsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listMetricDefinitions( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListMetricDefinitionsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listMetricDefinitions( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listMetricDefinitionsNext( resourceGroupName, @@ -1859,7 +2063,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1896,8 +2102,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listMetricsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listMetricsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -1905,11 +2119,18 @@ export class WebAppsImpl implements WebApps { private async *listMetricsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListMetricsOptionalParams + options?: WebAppsListMetricsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listMetrics(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListMetricsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listMetrics(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listMetricsNext( resourceGroupName, @@ -1918,7 +2139,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1959,11 +2182,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPerfMonCountersPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -1972,15 +2199,22 @@ export class WebAppsImpl implements WebApps { private async *listPerfMonCountersPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListPerfMonCountersOptionalParams + options?: WebAppsListPerfMonCountersOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listPerfMonCounters( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListPerfMonCountersResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listPerfMonCounters( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listPerfMonCountersNext( resourceGroupName, @@ -1989,7 +2223,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2027,8 +2263,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listProcessesPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listProcessesPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -2036,11 +2280,18 @@ export class WebAppsImpl implements WebApps { private async *listProcessesPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListProcessesOptionalParams + options?: WebAppsListProcessesOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listProcesses(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListProcessesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listProcesses(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listProcessesNext( resourceGroupName, @@ -2049,7 +2300,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2093,12 +2346,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listProcessModulesPagingPage( resourceGroupName, name, processId, - options + options, + settings ); } }; @@ -2108,16 +2365,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, processId: string, - options?: WebAppsListProcessModulesOptionalParams + options?: WebAppsListProcessModulesOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listProcessModules( - resourceGroupName, - name, - processId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListProcessModulesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listProcessModules( + resourceGroupName, + name, + processId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listProcessModulesNext( resourceGroupName, @@ -2127,7 +2391,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2173,12 +2439,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listProcessThreadsPagingPage( resourceGroupName, name, processId, - options + options, + settings ); } }; @@ -2188,16 +2458,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, processId: string, - options?: WebAppsListProcessThreadsOptionalParams + options?: WebAppsListProcessThreadsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listProcessThreads( - resourceGroupName, - name, - processId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListProcessThreadsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listProcessThreads( + resourceGroupName, + name, + processId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listProcessThreadsNext( resourceGroupName, @@ -2207,7 +2484,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2250,11 +2529,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPublicCertificatesPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -2263,15 +2546,22 @@ export class WebAppsImpl implements WebApps { private async *listPublicCertificatesPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListPublicCertificatesOptionalParams + options?: WebAppsListPublicCertificatesOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listPublicCertificates( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListPublicCertificatesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listPublicCertificates( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listPublicCertificatesNext( resourceGroupName, @@ -2280,7 +2570,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2321,11 +2613,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSiteExtensionsPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -2334,15 +2630,18 @@ export class WebAppsImpl implements WebApps { private async *listSiteExtensionsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListSiteExtensionsOptionalParams + options?: WebAppsListSiteExtensionsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSiteExtensions( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSiteExtensionsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSiteExtensions(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSiteExtensionsNext( resourceGroupName, @@ -2351,7 +2650,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2388,8 +2689,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listSlotsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listSlotsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -2397,11 +2706,18 @@ export class WebAppsImpl implements WebApps { private async *listSlotsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListSlotsOptionalParams + options?: WebAppsListSlotsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSlots(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSlotsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSlots(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSlotsNext( resourceGroupName, @@ -2410,7 +2726,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2455,12 +2773,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listBackupsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -2470,16 +2792,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListBackupsSlotOptionalParams + options?: WebAppsListBackupsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBackupsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListBackupsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBackupsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBackupsSlotNext( resourceGroupName, @@ -2489,7 +2818,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2536,12 +2867,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listConfigurationsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -2551,16 +2886,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListConfigurationsSlotOptionalParams + options?: WebAppsListConfigurationsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listConfigurationsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListConfigurationsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listConfigurationsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listConfigurationsSlotNext( resourceGroupName, @@ -2570,7 +2912,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2618,12 +2962,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listConfigurationSnapshotInfoSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -2633,16 +2981,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListConfigurationSnapshotInfoSlotOptionalParams + options?: WebAppsListConfigurationSnapshotInfoSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listConfigurationSnapshotInfoSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListConfigurationSnapshotInfoSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listConfigurationSnapshotInfoSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listConfigurationSnapshotInfoSlotNext( resourceGroupName, @@ -2652,7 +3007,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2699,12 +3056,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listContinuousWebJobsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -2714,16 +3075,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListContinuousWebJobsSlotOptionalParams + options?: WebAppsListContinuousWebJobsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listContinuousWebJobsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListContinuousWebJobsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listContinuousWebJobsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listContinuousWebJobsSlotNext( resourceGroupName, @@ -2733,7 +3101,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2780,12 +3150,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listDeploymentsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -2795,16 +3169,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListDeploymentsSlotOptionalParams + options?: WebAppsListDeploymentsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listDeploymentsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListDeploymentsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listDeploymentsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listDeploymentsSlotNext( resourceGroupName, @@ -2814,7 +3195,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2861,12 +3244,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listDomainOwnershipIdentifiersSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -2876,16 +3263,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListDomainOwnershipIdentifiersSlotOptionalParams + options?: WebAppsListDomainOwnershipIdentifiersSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listDomainOwnershipIdentifiersSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListDomainOwnershipIdentifiersSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listDomainOwnershipIdentifiersSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listDomainOwnershipIdentifiersSlotNext( resourceGroupName, @@ -2895,7 +3289,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -2941,12 +3337,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceFunctionsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -2956,16 +3356,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListInstanceFunctionsSlotOptionalParams + options?: WebAppsListInstanceFunctionsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceFunctionsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceFunctionsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceFunctionsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceFunctionsSlotNext( resourceGroupName, @@ -2975,7 +3382,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3022,12 +3431,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listHostNameBindingsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -3037,16 +3450,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListHostNameBindingsSlotOptionalParams + options?: WebAppsListHostNameBindingsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listHostNameBindingsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListHostNameBindingsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listHostNameBindingsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listHostNameBindingsSlotNext( resourceGroupName, @@ -3056,7 +3476,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3103,12 +3525,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceIdentifiersSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -3118,16 +3544,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListInstanceIdentifiersSlotOptionalParams + options?: WebAppsListInstanceIdentifiersSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceIdentifiersSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceIdentifiersSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceIdentifiersSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceIdentifiersSlotNext( resourceGroupName, @@ -3137,7 +3570,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3189,13 +3624,17 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceProcessesSlotPagingPage( resourceGroupName, name, slot, instanceId, - options + options, + settings ); } }; @@ -3206,17 +3645,24 @@ export class WebAppsImpl implements WebApps { name: string, slot: string, instanceId: string, - options?: WebAppsListInstanceProcessesSlotOptionalParams + options?: WebAppsListInstanceProcessesSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceProcessesSlot( - resourceGroupName, - name, - slot, - instanceId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceProcessesSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceProcessesSlot( + resourceGroupName, + name, + slot, + instanceId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceProcessesSlotNext( resourceGroupName, @@ -3227,7 +3673,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3283,14 +3731,18 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceProcessModulesSlotPagingPage( resourceGroupName, name, processId, slot, instanceId, - options + options, + settings ); } }; @@ -3302,18 +3754,25 @@ export class WebAppsImpl implements WebApps { processId: string, slot: string, instanceId: string, - options?: WebAppsListInstanceProcessModulesSlotOptionalParams + options?: WebAppsListInstanceProcessModulesSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceProcessModulesSlot( - resourceGroupName, - name, - processId, - slot, - instanceId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceProcessModulesSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceProcessModulesSlot( + resourceGroupName, + name, + processId, + slot, + instanceId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceProcessModulesSlotNext( resourceGroupName, @@ -3325,7 +3784,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3383,14 +3844,18 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listInstanceProcessThreadsSlotPagingPage( resourceGroupName, name, processId, slot, instanceId, - options + options, + settings ); } }; @@ -3402,18 +3867,25 @@ export class WebAppsImpl implements WebApps { processId: string, slot: string, instanceId: string, - options?: WebAppsListInstanceProcessThreadsSlotOptionalParams + options?: WebAppsListInstanceProcessThreadsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listInstanceProcessThreadsSlot( - resourceGroupName, - name, - processId, - slot, - instanceId, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListInstanceProcessThreadsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listInstanceProcessThreadsSlot( + resourceGroupName, + name, + processId, + slot, + instanceId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listInstanceProcessThreadsSlotNext( resourceGroupName, @@ -3425,7 +3897,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3476,12 +3950,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listMetricDefinitionsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -3491,16 +3969,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListMetricDefinitionsSlotOptionalParams + options?: WebAppsListMetricDefinitionsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listMetricDefinitionsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListMetricDefinitionsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listMetricDefinitionsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listMetricDefinitionsSlotNext( resourceGroupName, @@ -3510,7 +3995,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3557,12 +4044,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listMetricsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -3572,16 +4063,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListMetricsSlotOptionalParams + options?: WebAppsListMetricsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listMetricsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListMetricsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listMetricsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listMetricsSlotNext( resourceGroupName, @@ -3591,7 +4089,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3637,12 +4137,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPerfMonCountersSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -3652,16 +4156,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListPerfMonCountersSlotOptionalParams + options?: WebAppsListPerfMonCountersSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listPerfMonCountersSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListPerfMonCountersSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listPerfMonCountersSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listPerfMonCountersSlotNext( resourceGroupName, @@ -3671,7 +4182,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3719,12 +4232,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listProcessesSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -3734,16 +4251,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListProcessesSlotOptionalParams + options?: WebAppsListProcessesSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listProcessesSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListProcessesSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listProcessesSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listProcessesSlotNext( resourceGroupName, @@ -3753,7 +4277,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3803,13 +4329,17 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listProcessModulesSlotPagingPage( resourceGroupName, name, processId, slot, - options + options, + settings ); } }; @@ -3820,17 +4350,24 @@ export class WebAppsImpl implements WebApps { name: string, processId: string, slot: string, - options?: WebAppsListProcessModulesSlotOptionalParams + options?: WebAppsListProcessModulesSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listProcessModulesSlot( - resourceGroupName, - name, - processId, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListProcessModulesSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listProcessModulesSlot( + resourceGroupName, + name, + processId, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listProcessModulesSlotNext( resourceGroupName, @@ -3841,7 +4378,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3893,13 +4432,17 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listProcessThreadsSlotPagingPage( resourceGroupName, name, processId, slot, - options + options, + settings ); } }; @@ -3910,17 +4453,24 @@ export class WebAppsImpl implements WebApps { name: string, processId: string, slot: string, - options?: WebAppsListProcessThreadsSlotOptionalParams + options?: WebAppsListProcessThreadsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listProcessThreadsSlot( - resourceGroupName, - name, - processId, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListProcessThreadsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listProcessThreadsSlot( + resourceGroupName, + name, + processId, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listProcessThreadsSlotNext( resourceGroupName, @@ -3931,7 +4481,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -3980,12 +4532,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPublicCertificatesSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -3995,16 +4551,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListPublicCertificatesSlotOptionalParams + options?: WebAppsListPublicCertificatesSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listPublicCertificatesSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListPublicCertificatesSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listPublicCertificatesSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listPublicCertificatesSlotNext( resourceGroupName, @@ -4014,7 +4577,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4061,12 +4626,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSiteExtensionsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -4076,16 +4645,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListSiteExtensionsSlotOptionalParams + options?: WebAppsListSiteExtensionsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSiteExtensionsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSiteExtensionsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSiteExtensionsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSiteExtensionsSlotNext( resourceGroupName, @@ -4095,7 +4671,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4145,13 +4723,17 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSlotDifferencesSlotPagingPage( resourceGroupName, name, slot, slotSwapEntity, - options + options, + settings ); } }; @@ -4162,17 +4744,24 @@ export class WebAppsImpl implements WebApps { name: string, slot: string, slotSwapEntity: CsmSlotEntity, - options?: WebAppsListSlotDifferencesSlotOptionalParams + options?: WebAppsListSlotDifferencesSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSlotDifferencesSlot( - resourceGroupName, - name, - slot, - slotSwapEntity, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSlotDifferencesSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSlotDifferencesSlot( + resourceGroupName, + name, + slot, + slotSwapEntity, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSlotDifferencesSlotNext( resourceGroupName, @@ -4183,7 +4772,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4231,12 +4822,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSnapshotsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -4246,16 +4841,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListSnapshotsSlotOptionalParams + options?: WebAppsListSnapshotsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSnapshotsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSnapshotsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSnapshotsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSnapshotsSlotNext( resourceGroupName, @@ -4265,7 +4867,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4311,12 +4915,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSnapshotsFromDRSecondarySlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -4326,16 +4934,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListSnapshotsFromDRSecondarySlotOptionalParams + options?: WebAppsListSnapshotsFromDRSecondarySlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSnapshotsFromDRSecondarySlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSnapshotsFromDRSecondarySlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSnapshotsFromDRSecondarySlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSnapshotsFromDRSecondarySlotNext( resourceGroupName, @@ -4345,7 +4960,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4392,12 +5009,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listTriggeredWebJobsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -4407,16 +5028,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListTriggeredWebJobsSlotOptionalParams + options?: WebAppsListTriggeredWebJobsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listTriggeredWebJobsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListTriggeredWebJobsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listTriggeredWebJobsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listTriggeredWebJobsSlotNext( resourceGroupName, @@ -4426,7 +5054,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4476,13 +5106,17 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listTriggeredWebJobHistorySlotPagingPage( resourceGroupName, name, webJobName, slot, - options + options, + settings ); } }; @@ -4493,17 +5127,24 @@ export class WebAppsImpl implements WebApps { name: string, webJobName: string, slot: string, - options?: WebAppsListTriggeredWebJobHistorySlotOptionalParams + options?: WebAppsListTriggeredWebJobHistorySlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listTriggeredWebJobHistorySlot( - resourceGroupName, - name, - webJobName, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListTriggeredWebJobHistorySlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listTriggeredWebJobHistorySlot( + resourceGroupName, + name, + webJobName, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listTriggeredWebJobHistorySlotNext( resourceGroupName, @@ -4514,7 +5155,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4563,12 +5206,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listUsagesSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -4578,16 +5225,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListUsagesSlotOptionalParams + options?: WebAppsListUsagesSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listUsagesSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListUsagesSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listUsagesSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listUsagesSlotNext( resourceGroupName, @@ -4597,7 +5251,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4644,12 +5300,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listWebJobsSlotPagingPage( resourceGroupName, name, slot, - options + options, + settings ); } }; @@ -4659,16 +5319,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slot: string, - options?: WebAppsListWebJobsSlotOptionalParams + options?: WebAppsListWebJobsSlotOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listWebJobsSlot( - resourceGroupName, - name, - slot, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListWebJobsSlotResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listWebJobsSlot( + resourceGroupName, + name, + slot, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listWebJobsSlotNext( resourceGroupName, @@ -4678,7 +5345,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4724,12 +5393,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSlotDifferencesFromProductionPagingPage( resourceGroupName, name, slotSwapEntity, - options + options, + settings ); } }; @@ -4739,16 +5412,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, slotSwapEntity: CsmSlotEntity, - options?: WebAppsListSlotDifferencesFromProductionOptionalParams + options?: WebAppsListSlotDifferencesFromProductionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSlotDifferencesFromProduction( - resourceGroupName, - name, - slotSwapEntity, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSlotDifferencesFromProductionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSlotDifferencesFromProduction( + resourceGroupName, + name, + slotSwapEntity, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSlotDifferencesFromProductionNext( resourceGroupName, @@ -4758,7 +5438,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4797,8 +5479,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listSnapshotsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listSnapshotsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -4806,11 +5496,18 @@ export class WebAppsImpl implements WebApps { private async *listSnapshotsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListSnapshotsOptionalParams + options?: WebAppsListSnapshotsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSnapshots(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSnapshotsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSnapshots(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSnapshotsNext( resourceGroupName, @@ -4819,7 +5516,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4860,11 +5559,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSnapshotsFromDRSecondaryPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -4873,15 +5576,22 @@ export class WebAppsImpl implements WebApps { private async *listSnapshotsFromDRSecondaryPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListSnapshotsFromDRSecondaryOptionalParams + options?: WebAppsListSnapshotsFromDRSecondaryOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSnapshotsFromDRSecondary( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListSnapshotsFromDRSecondaryResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSnapshotsFromDRSecondary( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSnapshotsFromDRSecondaryNext( resourceGroupName, @@ -4890,7 +5600,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -4931,11 +5643,15 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listTriggeredWebJobsPagingPage( resourceGroupName, name, - options + options, + settings ); } }; @@ -4944,15 +5660,22 @@ export class WebAppsImpl implements WebApps { private async *listTriggeredWebJobsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListTriggeredWebJobsOptionalParams + options?: WebAppsListTriggeredWebJobsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listTriggeredWebJobs( - resourceGroupName, - name, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListTriggeredWebJobsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listTriggeredWebJobs( + resourceGroupName, + name, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listTriggeredWebJobsNext( resourceGroupName, @@ -4961,7 +5684,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -5005,12 +5730,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listTriggeredWebJobHistoryPagingPage( resourceGroupName, name, webJobName, - options + options, + settings ); } }; @@ -5020,16 +5749,23 @@ export class WebAppsImpl implements WebApps { resourceGroupName: string, name: string, webJobName: string, - options?: WebAppsListTriggeredWebJobHistoryOptionalParams + options?: WebAppsListTriggeredWebJobHistoryOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listTriggeredWebJobHistory( - resourceGroupName, - name, - webJobName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListTriggeredWebJobHistoryResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listTriggeredWebJobHistory( + resourceGroupName, + name, + webJobName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listTriggeredWebJobHistoryNext( resourceGroupName, @@ -5039,7 +5775,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -5078,8 +5816,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listUsagesPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listUsagesPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -5087,11 +5833,18 @@ export class WebAppsImpl implements WebApps { private async *listUsagesPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListUsagesOptionalParams + options?: WebAppsListUsagesOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listUsages(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListUsagesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listUsages(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listUsagesNext( resourceGroupName, @@ -5100,7 +5853,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -5137,8 +5892,16 @@ export class WebAppsImpl implements WebApps { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listWebJobsPagingPage(resourceGroupName, name, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listWebJobsPagingPage( + resourceGroupName, + name, + options, + settings + ); } }; } @@ -5146,11 +5909,18 @@ export class WebAppsImpl implements WebApps { private async *listWebJobsPagingPage( resourceGroupName: string, name: string, - options?: WebAppsListWebJobsOptionalParams + options?: WebAppsListWebJobsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listWebJobs(resourceGroupName, name, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WebAppsListWebJobsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listWebJobs(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listWebJobsNext( resourceGroupName, @@ -5159,7 +5929,9 @@ export class WebAppsImpl implements WebApps { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -5282,10 +6054,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, siteEnvelope, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -5541,10 +6315,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, backupId, request, options }, restoreOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -5919,10 +6695,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, options }, listPublishingCredentialsOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -6561,10 +7339,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, mSDeploy, options }, createMSDeployOperationOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -6723,10 +7503,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, functionName, functionEnvelope, options }, createFunctionOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -7363,10 +8145,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, instanceId, mSDeploy, options }, createInstanceMSDeployOperationOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -7726,10 +8510,12 @@ export class WebAppsImpl implements WebApps { { subscriptionName, resourceGroupName, name, migrationOptions, options }, migrateStorageOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -7819,10 +8605,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, migrationRequestEnvelope, options }, migrateMySqlOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -8058,10 +8846,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, options }, startWebSiteNetworkTraceOperationOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -8695,10 +9485,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, request, options }, restoreFromBackupBlobOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -8780,10 +9572,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, restoreRequest, options }, restoreFromDeletedAppOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -8866,10 +9660,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, restoreRequest, options }, restoreSnapshotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -8993,10 +9789,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, siteExtensionId, options }, installSiteExtensionOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -9141,10 +9939,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, siteEnvelope, options }, createOrUpdateSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -9430,10 +10230,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, backupId, slot, request, options }, restoreSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -9862,10 +10664,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, options }, listPublishingCredentialsSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -10551,10 +11355,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, mSDeploy, options }, createMSDeployOperationSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -10733,10 +11539,12 @@ export class WebAppsImpl implements WebApps { }, createInstanceFunctionSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -11458,10 +12266,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, instanceId, mSDeploy, options }, createInstanceMSDeployOperationSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -12048,10 +12858,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, options }, startWebSiteNetworkTraceOperationSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -12788,10 +13600,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, request, options }, restoreFromBackupBlobSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -12879,10 +13693,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, restoreRequest, options }, restoreFromDeletedAppSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -12970,10 +13786,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, restoreRequest, options }, restoreSnapshotSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -13109,10 +13927,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, siteExtensionId, slot, options }, installSiteExtensionSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -13245,10 +14065,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, slotSwapEntity, options }, swapSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -13400,10 +14222,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, siteSourceControl, options }, createOrUpdateSourceControlSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -13556,10 +14380,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slot, options }, startNetworkTraceSlotOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -14137,10 +14963,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, slotSwapEntity, options }, swapSlotWithProductionOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -14278,10 +15106,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, siteSourceControl, options }, createOrUpdateSourceControlOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -14419,10 +15249,12 @@ export class WebAppsImpl implements WebApps { { resourceGroupName, name, options }, startNetworkTraceOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -24403,7 +25235,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24423,7 +25254,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.includeSlots], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24444,7 +25274,6 @@ const listBackupsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24466,7 +25295,6 @@ const listConfigurationsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24488,7 +25316,6 @@ const listConfigurationSnapshotInfoNextOperationSpec: coreClient.OperationSpec = bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24510,7 +25337,6 @@ const listContinuousWebJobsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24532,7 +25358,6 @@ const listDeploymentsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24554,7 +25379,6 @@ const listDomainOwnershipIdentifiersNextOperationSpec: coreClient.OperationSpec bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24574,7 +25398,6 @@ const listFunctionsNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24596,7 +25419,6 @@ const listHostNameBindingsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24618,7 +25440,6 @@ const listInstanceIdentifiersNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24638,7 +25459,6 @@ const listInstanceProcessesNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24659,7 +25479,6 @@ const listInstanceProcessModulesNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24681,7 +25500,6 @@ const listInstanceProcessThreadsNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24705,7 +25523,6 @@ const listMetricDefinitionsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24727,11 +25544,6 @@ const listMetricsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.details, - Parameters.filter - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24753,7 +25565,6 @@ const listPerfMonCountersNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24773,7 +25584,6 @@ const listProcessesNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24793,7 +25603,6 @@ const listProcessModulesNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24814,7 +25623,6 @@ const listProcessThreadsNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24837,7 +25645,6 @@ const listPublicCertificatesNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24857,7 +25664,6 @@ const listSiteExtensionsNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24879,7 +25685,6 @@ const listSlotsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24901,7 +25706,6 @@ const listBackupsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24924,7 +25728,6 @@ const listConfigurationsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24947,7 +25750,6 @@ const listConfigurationSnapshotInfoSlotNextOperationSpec: coreClient.OperationSp bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24970,7 +25772,6 @@ const listContinuousWebJobsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -24993,7 +25794,6 @@ const listDeploymentsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25016,7 +25816,6 @@ const listDomainOwnershipIdentifiersSlotNextOperationSpec: coreClient.OperationS bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25037,7 +25836,6 @@ const listInstanceFunctionsSlotNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25060,7 +25858,6 @@ const listHostNameBindingsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25083,7 +25880,6 @@ const listInstanceIdentifiersSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25104,7 +25900,6 @@ const listInstanceProcessesSlotNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25126,7 +25921,6 @@ const listInstanceProcessModulesSlotNextOperationSpec: coreClient.OperationSpec }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25149,7 +25943,6 @@ const listInstanceProcessThreadsSlotNextOperationSpec: coreClient.OperationSpec }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25174,7 +25967,6 @@ const listMetricDefinitionsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25197,11 +25989,6 @@ const listMetricsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.details, - Parameters.filter - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25224,7 +26011,6 @@ const listPerfMonCountersSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25245,7 +26031,6 @@ const listProcessesSlotNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25266,7 +26051,6 @@ const listProcessModulesSlotNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25288,7 +26072,6 @@ const listProcessThreadsSlotNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25312,7 +26095,6 @@ const listPublicCertificatesSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25333,7 +26115,6 @@ const listSiteExtensionsSlotNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25356,7 +26137,6 @@ const listSlotDifferencesSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25380,7 +26160,6 @@ const listSnapshotsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25403,7 +26182,6 @@ const listSnapshotsFromDRSecondarySlotNextOperationSpec: coreClient.OperationSpe bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25426,7 +26204,6 @@ const listTriggeredWebJobsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25447,7 +26224,6 @@ const listTriggeredWebJobHistorySlotNextOperationSpec: coreClient.OperationSpec }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25471,7 +26247,6 @@ const listUsagesSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25494,7 +26269,6 @@ const listWebJobsSlotNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25517,7 +26291,6 @@ const listSlotDifferencesFromProductionNextOperationSpec: coreClient.OperationSp bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25540,7 +26313,6 @@ const listSnapshotsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25562,7 +26334,6 @@ const listSnapshotsFromDRSecondaryNextOperationSpec: coreClient.OperationSpec = bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25584,7 +26355,6 @@ const listTriggeredWebJobsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25604,7 +26374,6 @@ const listTriggeredWebJobHistoryNextOperationSpec: coreClient.OperationSpec = { }, 404: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25627,7 +26396,6 @@ const listUsagesNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -25649,7 +26417,6 @@ const listWebJobsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/pagingHelper.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/pagingHelper.ts new file mode 100644 index 00000000000..269a2b9814b --- /dev/null +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/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/appservice/arm-appservice-profile-2020-09-01-hybrid/src/webSiteManagementClient.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/webSiteManagementClient.ts index 988896ca6aa..44485a5d426 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/webSiteManagementClient.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/src/webSiteManagementClient.ts @@ -7,8 +7,15 @@ */ 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "./pagingHelper"; import { CertificatesImpl, WebAppsImpl, @@ -30,38 +37,38 @@ import { SourceControl, ListSourceControlsNextOptionalParams, ListSourceControlsOptionalParams, + ListSourceControlsResponse, BillingMeter, ListBillingMetersNextOptionalParams, ListBillingMetersOptionalParams, + ListBillingMetersResponse, GeoRegion, ListGeoRegionsNextOptionalParams, ListGeoRegionsOptionalParams, + ListGeoRegionsResponse, Identifier, NameIdentifier, ListSiteIdentifiersAssignedToHostNameNextOptionalParams, ListSiteIdentifiersAssignedToHostNameOptionalParams, + ListSiteIdentifiersAssignedToHostNameResponse, PremierAddOnOffer, ListPremierAddOnOffersNextOptionalParams, ListPremierAddOnOffersOptionalParams, + ListPremierAddOnOffersResponse, GetPublishingUserOptionalParams, GetPublishingUserResponse, User, UpdatePublishingUserOptionalParams, UpdatePublishingUserResponse, - ListSourceControlsResponse, GetSourceControlOptionalParams, GetSourceControlResponse, UpdateSourceControlOptionalParams, UpdateSourceControlResponse, - ListBillingMetersResponse, CheckNameResourceTypes, CheckNameAvailabilityOptionalParams, CheckNameAvailabilityResponse, GetSubscriptionDeploymentLocationsOptionalParams, GetSubscriptionDeploymentLocationsResponse, - ListGeoRegionsResponse, - ListSiteIdentifiersAssignedToHostNameResponse, - ListPremierAddOnOffersResponse, ListSkusOptionalParams, ListSkusResponse, VnetParameters, @@ -117,24 +124,54 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-appservice-profile-2020-09-01-hybrid/2.0.0`; + const packageDetails = `azsdk-js-arm-appservice-profile-2020-09-01-hybrid/2.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + 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; @@ -146,6 +183,35 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { this.appServicePlans = new AppServicePlansImpl(this); this.provider = new ProviderImpl(this); this.recommendations = new RecommendationsImpl(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); } /** @@ -163,22 +229,34 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listSourceControlsPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listSourceControlsPagingPage(options, settings); } }; } private async *listSourceControlsPagingPage( - options?: ListSourceControlsOptionalParams + options?: ListSourceControlsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSourceControls(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ListSourceControlsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSourceControls(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSourceControlsNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -205,22 +283,34 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBillingMetersPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBillingMetersPagingPage(options, settings); } }; } private async *listBillingMetersPagingPage( - options?: ListBillingMetersOptionalParams + options?: ListBillingMetersOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBillingMeters(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ListBillingMetersResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBillingMeters(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBillingMetersNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -247,22 +337,34 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listGeoRegionsPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listGeoRegionsPagingPage(options, settings); } }; } private async *listGeoRegionsPagingPage( - options?: ListGeoRegionsOptionalParams + options?: ListGeoRegionsOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listGeoRegions(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ListGeoRegionsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listGeoRegions(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listGeoRegionsNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -294,10 +396,14 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSiteIdentifiersAssignedToHostNamePagingPage( nameIdentifier, - options + options, + settings ); } }; @@ -305,14 +411,21 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { private async *listSiteIdentifiersAssignedToHostNamePagingPage( nameIdentifier: NameIdentifier, - options?: ListSiteIdentifiersAssignedToHostNameOptionalParams + options?: ListSiteIdentifiersAssignedToHostNameOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSiteIdentifiersAssignedToHostName( - nameIdentifier, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ListSiteIdentifiersAssignedToHostNameResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSiteIdentifiersAssignedToHostName( + nameIdentifier, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSiteIdentifiersAssignedToHostNameNext( nameIdentifier, @@ -320,7 +433,9 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -351,25 +466,37 @@ export class WebSiteManagementClient extends coreClient.ServiceClient { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPremierAddOnOffersPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPremierAddOnOffersPagingPage(options, settings); } }; } private async *listPremierAddOnOffersPagingPage( - options?: ListPremierAddOnOffersOptionalParams + options?: ListPremierAddOnOffersOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listPremierAddOnOffers(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ListPremierAddOnOffersResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listPremierAddOnOffers(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listPremierAddOnOffersNext( continuationToken, options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1045,7 +1172,6 @@ const listSourceControlsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer @@ -1061,11 +1187,6 @@ const listBillingMetersNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.billingLocation, - Parameters.osType - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1085,13 +1206,6 @@ const listGeoRegionsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.sku, - Parameters.linuxWorkersEnabled, - Parameters.xenonWorkersEnabled, - Parameters.linuxDynamicWorkersEnabled - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1111,7 +1225,6 @@ const listSiteIdentifiersAssignedToHostNameNextOperationSpec: coreClient.Operati bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1132,7 +1245,6 @@ const listPremierAddOnOffersNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DefaultErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/test/sampleTest.ts b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/test/sampleTest.ts index 7ed89b043e1..25aeb3ebcc3 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/test/sampleTest.ts +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables }; describe("My test", () => { let recorder: Recorder; - beforeEach(async function() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/tsconfig.json b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/tsconfig.json index 3e6ae96443f..927a5fc4a17 100644 --- a/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/tsconfig.json +++ b/sdk/appservice/arm-appservice-profile-2020-09-01-hybrid/tsconfig.json @@ -15,11 +15,17 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-appservice-profile-2020-09-01-hybrid": [ + "./src/index" + ] + } }, "include": [ "./src/**/*.ts", - "./test/**/*.ts" + "./test/**/*.ts", + "samples-dev/**/*.ts" ], "exclude": [ "node_modules" diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/CHANGELOG.md b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/CHANGELOG.md index fe4a9b0eab1..5520d45201f 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/CHANGELOG.md +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/CHANGELOG.md @@ -1,15 +1,17 @@ # Release History + +## 2.1.0 (2022-12-19) + +**Features** -## 2.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Interface ProviderOperationsMetadataListNextOptionalParams no longer has parameter expand + - Interface RoleAssignmentsListForResourceGroupNextOptionalParams no longer has parameter filter + - Interface RoleAssignmentsListForResourceNextOptionalParams no longer has parameter filter + - Interface RoleAssignmentsListForScopeNextOptionalParams no longer has parameter filter + - Interface RoleAssignmentsListNextOptionalParams no longer has parameter filter + - Interface RoleDefinitionsListNextOptionalParams no longer has parameter filter + + ## 2.0.0 (2022-03-10) The package of @azure/arm-authorization-profile-2020-09-01-hybrid is using our next generation design principles since version 2.0.0, which contains breaking changes. diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/_meta.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/_meta.json index 4a5f7171ff5..2f1a536ca3e 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/_meta.json +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/_meta.json @@ -1,8 +1,8 @@ { "commit": "1067b78669466324a1a2666adf053433c61e7f77", "readme": "specification/authorization/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\authorization\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --tag=profile-hybrid-2020-09-01 --profile-content=profile-hybrid-2020-09-01", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\authorization\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.5.20221215.1 --generate-sample=true --profile-content=profile-hybrid-2020-09-01", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.1.1", - "use": "@autorest/typescript@6.0.0-beta.16" + "release_tool": "@azure-tools/js-sdk-release-tools@2.5.4", + "use": "@autorest/typescript@6.0.0-rc.5.20221215.1" } \ No newline at end of file diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/package.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/package.json index 4c94a3ee967..b3e2457f3ed 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/package.json +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for AuthorizationManagementClient.", - "version": "2.0.1", + "version": "2.1.0", "engines": { "node": ">=14.0.0" }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -34,15 +34,20 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.2.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^8.2.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "@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" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -91,9 +96,8 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", - "integration-test:browser": "echo skipped", - "docs": "echo skipped" + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, "//metadata": { @@ -104,5 +108,14 @@ } ] }, - "autoPublish": true + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-authorization-profile-2020-09-01-hybrid?view=azure-node-preview" + } } diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.js deleted file mode 100644 index 0f6ecb857ac..00000000000 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.js +++ /dev/null @@ -1,5 +0,0 @@ -let nock = require('nock'); - -module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; - -module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json new file mode 100644 index 00000000000..f721723386d --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/review/arm-authorization-profile-2020-09-01-hybrid.api.md b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/review/arm-authorization-profile-2020-09-01-hybrid.api.md index 061f338972a..c514484715c 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/review/arm-authorization-profile-2020-09-01-hybrid.api.md +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/review/arm-authorization-profile-2020-09-01-hybrid.api.md @@ -56,6 +56,9 @@ export interface ErrorResponse { error?: ErrorDetail; } +// @public +export function getContinuationToken(page: unknown): string | undefined; + // @public export interface GlobalAdministrator { elevateAccess(options?: GlobalAdministratorElevateAccessOptionalParams): Promise; @@ -141,7 +144,6 @@ export type ProviderOperationsMetadataGetResponse = ProviderOperationsMetadata; // @public export interface ProviderOperationsMetadataListNextOptionalParams extends coreClient.OperationOptions { - expand?: string; } // @public @@ -269,7 +271,6 @@ export type RoleAssignmentsGetResponse = RoleAssignment; // @public export interface RoleAssignmentsListForResourceGroupNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -285,7 +286,6 @@ export type RoleAssignmentsListForResourceGroupResponse = RoleAssignmentListResu // @public export interface RoleAssignmentsListForResourceNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -301,7 +301,6 @@ export type RoleAssignmentsListForResourceResponse = RoleAssignmentListResult; // @public export interface RoleAssignmentsListForScopeNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -317,7 +316,6 @@ export type RoleAssignmentsListForScopeResponse = RoleAssignmentListResult; // @public export interface RoleAssignmentsListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public @@ -393,7 +391,6 @@ export type RoleDefinitionsGetResponse = RoleDefinition; // @public export interface RoleDefinitionsListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; } // @public diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/sample.env b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/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/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/globalAdministratorElevateAccessSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/globalAdministratorElevateAccessSample.ts new file mode 100644 index 00000000000..afbc67bc247 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/globalAdministratorElevateAccessSample.ts @@ -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. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Elevates access for a Global Administrator. + * + * @summary Elevates access for a Global Administrator. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json + */ +async function elevateAccessGlobalAdministrator() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.globalAdministrator.elevateAccess(); + console.log(result); +} + +async function main() { + elevateAccessGlobalAdministrator(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/permissionsListForResourceGroupSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/permissionsListForResourceGroupSample.ts new file mode 100644 index 00000000000..2111c4fbbe8 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/permissionsListForResourceGroupSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all permissions the caller has for a resource group. + * + * @summary Gets all permissions the caller has for a resource group. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetPermissions.json + */ +async function listPermissionsForResourceGroup() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subID"; + const resourceGroupName = + process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.permissions.listForResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listPermissionsForResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/permissionsListForResourceSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/permissionsListForResourceSample.ts new file mode 100644 index 00000000000..4926aaea7a3 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/permissionsListForResourceSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all permissions the caller has for a resource. + * + * @summary Gets all permissions the caller has for a resource. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetResourcePermissions.json + */ +async function listPermissionsForResource() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = + process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const resourceProviderNamespace = "rpnamespace"; + const parentResourcePath = "parentResourcePath"; + const resourceType = "resourceType"; + const resourceName = "resourceName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.permissions.listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listPermissionsForResource(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/providerOperationsMetadataGetSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/providerOperationsMetadataGetSample.ts new file mode 100644 index 00000000000..ef4ac04d20e --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/providerOperationsMetadataGetSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets provider operations metadata for the specified resource provider. + * + * @summary Gets provider operations metadata for the specified resource provider. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetProviderOperationsRP.json + */ +async function getProviderOperationsMetadataForResourceProvider() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceProviderNamespace = "resourceProviderNamespace"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.providerOperationsMetadataOperations.get( + resourceProviderNamespace + ); + console.log(result); +} + +async function main() { + getProviderOperationsMetadataForResourceProvider(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/providerOperationsMetadataListSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/providerOperationsMetadataListSample.ts new file mode 100644 index 00000000000..bdc4157f45f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/providerOperationsMetadataListSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets provider operations metadata for all resource providers. + * + * @summary Gets provider operations metadata for all resource providers. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllProviderOperations.json + */ +async function listProviderOperationsMetadataForAllResourceProviders() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.providerOperationsMetadataOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listProviderOperationsMetadataForAllResourceProviders(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsCreateByIdSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsCreateByIdSample.ts new file mode 100644 index 00000000000..9124955462f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsCreateByIdSample.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 { + RoleAssignmentCreateParameters, + AuthorizationManagementClient +} from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates a role assignment by ID. + * + * @summary Creates a role assignment by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignmentById.json + */ +async function createRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleAssignmentId"; + const parameters: RoleAssignmentCreateParameters = { + properties: { + principalId: "d93a38bc-d029-4160-bfb0-fbda779ac214", + roleDefinitionId: + "/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/roleDefinitions/de139f84-1756-47ae-9be6-808fbbe84772" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.createById( + roleAssignmentId, + parameters + ); + console.log(result); +} + +async function main() { + createRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsCreateSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsCreateSample.ts new file mode 100644 index 00000000000..3810b2d21a3 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsCreateSample.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 { + RoleAssignmentCreateParameters, + AuthorizationManagementClient +} from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates a role assignment. + * + * @summary Creates a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignment.json + */ +async function createRoleAssignment() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const parameters: RoleAssignmentCreateParameters = { + properties: { + principalId: "d93a38bc-d029-4160-bfb0-fbda779ac214", + roleDefinitionId: + "/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/roleDefinitions/de139f84-1756-47ae-9be6-808fbbe84772" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.create( + scope, + roleAssignmentName, + parameters + ); + console.log(result); +} + +async function main() { + createRoleAssignment(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsDeleteByIdSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsDeleteByIdSample.ts new file mode 100644 index 00000000000..b731bc3f921 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsDeleteByIdSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a role assignment. + * + * @summary Deletes a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentById.json + */ +async function deleteRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleAssignmentId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.deleteById(roleAssignmentId); + console.log(result); +} + +async function main() { + deleteRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsDeleteSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsDeleteSample.ts new file mode 100644 index 00000000000..66ab9c84727 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a role assignment. + * + * @summary Deletes a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentByName.json + */ +async function deleteRoleAssignmentByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.delete(scope, roleAssignmentName); + console.log(result); +} + +async function main() { + deleteRoleAssignmentByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsGetByIdSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsGetByIdSample.ts new file mode 100644 index 00000000000..888eaa48f5a --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsGetByIdSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a role assignment by ID. + * + * @summary Gets a role assignment by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentById.json + */ +async function getRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleassignmentId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.getById(roleAssignmentId); + console.log(result); +} + +async function main() { + getRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsGetSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsGetSample.ts new file mode 100644 index 00000000000..9ee68dea9c2 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the specified role assignment. + * + * @summary Get the specified role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByName.json + */ +async function getRoleAssignmentByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.get(scope, roleAssignmentName); + console.log(result); +} + +async function main() { + getRoleAssignmentByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForResourceGroupSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForResourceGroupSample.ts new file mode 100644 index 00000000000..d6d8e27ae16 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForResourceGroupSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets role assignments for a resource group. + * + * @summary Gets role assignments for a resource group. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResourceGroup.json + */ +async function listRoleAssignmentsForResourceGroup() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = + process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForResourceSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForResourceSample.ts new file mode 100644 index 00000000000..e43ed693f5f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForResourceSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets role assignments for a resource. + * + * @summary Gets role assignments for a resource. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResource.json + */ +async function listRoleAssignmentsForResource() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = + process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const resourceProviderNamespace = "resourceProviderNamespace"; + const parentResourcePath = "parentResourcePath"; + const resourceType = "resourceType"; + const resourceName = "resourceName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForResource(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForScopeSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForScopeSample.ts new file mode 100644 index 00000000000..37762949404 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListForScopeSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets role assignments for a scope. + * + * @summary Gets role assignments for a scope. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByScope.json + */ +async function listRoleAssignmentsForScope() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForScope(scope)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForScope(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListSample.ts new file mode 100644 index 00000000000..e8c81517d06 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleAssignmentsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all role assignments for the subscription. + * + * @summary Gets all role assignments for the subscription. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllRoleAssignments.json + */ +async function listRoleAssignmentsForSubscription() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForSubscription(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsCreateOrUpdateSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..c11c97ed39f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsCreateOrUpdateSample.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 { + RoleDefinition, + AuthorizationManagementClient +} from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a role definition. + * + * @summary Creates or updates a role definition. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleDefinition.json + */ +async function createRoleDefinition() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const roleDefinition: RoleDefinition = {}; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.createOrUpdate( + scope, + roleDefinitionId, + roleDefinition + ); + console.log(result); +} + +async function main() { + createRoleDefinition(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsDeleteSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsDeleteSample.ts new file mode 100644 index 00000000000..c17474f65ad --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a role definition. + * + * @summary Deletes a role definition. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleDefinition.json + */ +async function deleteRoleDefinition() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.delete(scope, roleDefinitionId); + console.log(result); +} + +async function main() { + deleteRoleDefinition(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsGetByIdSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsGetByIdSample.ts new file mode 100644 index 00000000000..e62674f94de --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsGetByIdSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a role definition by ID. + * + * @summary Gets a role definition by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionById.json + */ +async function getRoleDefinitionById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.getById(roleDefinitionId); + console.log(result); +} + +async function main() { + getRoleDefinitionById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsGetSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsGetSample.ts new file mode 100644 index 00000000000..dac4dd149e9 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get role definition by name (GUID). + * + * @summary Get role definition by name (GUID). + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionByName.json + */ +async function getRoleDefinitionByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.get(scope, roleDefinitionId); + console.log(result); +} + +async function main() { + getRoleDefinitionByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsListSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsListSample.ts new file mode 100644 index 00000000000..11930c35ae3 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples-dev/roleDefinitionsListSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all role definitions that are applicable at scope and above. + * + * @summary Get all role definitions that are applicable at scope and above. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionAtScope.json + */ +async function listRoleDefinitionsForScope() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleDefinitions.list(scope)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleDefinitionsForScope(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/README.md b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/README.md new file mode 100644 index 00000000000..abb8df256cb --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/README.md @@ -0,0 +1,88 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [globalAdministratorElevateAccessSample.js][globaladministratorelevateaccesssample] | Elevates access for a Global Administrator. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json | +| [permissionsListForResourceGroupSample.js][permissionslistforresourcegroupsample] | Gets all permissions the caller has for a resource group. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetPermissions.json | +| [permissionsListForResourceSample.js][permissionslistforresourcesample] | Gets all permissions the caller has for a resource. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetResourcePermissions.json | +| [providerOperationsMetadataGetSample.js][provideroperationsmetadatagetsample] | Gets provider operations metadata for the specified resource provider. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetProviderOperationsRP.json | +| [providerOperationsMetadataListSample.js][provideroperationsmetadatalistsample] | Gets provider operations metadata for all resource providers. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllProviderOperations.json | +| [roleAssignmentsCreateByIdSample.js][roleassignmentscreatebyidsample] | Creates a role assignment by ID. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignmentById.json | +| [roleAssignmentsCreateSample.js][roleassignmentscreatesample] | Creates a role assignment. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignment.json | +| [roleAssignmentsDeleteByIdSample.js][roleassignmentsdeletebyidsample] | Deletes a role assignment. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentById.json | +| [roleAssignmentsDeleteSample.js][roleassignmentsdeletesample] | Deletes a role assignment. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentByName.json | +| [roleAssignmentsGetByIdSample.js][roleassignmentsgetbyidsample] | Gets a role assignment by ID. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentById.json | +| [roleAssignmentsGetSample.js][roleassignmentsgetsample] | Get the specified role assignment. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByName.json | +| [roleAssignmentsListForResourceGroupSample.js][roleassignmentslistforresourcegroupsample] | Gets role assignments for a resource group. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResourceGroup.json | +| [roleAssignmentsListForResourceSample.js][roleassignmentslistforresourcesample] | Gets role assignments for a resource. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResource.json | +| [roleAssignmentsListForScopeSample.js][roleassignmentslistforscopesample] | Gets role assignments for a scope. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByScope.json | +| [roleAssignmentsListSample.js][roleassignmentslistsample] | Gets all role assignments for the subscription. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllRoleAssignments.json | +| [roleDefinitionsCreateOrUpdateSample.js][roledefinitionscreateorupdatesample] | Creates or updates a role definition. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleDefinition.json | +| [roleDefinitionsDeleteSample.js][roledefinitionsdeletesample] | Deletes a role definition. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleDefinition.json | +| [roleDefinitionsGetByIdSample.js][roledefinitionsgetbyidsample] | Gets a role definition by ID. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionById.json | +| [roleDefinitionsGetSample.js][roledefinitionsgetsample] | Get role definition by name (GUID). x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionByName.json | +| [roleDefinitionsListSample.js][roledefinitionslistsample] | Get all role definitions that are applicable at scope and above. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionAtScope.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 globalAdministratorElevateAccessSample.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 AUTHORIZATION_SUBSCRIPTION_ID="" node globalAdministratorElevateAccessSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[globaladministratorelevateaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/globalAdministratorElevateAccessSample.js +[permissionslistforresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceGroupSample.js +[permissionslistforresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceSample.js +[provideroperationsmetadatagetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataGetSample.js +[provideroperationsmetadatalistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataListSample.js +[roleassignmentscreatebyidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateByIdSample.js +[roleassignmentscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateSample.js +[roleassignmentsdeletebyidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteByIdSample.js +[roleassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteSample.js +[roleassignmentsgetbyidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetByIdSample.js +[roleassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetSample.js +[roleassignmentslistforresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceGroupSample.js +[roleassignmentslistforresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceSample.js +[roleassignmentslistforscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForScopeSample.js +[roleassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListSample.js +[roledefinitionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsCreateOrUpdateSample.js +[roledefinitionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsDeleteSample.js +[roledefinitionsgetbyidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetByIdSample.js +[roledefinitionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetSample.js +[roledefinitionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsListSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-authorization-profile-2020-09-01-hybrid?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/README.md diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/globalAdministratorElevateAccessSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/globalAdministratorElevateAccessSample.js new file mode 100644 index 00000000000..8b4daa4102d --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/globalAdministratorElevateAccessSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Elevates access for a Global Administrator. + * + * @summary Elevates access for a Global Administrator. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json + */ +async function elevateAccessGlobalAdministrator() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.globalAdministrator.elevateAccess(); + console.log(result); +} + +async function main() { + elevateAccessGlobalAdministrator(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/package.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/package.json new file mode 100644 index 00000000000..f74f6ebde60 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-authorization-profile-2020-09-01-hybrid-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/authorization/arm-authorization-profile-2020-09-01-hybrid" + }, + "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/authorization/arm-authorization-profile-2020-09-01-hybrid", + "dependencies": { + "@azure/arm-authorization-profile-2020-09-01-hybrid": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceGroupSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceGroupSample.js new file mode 100644 index 00000000000..4c1356a2181 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceGroupSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all permissions the caller has for a resource group. + * + * @summary Gets all permissions the caller has for a resource group. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetPermissions.json + */ +async function listPermissionsForResourceGroup() { + const subscriptionId = process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subID"; + const resourceGroupName = process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.permissions.listForResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listPermissionsForResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceSample.js new file mode 100644 index 00000000000..a09af443cd9 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/permissionsListForResourceSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all permissions the caller has for a resource. + * + * @summary Gets all permissions the caller has for a resource. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetResourcePermissions.json + */ +async function listPermissionsForResource() { + const subscriptionId = process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const resourceProviderNamespace = "rpnamespace"; + const parentResourcePath = "parentResourcePath"; + const resourceType = "resourceType"; + const resourceName = "resourceName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.permissions.listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listPermissionsForResource(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataGetSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataGetSample.js new file mode 100644 index 00000000000..11d080ce335 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataGetSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets provider operations metadata for the specified resource provider. + * + * @summary Gets provider operations metadata for the specified resource provider. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetProviderOperationsRP.json + */ +async function getProviderOperationsMetadataForResourceProvider() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceProviderNamespace = "resourceProviderNamespace"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.providerOperationsMetadataOperations.get(resourceProviderNamespace); + console.log(result); +} + +async function main() { + getProviderOperationsMetadataForResourceProvider(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataListSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataListSample.js new file mode 100644 index 00000000000..fa9b4f1c625 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/providerOperationsMetadataListSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets provider operations metadata for all resource providers. + * + * @summary Gets provider operations metadata for all resource providers. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllProviderOperations.json + */ +async function listProviderOperationsMetadataForAllResourceProviders() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.providerOperationsMetadataOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listProviderOperationsMetadataForAllResourceProviders(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateByIdSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateByIdSample.js new file mode 100644 index 00000000000..15dc9b77df2 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateByIdSample.js @@ -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. +const { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates a role assignment by ID. + * + * @summary Creates a role assignment by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignmentById.json + */ +async function createRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleAssignmentId"; + const parameters = { + properties: { + principalId: "d93a38bc-d029-4160-bfb0-fbda779ac214", + roleDefinitionId: + "/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/roleDefinitions/de139f84-1756-47ae-9be6-808fbbe84772", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.createById(roleAssignmentId, parameters); + console.log(result); +} + +async function main() { + createRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateSample.js new file mode 100644 index 00000000000..488473999d1 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsCreateSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates a role assignment. + * + * @summary Creates a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignment.json + */ +async function createRoleAssignment() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const parameters = { + properties: { + principalId: "d93a38bc-d029-4160-bfb0-fbda779ac214", + roleDefinitionId: + "/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/roleDefinitions/de139f84-1756-47ae-9be6-808fbbe84772", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.create(scope, roleAssignmentName, parameters); + console.log(result); +} + +async function main() { + createRoleAssignment(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteByIdSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteByIdSample.js new file mode 100644 index 00000000000..74b0ee2e255 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteByIdSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a role assignment. + * + * @summary Deletes a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentById.json + */ +async function deleteRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleAssignmentId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.deleteById(roleAssignmentId); + console.log(result); +} + +async function main() { + deleteRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteSample.js new file mode 100644 index 00000000000..ad11bf91d43 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsDeleteSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a role assignment. + * + * @summary Deletes a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentByName.json + */ +async function deleteRoleAssignmentByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.delete(scope, roleAssignmentName); + console.log(result); +} + +async function main() { + deleteRoleAssignmentByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetByIdSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetByIdSample.js new file mode 100644 index 00000000000..93b0b798b4a --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetByIdSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a role assignment by ID. + * + * @summary Gets a role assignment by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentById.json + */ +async function getRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleassignmentId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.getById(roleAssignmentId); + console.log(result); +} + +async function main() { + getRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetSample.js new file mode 100644 index 00000000000..291b9af1eac --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsGetSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the specified role assignment. + * + * @summary Get the specified role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByName.json + */ +async function getRoleAssignmentByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.get(scope, roleAssignmentName); + console.log(result); +} + +async function main() { + getRoleAssignmentByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceGroupSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceGroupSample.js new file mode 100644 index 00000000000..4ca0a837cbd --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceGroupSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets role assignments for a resource group. + * + * @summary Gets role assignments for a resource group. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResourceGroup.json + */ +async function listRoleAssignmentsForResourceGroup() { + const subscriptionId = process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceSample.js new file mode 100644 index 00000000000..5add0e09491 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForResourceSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets role assignments for a resource. + * + * @summary Gets role assignments for a resource. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResource.json + */ +async function listRoleAssignmentsForResource() { + const subscriptionId = process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const resourceProviderNamespace = "resourceProviderNamespace"; + const parentResourcePath = "parentResourcePath"; + const resourceType = "resourceType"; + const resourceName = "resourceName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForResource(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForScopeSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForScopeSample.js new file mode 100644 index 00000000000..7e9bb62a793 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListForScopeSample.js @@ -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. +const { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets role assignments for a scope. + * + * @summary Gets role assignments for a scope. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByScope.json + */ +async function listRoleAssignmentsForScope() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForScope(scope)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForScope(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListSample.js new file mode 100644 index 00000000000..7f6f3ca1fc1 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleAssignmentsListSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all role assignments for the subscription. + * + * @summary Gets all role assignments for the subscription. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllRoleAssignments.json + */ +async function listRoleAssignmentsForSubscription() { + const subscriptionId = process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForSubscription(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsCreateOrUpdateSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsCreateOrUpdateSample.js new file mode 100644 index 00000000000..e173b44034e --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsCreateOrUpdateSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a role definition. + * + * @summary Creates or updates a role definition. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleDefinition.json + */ +async function createRoleDefinition() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const roleDefinition = {}; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.createOrUpdate( + scope, + roleDefinitionId, + roleDefinition + ); + console.log(result); +} + +async function main() { + createRoleDefinition(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsDeleteSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsDeleteSample.js new file mode 100644 index 00000000000..2855ee8c483 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsDeleteSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a role definition. + * + * @summary Deletes a role definition. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleDefinition.json + */ +async function deleteRoleDefinition() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.delete(scope, roleDefinitionId); + console.log(result); +} + +async function main() { + deleteRoleDefinition(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetByIdSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetByIdSample.js new file mode 100644 index 00000000000..a14b0e5c1b9 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetByIdSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a role definition by ID. + * + * @summary Gets a role definition by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionById.json + */ +async function getRoleDefinitionById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.getById(roleDefinitionId); + console.log(result); +} + +async function main() { + getRoleDefinitionById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetSample.js new file mode 100644 index 00000000000..b0b30e0b700 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsGetSample.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 { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get role definition by name (GUID). + * + * @summary Get role definition by name (GUID). + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionByName.json + */ +async function getRoleDefinitionByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.get(scope, roleDefinitionId); + console.log(result); +} + +async function main() { + getRoleDefinitionByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsListSample.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsListSample.js new file mode 100644 index 00000000000..f87a8a8b868 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/roleDefinitionsListSample.js @@ -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. +const { + AuthorizationManagementClient, +} = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all role definitions that are applicable at scope and above. + * + * @summary Get all role definitions that are applicable at scope and above. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionAtScope.json + */ +async function listRoleDefinitionsForScope() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleDefinitions.list(scope)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleDefinitionsForScope(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/sample.env b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/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/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/README.md b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/README.md new file mode 100644 index 00000000000..3301be248bd --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/README.md @@ -0,0 +1,101 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [globalAdministratorElevateAccessSample.ts][globaladministratorelevateaccesssample] | Elevates access for a Global Administrator. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json | +| [permissionsListForResourceGroupSample.ts][permissionslistforresourcegroupsample] | Gets all permissions the caller has for a resource group. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetPermissions.json | +| [permissionsListForResourceSample.ts][permissionslistforresourcesample] | Gets all permissions the caller has for a resource. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetResourcePermissions.json | +| [providerOperationsMetadataGetSample.ts][provideroperationsmetadatagetsample] | Gets provider operations metadata for the specified resource provider. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetProviderOperationsRP.json | +| [providerOperationsMetadataListSample.ts][provideroperationsmetadatalistsample] | Gets provider operations metadata for all resource providers. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllProviderOperations.json | +| [roleAssignmentsCreateByIdSample.ts][roleassignmentscreatebyidsample] | Creates a role assignment by ID. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignmentById.json | +| [roleAssignmentsCreateSample.ts][roleassignmentscreatesample] | Creates a role assignment. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignment.json | +| [roleAssignmentsDeleteByIdSample.ts][roleassignmentsdeletebyidsample] | Deletes a role assignment. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentById.json | +| [roleAssignmentsDeleteSample.ts][roleassignmentsdeletesample] | Deletes a role assignment. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentByName.json | +| [roleAssignmentsGetByIdSample.ts][roleassignmentsgetbyidsample] | Gets a role assignment by ID. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentById.json | +| [roleAssignmentsGetSample.ts][roleassignmentsgetsample] | Get the specified role assignment. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByName.json | +| [roleAssignmentsListForResourceGroupSample.ts][roleassignmentslistforresourcegroupsample] | Gets role assignments for a resource group. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResourceGroup.json | +| [roleAssignmentsListForResourceSample.ts][roleassignmentslistforresourcesample] | Gets role assignments for a resource. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResource.json | +| [roleAssignmentsListForScopeSample.ts][roleassignmentslistforscopesample] | Gets role assignments for a scope. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByScope.json | +| [roleAssignmentsListSample.ts][roleassignmentslistsample] | Gets all role assignments for the subscription. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllRoleAssignments.json | +| [roleDefinitionsCreateOrUpdateSample.ts][roledefinitionscreateorupdatesample] | Creates or updates a role definition. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleDefinition.json | +| [roleDefinitionsDeleteSample.ts][roledefinitionsdeletesample] | Deletes a role definition. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleDefinition.json | +| [roleDefinitionsGetByIdSample.ts][roledefinitionsgetbyidsample] | Gets a role definition by ID. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionById.json | +| [roleDefinitionsGetSample.ts][roledefinitionsgetsample] | Get role definition by name (GUID). x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionByName.json | +| [roleDefinitionsListSample.ts][roledefinitionslistsample] | Get all role definitions that are applicable at scope and above. x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionAtScope.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/globalAdministratorElevateAccessSample.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 AUTHORIZATION_SUBSCRIPTION_ID="" node dist/globalAdministratorElevateAccessSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[globaladministratorelevateaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/globalAdministratorElevateAccessSample.ts +[permissionslistforresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceGroupSample.ts +[permissionslistforresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceSample.ts +[provideroperationsmetadatagetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataGetSample.ts +[provideroperationsmetadatalistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataListSample.ts +[roleassignmentscreatebyidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateByIdSample.ts +[roleassignmentscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateSample.ts +[roleassignmentsdeletebyidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteByIdSample.ts +[roleassignmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteSample.ts +[roleassignmentsgetbyidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetByIdSample.ts +[roleassignmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetSample.ts +[roleassignmentslistforresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceGroupSample.ts +[roleassignmentslistforresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceSample.ts +[roleassignmentslistforscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForScopeSample.ts +[roleassignmentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListSample.ts +[roledefinitionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsCreateOrUpdateSample.ts +[roledefinitionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsDeleteSample.ts +[roledefinitionsgetbyidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetByIdSample.ts +[roledefinitionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetSample.ts +[roledefinitionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsListSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-authorization-profile-2020-09-01-hybrid?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/package.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/package.json new file mode 100644 index 00000000000..197881d0ebe --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-authorization-profile-2020-09-01-hybrid-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "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/authorization/arm-authorization-profile-2020-09-01-hybrid" + }, + "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/authorization/arm-authorization-profile-2020-09-01-hybrid", + "dependencies": { + "@azure/arm-authorization-profile-2020-09-01-hybrid": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~4.8.0", + "rimraf": "latest" + } +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/sample.env b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/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/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/globalAdministratorElevateAccessSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/globalAdministratorElevateAccessSample.ts new file mode 100644 index 00000000000..afbc67bc247 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/globalAdministratorElevateAccessSample.ts @@ -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. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Elevates access for a Global Administrator. + * + * @summary Elevates access for a Global Administrator. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json + */ +async function elevateAccessGlobalAdministrator() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.globalAdministrator.elevateAccess(); + console.log(result); +} + +async function main() { + elevateAccessGlobalAdministrator(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceGroupSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceGroupSample.ts new file mode 100644 index 00000000000..2111c4fbbe8 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceGroupSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all permissions the caller has for a resource group. + * + * @summary Gets all permissions the caller has for a resource group. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetPermissions.json + */ +async function listPermissionsForResourceGroup() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subID"; + const resourceGroupName = + process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.permissions.listForResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listPermissionsForResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceSample.ts new file mode 100644 index 00000000000..4926aaea7a3 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/permissionsListForResourceSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all permissions the caller has for a resource. + * + * @summary Gets all permissions the caller has for a resource. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetResourcePermissions.json + */ +async function listPermissionsForResource() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = + process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const resourceProviderNamespace = "rpnamespace"; + const parentResourcePath = "parentResourcePath"; + const resourceType = "resourceType"; + const resourceName = "resourceName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.permissions.listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listPermissionsForResource(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataGetSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataGetSample.ts new file mode 100644 index 00000000000..ef4ac04d20e --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataGetSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets provider operations metadata for the specified resource provider. + * + * @summary Gets provider operations metadata for the specified resource provider. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetProviderOperationsRP.json + */ +async function getProviderOperationsMetadataForResourceProvider() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceProviderNamespace = "resourceProviderNamespace"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.providerOperationsMetadataOperations.get( + resourceProviderNamespace + ); + console.log(result); +} + +async function main() { + getProviderOperationsMetadataForResourceProvider(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataListSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataListSample.ts new file mode 100644 index 00000000000..bdc4157f45f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/providerOperationsMetadataListSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets provider operations metadata for all resource providers. + * + * @summary Gets provider operations metadata for all resource providers. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllProviderOperations.json + */ +async function listProviderOperationsMetadataForAllResourceProviders() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.providerOperationsMetadataOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listProviderOperationsMetadataForAllResourceProviders(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateByIdSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateByIdSample.ts new file mode 100644 index 00000000000..9124955462f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateByIdSample.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 { + RoleAssignmentCreateParameters, + AuthorizationManagementClient +} from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates a role assignment by ID. + * + * @summary Creates a role assignment by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignmentById.json + */ +async function createRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleAssignmentId"; + const parameters: RoleAssignmentCreateParameters = { + properties: { + principalId: "d93a38bc-d029-4160-bfb0-fbda779ac214", + roleDefinitionId: + "/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/roleDefinitions/de139f84-1756-47ae-9be6-808fbbe84772" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.createById( + roleAssignmentId, + parameters + ); + console.log(result); +} + +async function main() { + createRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateSample.ts new file mode 100644 index 00000000000..3810b2d21a3 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsCreateSample.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 { + RoleAssignmentCreateParameters, + AuthorizationManagementClient +} from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates a role assignment. + * + * @summary Creates a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleAssignment.json + */ +async function createRoleAssignment() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const parameters: RoleAssignmentCreateParameters = { + properties: { + principalId: "d93a38bc-d029-4160-bfb0-fbda779ac214", + roleDefinitionId: + "/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/roleDefinitions/de139f84-1756-47ae-9be6-808fbbe84772" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.create( + scope, + roleAssignmentName, + parameters + ); + console.log(result); +} + +async function main() { + createRoleAssignment(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteByIdSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteByIdSample.ts new file mode 100644 index 00000000000..b731bc3f921 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteByIdSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a role assignment. + * + * @summary Deletes a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentById.json + */ +async function deleteRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleAssignmentId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.deleteById(roleAssignmentId); + console.log(result); +} + +async function main() { + deleteRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteSample.ts new file mode 100644 index 00000000000..66ab9c84727 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a role assignment. + * + * @summary Deletes a role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleAssignmentByName.json + */ +async function deleteRoleAssignmentByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.delete(scope, roleAssignmentName); + console.log(result); +} + +async function main() { + deleteRoleAssignmentByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetByIdSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetByIdSample.ts new file mode 100644 index 00000000000..888eaa48f5a --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetByIdSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a role assignment by ID. + * + * @summary Gets a role assignment by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentById.json + */ +async function getRoleAssignmentById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const roleAssignmentId = "roleassignmentId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.getById(roleAssignmentId); + console.log(result); +} + +async function main() { + getRoleAssignmentById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetSample.ts new file mode 100644 index 00000000000..9ee68dea9c2 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the specified role assignment. + * + * @summary Get the specified role assignment. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByName.json + */ +async function getRoleAssignmentByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleAssignmentName = "roleAssignmentName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleAssignments.get(scope, roleAssignmentName); + console.log(result); +} + +async function main() { + getRoleAssignmentByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceGroupSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceGroupSample.ts new file mode 100644 index 00000000000..d6d8e27ae16 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceGroupSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets role assignments for a resource group. + * + * @summary Gets role assignments for a resource group. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResourceGroup.json + */ +async function listRoleAssignmentsForResourceGroup() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = + process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceSample.ts new file mode 100644 index 00000000000..e43ed693f5f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForResourceSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets role assignments for a resource. + * + * @summary Gets role assignments for a resource. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentsForResource.json + */ +async function listRoleAssignmentsForResource() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const resourceGroupName = + process.env["AUTHORIZATION_RESOURCE_GROUP"] || "rgname"; + const resourceProviderNamespace = "resourceProviderNamespace"; + const parentResourcePath = "parentResourcePath"; + const resourceType = "resourceType"; + const resourceName = "resourceName"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForResource(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForScopeSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForScopeSample.ts new file mode 100644 index 00000000000..37762949404 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListForScopeSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets role assignments for a scope. + * + * @summary Gets role assignments for a scope. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleAssignmentByScope.json + */ +async function listRoleAssignmentsForScope() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.listForScope(scope)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForScope(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListSample.ts new file mode 100644 index 00000000000..e8c81517d06 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleAssignmentsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all role assignments for the subscription. + * + * @summary Gets all role assignments for the subscription. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetAllRoleAssignments.json + */ +async function listRoleAssignmentsForSubscription() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || "subId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleAssignments.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleAssignmentsForSubscription(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsCreateOrUpdateSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..c11c97ed39f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsCreateOrUpdateSample.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 { + RoleDefinition, + AuthorizationManagementClient +} from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a role definition. + * + * @summary Creates or updates a role definition. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/PutRoleDefinition.json + */ +async function createRoleDefinition() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const roleDefinition: RoleDefinition = {}; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.createOrUpdate( + scope, + roleDefinitionId, + roleDefinition + ); + console.log(result); +} + +async function main() { + createRoleDefinition(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsDeleteSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsDeleteSample.ts new file mode 100644 index 00000000000..c17474f65ad --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a role definition. + * + * @summary Deletes a role definition. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/DeleteRoleDefinition.json + */ +async function deleteRoleDefinition() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.delete(scope, roleDefinitionId); + console.log(result); +} + +async function main() { + deleteRoleDefinition(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetByIdSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetByIdSample.ts new file mode 100644 index 00000000000..e62674f94de --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetByIdSample.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 { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a role definition by ID. + * + * @summary Gets a role definition by ID. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionById.json + */ +async function getRoleDefinitionById() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.getById(roleDefinitionId); + console.log(result); +} + +async function main() { + getRoleDefinitionById(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetSample.ts new file mode 100644 index 00000000000..dac4dd149e9 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get role definition by name (GUID). + * + * @summary Get role definition by name (GUID). + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionByName.json + */ +async function getRoleDefinitionByName() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const roleDefinitionId = "roleDefinitionId"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const result = await client.roleDefinitions.get(scope, roleDefinitionId); + console.log(result); +} + +async function main() { + getRoleDefinitionByName(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsListSample.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsListSample.ts new file mode 100644 index 00000000000..11930c35ae3 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/src/roleDefinitionsListSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthorizationManagementClient } from "@azure/arm-authorization-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all role definitions that are applicable at scope and above. + * + * @summary Get all role definitions that are applicable at scope and above. + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetRoleDefinitionAtScope.json + */ +async function listRoleDefinitionsForScope() { + const subscriptionId = + process.env["AUTHORIZATION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const scope = "scope"; + const credential = new DefaultAzureCredential(); + const client = new AuthorizationManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.roleDefinitions.list(scope)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRoleDefinitionsForScope(); +} + +main().catch(console.error); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/tsconfig.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/typescript/tsconfig.json new file mode 100644 index 00000000000..e26ce2a6d8f --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/samples/v3/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/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClient.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClient.ts index 3a52512958d..58dbbc3999d 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClient.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClient.ts @@ -7,6 +7,12 @@ */ 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 { PermissionsImpl, @@ -56,24 +62,54 @@ export class AuthorizationManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-authorization-profile-2020-09-01-hybrid/2.0.1`; + const packageDetails = `azsdk-js-arm-authorization-profile-2020-09-01-hybrid/2.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + 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; @@ -87,6 +123,35 @@ export class AuthorizationManagementClient extends coreClient.ServiceClient { ); this.globalAdministrator = new GlobalAdministratorImpl(this); this.roleAssignments = new RoleAssignmentsImpl(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); } permissions: Permissions; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/index.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/index.ts index bfd87d5d1ad..1a8d45806ea 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/index.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { AuthorizationManagementClient } from "./authorizationManagementClient"; export * from "./operationsInterfaces"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/index.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/index.ts index c080c2a3f84..0b54511d16a 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/index.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/index.ts @@ -291,10 +291,7 @@ export type RoleDefinitionsGetByIdResponse = RoleDefinition; /** Optional parameters. */ export interface RoleDefinitionsListNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type RoleDefinitionsListNextResponse = RoleDefinitionListResult; @@ -321,10 +318,7 @@ export type ProviderOperationsMetadataListResponse = ProviderOperationsMetadataL /** Optional parameters. */ export interface ProviderOperationsMetadataListNextOptionalParams - extends coreClient.OperationOptions { - /** Specifies whether to expand the values. */ - expand?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type ProviderOperationsMetadataListNextResponse = ProviderOperationsMetadataListResult; @@ -417,40 +411,28 @@ export type RoleAssignmentsListForScopeResponse = RoleAssignmentListResult; /** Optional parameters. */ export interface RoleAssignmentsListForResourceNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listForResourceNext operation. */ export type RoleAssignmentsListForResourceNextResponse = RoleAssignmentListResult; /** Optional parameters. */ export interface RoleAssignmentsListForResourceGroupNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listForResourceGroupNext operation. */ export type RoleAssignmentsListForResourceGroupNextResponse = RoleAssignmentListResult; /** Optional parameters. */ export interface RoleAssignmentsListNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type RoleAssignmentsListNextResponse = RoleAssignmentListResult; /** Optional parameters. */ export interface RoleAssignmentsListForScopeNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ - filter?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listForScopeNext operation. */ export type RoleAssignmentsListForScopeNextResponse = RoleAssignmentListResult; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/permissions.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/permissions.ts index 303f4182684..3af564c55b7 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/permissions.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/permissions.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Permissions } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { Permission, PermissionsListForResourceGroupNextOptionalParams, PermissionsListForResourceGroupOptionalParams, + PermissionsListForResourceGroupResponse, PermissionsListForResourceNextOptionalParams, PermissionsListForResourceOptionalParams, - PermissionsListForResourceGroupResponse, PermissionsListForResourceResponse, PermissionsListForResourceGroupNextResponse, PermissionsListForResourceNextResponse @@ -54,19 +55,33 @@ export class PermissionsImpl implements Permissions { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listForResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listForResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listForResourceGroupPagingPage( resourceGroupName: string, - options?: PermissionsListForResourceGroupOptionalParams + options?: PermissionsListForResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listForResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: PermissionsListForResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listForResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listForResourceGroupNext( resourceGroupName, @@ -74,7 +89,9 @@ export class PermissionsImpl implements Permissions { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -122,14 +139,18 @@ export class PermissionsImpl implements Permissions { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listForResourcePagingPage( resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, - options + options, + settings ); } }; @@ -141,18 +162,25 @@ export class PermissionsImpl implements Permissions { parentResourcePath: string, resourceType: string, resourceName: string, - options?: PermissionsListForResourceOptionalParams + options?: PermissionsListForResourceOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listForResource( - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: PermissionsListForResourceResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listForResourceNext( resourceGroupName, @@ -164,7 +192,9 @@ export class PermissionsImpl implements Permissions { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -343,7 +373,6 @@ const listForResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -364,7 +393,6 @@ const listForResourceNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/providerOperationsMetadataOperations.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/providerOperationsMetadataOperations.ts index 922a30fbe77..570cefd9489 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/providerOperationsMetadataOperations.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/providerOperationsMetadataOperations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { ProviderOperationsMetadataOperations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { ProviderOperationsMetadata, ProviderOperationsMetadataListNextOptionalParams, ProviderOperationsMetadataListOptionalParams, + ProviderOperationsMetadataListResponse, ProviderOperationsMetadataGetOptionalParams, ProviderOperationsMetadataGetResponse, - ProviderOperationsMetadataListResponse, ProviderOperationsMetadataListNextResponse } from "../models"; @@ -51,22 +52,34 @@ export class ProviderOperationsMetadataOperationsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: ProviderOperationsMetadataListOptionalParams + options?: ProviderOperationsMetadataListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ProviderOperationsMetadataListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -165,7 +178,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.expand], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleAssignments.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleAssignments.ts index b86f4fcdc2c..7ccdd8304eb 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleAssignments.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleAssignments.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { RoleAssignments } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,14 +17,16 @@ import { RoleAssignment, RoleAssignmentsListForResourceNextOptionalParams, RoleAssignmentsListForResourceOptionalParams, + RoleAssignmentsListForResourceResponse, RoleAssignmentsListForResourceGroupNextOptionalParams, RoleAssignmentsListForResourceGroupOptionalParams, + RoleAssignmentsListForResourceGroupResponse, RoleAssignmentsListNextOptionalParams, RoleAssignmentsListOptionalParams, + RoleAssignmentsListResponse, RoleAssignmentsListForScopeNextOptionalParams, RoleAssignmentsListForScopeOptionalParams, - RoleAssignmentsListForResourceResponse, - RoleAssignmentsListForResourceGroupResponse, + RoleAssignmentsListForScopeResponse, RoleAssignmentsDeleteOptionalParams, RoleAssignmentsDeleteResponse, RoleAssignmentCreateParameters, @@ -37,8 +40,6 @@ import { RoleAssignmentsCreateByIdResponse, RoleAssignmentsGetByIdOptionalParams, RoleAssignmentsGetByIdResponse, - RoleAssignmentsListResponse, - RoleAssignmentsListForScopeResponse, RoleAssignmentsListForResourceNextResponse, RoleAssignmentsListForResourceGroupNextResponse, RoleAssignmentsListNextResponse, @@ -90,14 +91,18 @@ export class RoleAssignmentsImpl implements RoleAssignments { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listForResourcePagingPage( resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, - options + options, + settings ); } }; @@ -109,18 +114,25 @@ export class RoleAssignmentsImpl implements RoleAssignments { parentResourcePath: string, resourceType: string, resourceName: string, - options?: RoleAssignmentsListForResourceOptionalParams + options?: RoleAssignmentsListForResourceOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listForResource( - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RoleAssignmentsListForResourceResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listForResourceNext( resourceGroupName, @@ -132,7 +144,9 @@ export class RoleAssignmentsImpl implements RoleAssignments { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -173,19 +187,33 @@ export class RoleAssignmentsImpl implements RoleAssignments { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listForResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listForResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listForResourceGroupPagingPage( resourceGroupName: string, - options?: RoleAssignmentsListForResourceGroupOptionalParams + options?: RoleAssignmentsListForResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listForResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RoleAssignmentsListForResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listForResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listForResourceGroupNext( resourceGroupName, @@ -193,7 +221,9 @@ export class RoleAssignmentsImpl implements RoleAssignments { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -224,22 +254,34 @@ export class RoleAssignmentsImpl implements RoleAssignments { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: RoleAssignmentsListOptionalParams + options?: RoleAssignmentsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RoleAssignmentsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -268,23 +310,35 @@ export class RoleAssignmentsImpl implements RoleAssignments { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listForScopePagingPage(scope, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listForScopePagingPage(scope, options, settings); } }; } private async *listForScopePagingPage( scope: string, - options?: RoleAssignmentsListForScopeOptionalParams + options?: RoleAssignmentsListForScopeOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listForScope(scope, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RoleAssignmentsListForScopeResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listForScope(scope, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listForScopeNext(scope, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -773,7 +827,6 @@ const listForResourceNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -798,7 +851,6 @@ const listForResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -819,7 +871,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -839,7 +890,6 @@ const listForScopeNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], headerParameters: [Parameters.accept], serializer diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleDefinitions.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleDefinitions.ts index 2c1eb00bf48..e240f2eec08 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleDefinitions.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleDefinitions.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { RoleDefinitions } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,13 +17,13 @@ import { RoleDefinition, RoleDefinitionsListNextOptionalParams, RoleDefinitionsListOptionalParams, + RoleDefinitionsListResponse, RoleDefinitionsDeleteOptionalParams, RoleDefinitionsDeleteResponse, RoleDefinitionsGetOptionalParams, RoleDefinitionsGetResponse, RoleDefinitionsCreateOrUpdateOptionalParams, RoleDefinitionsCreateOrUpdateResponse, - RoleDefinitionsListResponse, RoleDefinitionsGetByIdOptionalParams, RoleDefinitionsGetByIdResponse, RoleDefinitionsListNextResponse @@ -58,23 +59,35 @@ export class RoleDefinitionsImpl implements RoleDefinitions { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(scope, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(scope, options, settings); } }; } private async *listPagingPage( scope: string, - options?: RoleDefinitionsListOptionalParams + options?: RoleDefinitionsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(scope, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RoleDefinitionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(scope, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(scope, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -303,7 +316,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], headerParameters: [Parameters.accept], serializer diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/pagingHelper.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/pagingHelper.ts new file mode 100644 index 00000000000..269a2b9814b --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/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/authorization/arm-authorization-profile-2020-09-01-hybrid/test/sampleTest.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/test/sampleTest.ts index 7ed89b043e1..25aeb3ebcc3 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/test/sampleTest.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables }; describe("My test", () => { let recorder: Recorder; - beforeEach(async function() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/tsconfig.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/tsconfig.json index 3e6ae96443f..8c3acabada9 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/tsconfig.json +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/tsconfig.json @@ -15,11 +15,17 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-authorization-profile-2020-09-01-hybrid": [ + "./src/index" + ] + } }, "include": [ "./src/**/*.ts", - "./test/**/*.ts" + "./test/**/*.ts", + "samples-dev/**/*.ts" ], "exclude": [ "node_modules" diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/CHANGELOG.md b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/CHANGELOG.md index d73fe0bd609..0811ea78b76 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/CHANGELOG.md +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History + +## 2.1.0 (2022-12-19) + +**Features** + - Added Interface MonetaryCommitment + - Added Interface MonetaryCredit + - Added Interface RecurringCharge + - Added function getContinuationToken + - Interface UsageAggregatesListNextOptionalParams no longer has parameter aggregationGranularity + - Interface UsageAggregatesListNextOptionalParams no longer has parameter continuationToken + - Interface UsageAggregatesListNextOptionalParams no longer has parameter showDetails + ## 2.0.0 (2022-03-10) **features** diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/_meta.json b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/_meta.json index 648ff4bb38b..3e1b72bfda4 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/_meta.json +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/_meta.json @@ -1,8 +1,8 @@ { "commit": "1067b78669466324a1a2666adf053433c61e7f77", "readme": "specification/commerce/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\commerce\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --tag=profile-hybrid-2020-09-01 --profile-content=profile-hybrid-2020-09-01", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\commerce\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.5.20221215.1 --generate-sample=true --profile-content=profile-hybrid-2020-09-01", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.1.1", - "use": "@autorest/typescript@6.0.0-beta.16" + "release_tool": "@azure-tools/js-sdk-release-tools@2.5.4", + "use": "@autorest/typescript@6.0.0-rc.5.20221215.1" } \ No newline at end of file diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/package.json b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/package.json index bc73273f79d..349c2bb6a77 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/package.json +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for UsageManagementClient.", - "version": "2.0.0", + "version": "2.1.0", "engines": { "node": ">=14.0.0" }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -34,15 +34,20 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.2.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^8.2.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "@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" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -91,9 +96,8 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", - "integration-test:browser": "echo skipped", - "docs": "echo skipped" + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, "//metadata": { @@ -104,5 +108,14 @@ } ] }, - "autoPublish": true + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-commerce-profile-2020-09-01-hybrid?view=azure-node-preview" + } } diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json new file mode 100644 index 00000000000..f721723386d --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/review/arm-commerce-profile-2020-09-01-hybrid.api.md b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/review/arm-commerce-profile-2020-09-01-hybrid.api.md index bf626b28ebb..b7fafba9402 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/review/arm-commerce-profile-2020-09-01-hybrid.api.md +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/review/arm-commerce-profile-2020-09-01-hybrid.api.md @@ -17,6 +17,9 @@ export interface ErrorResponse { message?: string; } +// @public +export function getContinuationToken(page: unknown): string | undefined; + // @public export interface InfoField { project?: string; @@ -39,20 +42,20 @@ export interface MeterInfo { } // @public -export type MonetaryCommitment = OfferTermInfoAutoGenerated & { +export interface MonetaryCommitment extends OfferTermInfoAutoGenerated { + excludedMeterIds?: string[]; name: "Monetary Commitment"; tieredDiscount?: { [propertyName: string]: number; }; - excludedMeterIds?: string[]; -}; +} // @public -export type MonetaryCredit = OfferTermInfoAutoGenerated & { - name: "Monetary Credit"; +export interface MonetaryCredit extends OfferTermInfoAutoGenerated { credit?: number; excludedMeterIds?: string[]; -}; + name: "Monetary Credit"; +} // @public export type OfferTermInfo = "Recurring Charge" | "Monetary Commitment" | "Monetary Credit"; @@ -87,10 +90,10 @@ export interface RateCardQueryParameters { } // @public -export type RecurringCharge = OfferTermInfoAutoGenerated & { +export interface RecurringCharge extends OfferTermInfoAutoGenerated { name: "Recurring Charge"; recurringCharge?: number; -}; +} // @public export interface ResourceRateCardInfo { @@ -108,9 +111,6 @@ export interface UsageAggregates { // @public export interface UsageAggregatesListNextOptionalParams extends coreClient.OperationOptions { - aggregationGranularity?: AggregationGranularity; - continuationToken?: string; - showDetails?: boolean; } // @public diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/sample.env b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/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/commerce/arm-commerce-profile-2020-09-01-hybrid/samples-dev/rateCardGetSample.ts b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples-dev/rateCardGetSample.ts new file mode 100644 index 00000000000..89a6d8a1fb4 --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples-dev/rateCardGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { UsageManagementClient } from "@azure/arm-commerce-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. + * + * @summary Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. + * x-ms-original-file: specification/commerce/resource-manager/Microsoft.Commerce/preview/2015-06-01-preview/examples/GetRateCard.json + */ +async function getRateCard() { + const subscriptionId = + process.env["COMMERCE_SUBSCRIPTION_ID"] || + "6d61cc05-8f8f-4916-b1b9-f1d9c25aae27"; + const filter = + "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'"; + const credential = new DefaultAzureCredential(); + const client = new UsageManagementClient(credential, subscriptionId); + const result = await client.rateCard.get(filter); + console.log(result); +} + +async function main() { + getRateCard(); +} + +main().catch(console.error); diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/README.md b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/README.md new file mode 100644 index 00000000000..61fda751f60 --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/README.md @@ -0,0 +1,50 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [rateCardGetSample.js][ratecardgetsample] | Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. x-ms-original-file: specification/commerce/resource-manager/Microsoft.Commerce/preview/2015-06-01-preview/examples/GetRateCard.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 rateCardGetSample.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 COMMERCE_SUBSCRIPTION_ID="" node rateCardGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[ratecardgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/rateCardGetSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-commerce-profile-2020-09-01-hybrid?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/README.md diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/package.json b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/package.json new file mode 100644 index 00000000000..abaeba666e1 --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-commerce-profile-2020-09-01-hybrid-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/commerce/arm-commerce-profile-2020-09-01-hybrid" + }, + "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/commerce/arm-commerce-profile-2020-09-01-hybrid", + "dependencies": { + "@azure/arm-commerce-profile-2020-09-01-hybrid": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/rateCardGetSample.js b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/rateCardGetSample.js new file mode 100644 index 00000000000..d7e62c15956 --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/rateCardGetSample.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 { UsageManagementClient } = require("@azure/arm-commerce-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. + * + * @summary Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. + * x-ms-original-file: specification/commerce/resource-manager/Microsoft.Commerce/preview/2015-06-01-preview/examples/GetRateCard.json + */ +async function getRateCard() { + const subscriptionId = + process.env["COMMERCE_SUBSCRIPTION_ID"] || "6d61cc05-8f8f-4916-b1b9-f1d9c25aae27"; + const filter = + "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'"; + const credential = new DefaultAzureCredential(); + const client = new UsageManagementClient(credential, subscriptionId); + const result = await client.rateCard.get(filter); + console.log(result); +} + +async function main() { + getRateCard(); +} + +main().catch(console.error); diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/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/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/README.md b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/README.md new file mode 100644 index 00000000000..85fea7bcc5f --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/README.md @@ -0,0 +1,63 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [rateCardGetSample.ts][ratecardgetsample] | Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. x-ms-original-file: specification/commerce/resource-manager/Microsoft.Commerce/preview/2015-06-01-preview/examples/GetRateCard.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/rateCardGetSample.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 COMMERCE_SUBSCRIPTION_ID="" node dist/rateCardGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[ratecardgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/src/rateCardGetSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-commerce-profile-2020-09-01-hybrid?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/package.json b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/package.json new file mode 100644 index 00000000000..427b2875bb0 --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-commerce-profile-2020-09-01-hybrid-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "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/commerce/arm-commerce-profile-2020-09-01-hybrid" + }, + "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/commerce/arm-commerce-profile-2020-09-01-hybrid", + "dependencies": { + "@azure/arm-commerce-profile-2020-09-01-hybrid": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~4.8.0", + "rimraf": "latest" + } +} diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/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/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/src/rateCardGetSample.ts b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/src/rateCardGetSample.ts new file mode 100644 index 00000000000..89a6d8a1fb4 --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/src/rateCardGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { UsageManagementClient } from "@azure/arm-commerce-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. + * + * @summary Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. + * x-ms-original-file: specification/commerce/resource-manager/Microsoft.Commerce/preview/2015-06-01-preview/examples/GetRateCard.json + */ +async function getRateCard() { + const subscriptionId = + process.env["COMMERCE_SUBSCRIPTION_ID"] || + "6d61cc05-8f8f-4916-b1b9-f1d9c25aae27"; + const filter = + "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'"; + const credential = new DefaultAzureCredential(); + const client = new UsageManagementClient(credential, subscriptionId); + const result = await client.rateCard.get(filter); + console.log(result); +} + +async function main() { + getRateCard(); +} + +main().catch(console.error); diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json new file mode 100644 index 00000000000..e26ce2a6d8f --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/samples/v2/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/commerce/arm-commerce-profile-2020-09-01-hybrid/src/index.ts b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/index.ts index 395022854d5..b2c58875f15 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/index.ts +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { UsageManagementClient } from "./usageManagementClient"; export * from "./operationsInterfaces"; diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/models/index.ts b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/models/index.ts index 98faaed498c..d3b3f65974f 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/models/index.ts +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/models/index.ts @@ -129,32 +129,33 @@ export interface RateCardQueryParameters { } /** Indicates that this is a monetary credit offer. */ -export type MonetaryCredit = OfferTermInfoAutoGenerated & { +export interface MonetaryCredit extends OfferTermInfoAutoGenerated { /** Polymorphic discriminator, which specifies the different types this object can be */ name: "Monetary Credit"; /** The amount of credit provided under the terms of the given offer level. */ credit?: number; /** An array of meter ids that are excluded from the given offer terms. */ excludedMeterIds?: string[]; -}; +} /** Indicates that a monetary commitment is required for this offer */ -export type MonetaryCommitment = OfferTermInfoAutoGenerated & { +export interface MonetaryCommitment extends OfferTermInfoAutoGenerated { /** Polymorphic discriminator, which specifies the different types this object can be */ name: "Monetary Commitment"; /** The list of key/value pairs for the tiered meter rates, in the format 'key':'value' where key = price, and value = the corresponding discount percentage. This field is used only by offer terms of type 'Monetary Commitment'. */ tieredDiscount?: { [propertyName: string]: number }; /** An array of meter ids that are excluded from the given offer terms. */ excludedMeterIds?: string[]; -}; +} /** Indicates a recurring charge is present for this offer. */ -export type RecurringCharge = OfferTermInfoAutoGenerated & { +export interface RecurringCharge extends OfferTermInfoAutoGenerated { /** Polymorphic discriminator, which specifies the different types this object can be */ name: "Recurring Charge"; /** The amount of recurring charge as per the offer term. */ recurringCharge?: number; -}; +} + /** Defines values for AggregationGranularity. */ export type AggregationGranularity = "Daily" | "Hourly"; /** Defines values for OfferTermInfo. */ @@ -179,14 +180,7 @@ export type UsageAggregatesListResponse = UsageAggregationListResult; /** Optional parameters. */ export interface UsageAggregatesListNextOptionalParams - extends coreClient.OperationOptions { - /** `True` returns usage data in instance-level detail, `false` causes server-side aggregation with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for website consumption. If you specify showDetails = false, the data will be aggregated as a single line item for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and usageEndTime). */ - showDetails?: boolean; - /** `Daily` (default) returns the data in daily granularity, `Hourly` returns the data in hourly granularity. */ - aggregationGranularity?: AggregationGranularity; - /** Used when a continuation token string is provided in the response body of the previous call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of the day/hour (based on the granularity) passed in. */ - continuationToken?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type UsageAggregatesListNextResponse = UsageAggregationListResult; diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/operations/usageAggregates.ts b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/operations/usageAggregates.ts index c52ce99bf5d..60cf6b67620 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/operations/usageAggregates.ts +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/operations/usageAggregates.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { UsageAggregates } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -56,8 +57,16 @@ export class UsageAggregatesImpl implements UsageAggregates { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(reportedStartTime, reportedEndTime, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + reportedStartTime, + reportedEndTime, + options, + settings + ); } }; } @@ -65,20 +74,24 @@ export class UsageAggregatesImpl implements UsageAggregates { private async *listPagingPage( reportedStartTime: Date, reportedEndTime: Date, - options?: UsageAggregatesListOptionalParams + options?: UsageAggregatesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(reportedStartTime, reportedEndTime, options); - yield result.value || []; - let continuationToken = result.nextLink; - while (continuationToken) { - result = await this._listNext( - reportedStartTime, - reportedEndTime, - continuationToken, - options - ); + let result: UsageAggregatesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(reportedStartTime, reportedEndTime, options); + let page = result.value || []; continuationToken = result.nextLink; - yield result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -115,19 +128,15 @@ export class UsageAggregatesImpl implements UsageAggregates { /** * ListNext - * @param reportedStartTime The start of the time range to retrieve data for. - * @param reportedEndTime The end of the time range to retrieve data for. * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ private _listNext( - reportedStartTime: Date, - reportedEndTime: Date, nextLink: string, options?: UsageAggregatesListNextOptionalParams ): Promise { return this.client.sendOperationRequest( - { reportedStartTime, reportedEndTime, nextLink, options }, + { nextLink, options }, listNextOperationSpec ); } @@ -170,14 +179,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [ - Parameters.reportedStartTime, - Parameters.reportedEndTime, - Parameters.showDetails, - Parameters.aggregationGranularity, - Parameters.continuationToken, - Parameters.apiVersion - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/pagingHelper.ts b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/pagingHelper.ts new file mode 100644 index 00000000000..269a2b9814b --- /dev/null +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/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/commerce/arm-commerce-profile-2020-09-01-hybrid/src/usageManagementClient.ts b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/usageManagementClient.ts index 0eb3e2e6ecf..a11ad108c40 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/usageManagementClient.ts +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/src/usageManagementClient.ts @@ -7,6 +7,12 @@ */ 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 { UsageAggregatesImpl, RateCardImpl } from "./operations"; import { UsageAggregates, RateCard } from "./operationsInterfaces"; @@ -45,24 +51,54 @@ export class UsageManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-commerce-profile-2020-09-01-hybrid/2.0.0`; + const packageDetails = `azsdk-js-arm-commerce-profile-2020-09-01-hybrid/2.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + 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; @@ -71,6 +107,35 @@ export class UsageManagementClient extends coreClient.ServiceClient { this.apiVersion = options.apiVersion || "2015-06-01-preview"; this.usageAggregates = new UsageAggregatesImpl(this); this.rateCard = new RateCardImpl(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); } usageAggregates: UsageAggregates; diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/test/sampleTest.ts b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/test/sampleTest.ts index 7ed89b043e1..25aeb3ebcc3 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/test/sampleTest.ts +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables }; describe("My test", () => { let recorder: Recorder; - beforeEach(async function() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/tsconfig.json b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/tsconfig.json index 3e6ae96443f..ca3e46f864f 100644 --- a/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/tsconfig.json +++ b/sdk/commerce/arm-commerce-profile-2020-09-01-hybrid/tsconfig.json @@ -15,11 +15,17 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-commerce-profile-2020-09-01-hybrid": [ + "./src/index" + ] + } }, "include": [ "./src/**/*.ts", - "./test/**/*.ts" + "./test/**/*.ts", + "samples-dev/**/*.ts" ], "exclude": [ "node_modules" diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/CHANGELOG.md b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/CHANGELOG.md index 2e666b46781..44315945308 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/CHANGELOG.md +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/CHANGELOG.md @@ -1,15 +1,64 @@ # Release History + +## 2.1.0 (2022-12-19) + +**Features** -## 2.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added Interface AvailabilitySet + - Added Interface AvailabilitySetUpdate + - Added Interface DedicatedHost + - Added Interface DedicatedHostGroup + - Added Interface DedicatedHostGroupUpdate + - Added Interface DedicatedHostInstanceViewWithName + - Added Interface DedicatedHostUpdate + - Added Interface Disk + - Added Interface DiskEncryptionSet + - Added Interface DiskEncryptionSetParameters + - Added Interface Image_2 + - Added Interface ImageDataDisk + - Added Interface ImageOSDisk + - Added Interface ImageReference + - Added Interface ImageUpdate + - Added Interface ManagedDiskParameters + - Added Interface NetworkInterfaceReference + - Added Interface ProximityPlacementGroup + - Added Interface ProximityPlacementGroupUpdate + - Added Interface RequestRateByIntervalInput + - Added Interface RollingUpgradeStatusInfo + - Added Interface Snapshot + - Added Interface SshPublicKeyResource + - Added Interface SshPublicKeyUpdateResource + - Added Interface SubResourceWithColocationStatus + - Added Interface ThrottledRequestsInput + - Added Interface VirtualMachine + - Added Interface VirtualMachineCaptureResult + - Added Interface VirtualMachineExtension + - Added Interface VirtualMachineExtensionImage + - Added Interface VirtualMachineExtensionUpdate + - Added Interface VirtualMachineImage + - Added Interface VirtualMachineImageResource + - Added Interface VirtualMachineScaleSet + - Added Interface VirtualMachineScaleSetExtension + - Added Interface VirtualMachineScaleSetExtensionUpdate + - Added Interface VirtualMachineScaleSetIPConfiguration + - Added Interface VirtualMachineScaleSetNetworkConfiguration + - Added Interface VirtualMachineScaleSetReimageParameters + - Added Interface VirtualMachineScaleSetUpdate + - Added Interface VirtualMachineScaleSetUpdateIPConfiguration + - Added Interface VirtualMachineScaleSetUpdateNetworkConfiguration + - Added Interface VirtualMachineScaleSetVM + - Added Interface VirtualMachineScaleSetVMExtension + - Added Interface VirtualMachineScaleSetVMExtensionUpdate + - Added Interface VirtualMachineScaleSetVMReimageParameters + - Added Interface VirtualMachineUpdate + - Added function getContinuationToken + - Interface AvailabilitySetsListBySubscriptionNextOptionalParams no longer has parameter expand + - Interface VirtualMachineScaleSetVMsListNextOptionalParams no longer has parameter expand + - Interface VirtualMachineScaleSetVMsListNextOptionalParams no longer has parameter filter + - Interface VirtualMachineScaleSetVMsListNextOptionalParams no longer has parameter select + - Interface VirtualMachinesListAllNextOptionalParams no longer has parameter statusOnly + + ## 2.0.0 (2022-03-10) The package of @azure/arm-compute-profile-2020-09-01-hybrid is using our next generation design principles since version 2.0.0, which contains breaking changes. diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/_meta.json b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/_meta.json index 5b410293832..4cac94508d5 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/_meta.json +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/_meta.json @@ -1,8 +1,8 @@ { "commit": "1067b78669466324a1a2666adf053433c61e7f77", "readme": "specification/compute/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\compute\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --tag=profile-hybrid-2020-09-01 --profile-content=profile-hybrid-2020-09-01", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\compute\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.5.20221215.1 --generate-sample=true --profile-content=profile-hybrid-2020-09-01", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.1.1", - "use": "@autorest/typescript@6.0.0-beta.16" + "release_tool": "@azure-tools/js-sdk-release-tools@2.5.4", + "use": "@autorest/typescript@6.0.0-rc.5.20221215.1" } \ No newline at end of file diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/package.json b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/package.json index b923f7c0db3..a54465ae325 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/package.json +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ComputeManagementClient.", - "version": "2.0.1", + "version": "2.1.0", "engines": { "node": ">=14.0.0" }, @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -36,15 +36,20 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.2.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^8.2.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "@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" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -93,9 +98,8 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", - "integration-test:browser": "echo skipped", - "docs": "echo skipped" + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, "//metadata": { @@ -106,5 +110,14 @@ } ] }, - "autoPublish": true + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-compute-profile-2020-09-01-hybrid?view=azure-node-preview" + } } diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json new file mode 100644 index 00000000000..f721723386d --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/review/arm-compute-profile-2020-09-01-hybrid.api.md b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/review/arm-compute-profile-2020-09-01-hybrid.api.md index 2efe9a5d247..95a6f24deaf 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/review/arm-compute-profile-2020-09-01-hybrid.api.md +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/review/arm-compute-profile-2020-09-01-hybrid.api.md @@ -70,14 +70,14 @@ export interface AutomaticRepairsPolicy { } // @public -export type AvailabilitySet = Resource & { - sku?: Sku; - platformUpdateDomainCount?: number; +export interface AvailabilitySet extends Resource { platformFaultDomainCount?: number; - virtualMachines?: SubResource[]; + platformUpdateDomainCount?: number; proximityPlacementGroup?: SubResource; + sku?: Sku; readonly statuses?: InstanceViewStatus[]; -}; + virtualMachines?: SubResource[]; +} // @public export interface AvailabilitySetListResult { @@ -126,7 +126,6 @@ export type AvailabilitySetsListAvailableSizesResponse = VirtualMachineSizeListR // @public export interface AvailabilitySetsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { - expand?: string; } // @public @@ -162,14 +161,14 @@ export interface AvailabilitySetsUpdateOptionalParams extends coreClient.Operati export type AvailabilitySetsUpdateResponse = AvailabilitySet; // @public -export type AvailabilitySetUpdate = UpdateResource & { - sku?: Sku; - platformUpdateDomainCount?: number; +export interface AvailabilitySetUpdate extends UpdateResource { platformFaultDomainCount?: number; - virtualMachines?: SubResource[]; + platformUpdateDomainCount?: number; proximityPlacementGroup?: SubResource; + sku?: Sku; readonly statuses?: InstanceViewStatus[]; -}; + virtualMachines?: SubResource[]; +} // @public export interface AvailablePatchSummary { @@ -316,17 +315,17 @@ export interface DataDiskImage { } // @public -export type DedicatedHost = Resource & { - sku: Sku; - platformFaultDomain?: number; +export interface DedicatedHost extends Resource { autoReplaceOnFailure?: boolean; readonly hostId?: string; - readonly virtualMachines?: SubResourceReadOnly[]; - licenseType?: DedicatedHostLicenseTypes; - readonly provisioningTime?: Date; - readonly provisioningState?: string; readonly instanceView?: DedicatedHostInstanceView; -}; + licenseType?: DedicatedHostLicenseTypes; + platformFaultDomain?: number; + readonly provisioningState?: string; + readonly provisioningTime?: Date; + sku: Sku; + readonly virtualMachines?: SubResourceReadOnly[]; +} // @public export interface DedicatedHostAllocatableVM { @@ -340,13 +339,13 @@ export interface DedicatedHostAvailableCapacity { } // @public -export type DedicatedHostGroup = Resource & { - zones?: string[]; - platformFaultDomainCount?: number; +export interface DedicatedHostGroup extends Resource { readonly hosts?: SubResourceReadOnly[]; readonly instanceView?: DedicatedHostGroupInstanceView; + platformFaultDomainCount?: number; supportAutomaticPlacement?: boolean; -}; + zones?: string[]; +} // @public (undocumented) export interface DedicatedHostGroupInstanceView { @@ -423,13 +422,13 @@ export interface DedicatedHostGroupsUpdateOptionalParams extends coreClient.Oper export type DedicatedHostGroupsUpdateResponse = DedicatedHostGroup; // @public -export type DedicatedHostGroupUpdate = UpdateResource & { - zones?: string[]; - platformFaultDomainCount?: number; +export interface DedicatedHostGroupUpdate extends UpdateResource { readonly hosts?: SubResourceReadOnly[]; readonly instanceView?: DedicatedHostGroupInstanceView; + platformFaultDomainCount?: number; supportAutomaticPlacement?: boolean; -}; + zones?: string[]; +} // @public export interface DedicatedHostInstanceView { @@ -439,9 +438,9 @@ export interface DedicatedHostInstanceView { } // @public -export type DedicatedHostInstanceViewWithName = DedicatedHostInstanceView & { +export interface DedicatedHostInstanceViewWithName extends DedicatedHostInstanceView { readonly name?: string; -}; +} // @public export type DedicatedHostLicenseTypes = "None" | "Windows_Server_Hybrid" | "Windows_Server_Perpetual"; @@ -510,16 +509,16 @@ export interface DedicatedHostsUpdateOptionalParams extends coreClient.Operation export type DedicatedHostsUpdateResponse = DedicatedHost; // @public -export type DedicatedHostUpdate = UpdateResource & { - platformFaultDomain?: number; +export interface DedicatedHostUpdate extends UpdateResource { autoReplaceOnFailure?: boolean; readonly hostId?: string; - readonly virtualMachines?: SubResourceReadOnly[]; - licenseType?: DedicatedHostLicenseTypes; - readonly provisioningTime?: Date; - readonly provisioningState?: string; readonly instanceView?: DedicatedHostInstanceView; -}; + licenseType?: DedicatedHostLicenseTypes; + platformFaultDomain?: number; + readonly provisioningState?: string; + readonly provisioningTime?: Date; + readonly virtualMachines?: SubResourceReadOnly[]; +} // @public export interface DiagnosticsProfile { @@ -544,24 +543,24 @@ export interface DisallowedConfiguration { } // @public -export type Disk = Resource & { - readonly managedBy?: string; - sku?: DiskSku; - zones?: string[]; - readonly timeCreated?: Date; - osType?: OperatingSystemTypes; - hyperVGeneration?: HyperVGeneration; +export interface Disk extends Resource { creationData?: CreationData; - diskSizeGB?: number; - readonly diskSizeBytes?: number; - readonly uniqueId?: string; - encryptionSettingsCollection?: EncryptionSettingsCollection; - readonly provisioningState?: string; diskIopsReadWrite?: number; diskMBpsReadWrite?: number; + readonly diskSizeBytes?: number; + diskSizeGB?: number; readonly diskState?: DiskState; encryption?: Encryption; -}; + encryptionSettingsCollection?: EncryptionSettingsCollection; + hyperVGeneration?: HyperVGeneration; + readonly managedBy?: string; + osType?: OperatingSystemTypes; + readonly provisioningState?: string; + sku?: DiskSku; + readonly timeCreated?: Date; + readonly uniqueId?: string; + zones?: string[]; +} // @public export type DiskCreateOption = string; @@ -570,12 +569,12 @@ export type DiskCreateOption = string; export type DiskCreateOptionTypes = string; // @public -export type DiskEncryptionSet = Resource & { - identity?: EncryptionSetIdentity; +export interface DiskEncryptionSet extends Resource { activeKey?: KeyVaultAndKeyReference; + identity?: EncryptionSetIdentity; readonly previousKeys?: KeyVaultAndKeyReference[]; readonly provisioningState?: string; -}; +} // @public export type DiskEncryptionSetIdentityType = string; @@ -587,7 +586,8 @@ export interface DiskEncryptionSetList { } // @public -export type DiskEncryptionSetParameters = SubResource & {}; +export interface DiskEncryptionSetParameters extends SubResource { +} // @public export interface DiskEncryptionSets { @@ -835,6 +835,9 @@ export interface EncryptionSettingsElement { // @public export type EncryptionType = string; +// @public +export function getContinuationToken(page: unknown): string | undefined; + // @public export interface GrantAccessData { // (undocumented) @@ -857,18 +860,18 @@ export type HyperVGenerationType = string; export type HyperVGenerationTypes = string; // @public -type Image_2 = Resource & { +interface Image_2 extends Resource { + hyperVGeneration?: HyperVGenerationTypes; + readonly provisioningState?: string; sourceVirtualMachine?: SubResource; storageProfile?: ImageStorageProfile; - readonly provisioningState?: string; - hyperVGeneration?: HyperVGenerationTypes; -}; +} export { Image_2 as Image } // @public -export type ImageDataDisk = ImageDisk & { +export interface ImageDataDisk extends ImageDisk { lun: number; -}; +} // @public export interface ImageDisk { @@ -894,19 +897,19 @@ export interface ImageListResult { } // @public -export type ImageOSDisk = ImageDisk & { - osType: OperatingSystemTypes; +export interface ImageOSDisk extends ImageDisk { osState: OperatingSystemStateTypes; -}; + osType: OperatingSystemTypes; +} // @public -export type ImageReference = SubResource & { - publisher?: string; +export interface ImageReference extends SubResource { + readonly exactVersion?: string; offer?: string; + publisher?: string; sku?: string; version?: string; - readonly exactVersion?: string; -}; +} // @public export interface Images { @@ -989,12 +992,12 @@ export interface ImagesUpdateOptionalParams extends coreClient.OperationOptions export type ImagesUpdateResponse = Image_2; // @public -export type ImageUpdate = UpdateResource & { +export interface ImageUpdate extends UpdateResource { + hyperVGeneration?: HyperVGenerationTypes; + readonly provisioningState?: string; sourceVirtualMachine?: SubResource; storageProfile?: ImageStorageProfile; - readonly provisioningState?: string; - hyperVGeneration?: HyperVGenerationTypes; -}; +} // @public export type InGuestPatchMode = string; @@ -1046,33 +1049,25 @@ export interface KeyVaultSecretReference { // @public export enum KnownAccessLevel { - // (undocumented) None = "None", - // (undocumented) Read = "Read", - // (undocumented) Write = "Write" } // @public export enum KnownAvailabilitySetSkuTypes { - // (undocumented) Aligned = "Aligned", - // (undocumented) Classic = "Classic" } // @public export enum KnownDiffDiskOptions { - // (undocumented) Local = "Local" } // @public export enum KnownDiffDiskPlacement { - // (undocumented) CacheDisk = "CacheDisk", - // (undocumented) ResourceDisk = "ResourceDisk" } @@ -1089,17 +1084,13 @@ export enum KnownDiskCreateOption { // @public export enum KnownDiskCreateOptionTypes { - // (undocumented) Attach = "Attach", - // (undocumented) Empty = "Empty", - // (undocumented) FromImage = "FromImage" } // @public export enum KnownDiskEncryptionSetIdentityType { - // (undocumented) SystemAssigned = "SystemAssigned" } @@ -1129,119 +1120,84 @@ export enum KnownEncryptionType { // @public export enum KnownHyperVGeneration { - // (undocumented) V1 = "V1", - // (undocumented) V2 = "V2" } // @public export enum KnownHyperVGenerationType { - // (undocumented) V1 = "V1", - // (undocumented) V2 = "V2" } // @public export enum KnownHyperVGenerationTypes { - // (undocumented) V1 = "V1", - // (undocumented) V2 = "V2" } // @public export enum KnownInGuestPatchMode { - // (undocumented) AutomaticByOS = "AutomaticByOS", - // (undocumented) AutomaticByPlatform = "AutomaticByPlatform", - // (undocumented) Manual = "Manual" } // @public export enum KnownIPVersion { - // (undocumented) IPv4 = "IPv4", - // (undocumented) IPv6 = "IPv6" } // @public export enum KnownOrchestrationServiceNames { - // (undocumented) AutomaticRepairs = "AutomaticRepairs", - // (undocumented) DummyOrchestrationServiceName = "DummyOrchestrationServiceName" } // @public export enum KnownOrchestrationServiceState { - // (undocumented) NotRunning = "NotRunning", - // (undocumented) Running = "Running", - // (undocumented) Suspended = "Suspended" } // @public export enum KnownOrchestrationServiceStateAction { - // (undocumented) Resume = "Resume", - // (undocumented) Suspend = "Suspend" } // @public export enum KnownPatchAssessmentState { - // (undocumented) Available = "Available", - // (undocumented) Excluded = "Excluded", - // (undocumented) Failed = "Failed", - // (undocumented) Installed = "Installed", - // (undocumented) NotSelected = "NotSelected", - // (undocumented) Pending = "Pending" } // @public export enum KnownPatchOperationStatus { - // (undocumented) CompletedWithWarnings = "CompletedWithWarnings", - // (undocumented) Failed = "Failed", - // (undocumented) InProgress = "InProgress", - // (undocumented) Succeeded = "Succeeded" } // @public export enum KnownProximityPlacementGroupType { - // (undocumented) Standard = "Standard", - // (undocumented) Ultra = "Ultra" } // @public export enum KnownRebootStatus { - // (undocumented) Completed = "Completed", - // (undocumented) Failed = "Failed", - // (undocumented) NotNeeded = "NotNeeded", - // (undocumented) Required = "Required", - // (undocumented) Started = "Started" } @@ -1254,395 +1210,212 @@ export enum KnownSnapshotStorageAccountTypes { // @public export enum KnownSoftwareUpdateRebootBehavior { - // (undocumented) AlwaysRequiresReboot = "AlwaysRequiresReboot", - // (undocumented) CanRequestReboot = "CanRequestReboot", - // (undocumented) NeverReboots = "NeverReboots" } // @public export enum KnownStorageAccountTypes { - // (undocumented) PremiumLRS = "Premium_LRS", - // (undocumented) StandardLRS = "Standard_LRS", - // (undocumented) StandardSSDLRS = "StandardSSD_LRS", - // (undocumented) UltraSSDLRS = "UltraSSD_LRS" } // @public export enum KnownVirtualMachineEvictionPolicyTypes { - // (undocumented) Deallocate = "Deallocate", - // (undocumented) Delete = "Delete" } // @public export enum KnownVirtualMachinePriorityTypes { - // (undocumented) Low = "Low", - // (undocumented) Regular = "Regular", - // (undocumented) Spot = "Spot" } // @public export enum KnownVirtualMachineScaleSetScaleInRules { - // (undocumented) Default = "Default", - // (undocumented) NewestVM = "NewestVM", - // (undocumented) OldestVM = "OldestVM" } // @public export enum KnownVirtualMachineSizeTypes { - // (undocumented) BasicA0 = "Basic_A0", - // (undocumented) BasicA1 = "Basic_A1", - // (undocumented) BasicA2 = "Basic_A2", - // (undocumented) BasicA3 = "Basic_A3", - // (undocumented) BasicA4 = "Basic_A4", - // (undocumented) StandardA0 = "Standard_A0", - // (undocumented) StandardA1 = "Standard_A1", - // (undocumented) StandardA10 = "Standard_A10", - // (undocumented) StandardA11 = "Standard_A11", - // (undocumented) StandardA1V2 = "Standard_A1_v2", - // (undocumented) StandardA2 = "Standard_A2", - // (undocumented) StandardA2MV2 = "Standard_A2m_v2", - // (undocumented) StandardA2V2 = "Standard_A2_v2", - // (undocumented) StandardA3 = "Standard_A3", - // (undocumented) StandardA4 = "Standard_A4", - // (undocumented) StandardA4MV2 = "Standard_A4m_v2", - // (undocumented) StandardA4V2 = "Standard_A4_v2", - // (undocumented) StandardA5 = "Standard_A5", - // (undocumented) StandardA6 = "Standard_A6", - // (undocumented) StandardA7 = "Standard_A7", - // (undocumented) StandardA8 = "Standard_A8", - // (undocumented) StandardA8MV2 = "Standard_A8m_v2", - // (undocumented) StandardA8V2 = "Standard_A8_v2", - // (undocumented) StandardA9 = "Standard_A9", - // (undocumented) StandardB1Ms = "Standard_B1ms", - // (undocumented) StandardB1S = "Standard_B1s", - // (undocumented) StandardB2Ms = "Standard_B2ms", - // (undocumented) StandardB2S = "Standard_B2s", - // (undocumented) StandardB4Ms = "Standard_B4ms", - // (undocumented) StandardB8Ms = "Standard_B8ms", - // (undocumented) StandardD1 = "Standard_D1", - // (undocumented) StandardD11 = "Standard_D11", - // (undocumented) StandardD11V2 = "Standard_D11_v2", - // (undocumented) StandardD12 = "Standard_D12", - // (undocumented) StandardD12V2 = "Standard_D12_v2", - // (undocumented) StandardD13 = "Standard_D13", - // (undocumented) StandardD13V2 = "Standard_D13_v2", - // (undocumented) StandardD14 = "Standard_D14", - // (undocumented) StandardD14V2 = "Standard_D14_v2", - // (undocumented) StandardD15V2 = "Standard_D15_v2", - // (undocumented) StandardD16SV3 = "Standard_D16s_v3", - // (undocumented) StandardD16V3 = "Standard_D16_v3", - // (undocumented) StandardD1V2 = "Standard_D1_v2", - // (undocumented) StandardD2 = "Standard_D2", - // (undocumented) StandardD2SV3 = "Standard_D2s_v3", - // (undocumented) StandardD2V2 = "Standard_D2_v2", - // (undocumented) StandardD2V3 = "Standard_D2_v3", - // (undocumented) StandardD3 = "Standard_D3", - // (undocumented) StandardD32SV3 = "Standard_D32s_v3", - // (undocumented) StandardD32V3 = "Standard_D32_v3", - // (undocumented) StandardD3V2 = "Standard_D3_v2", - // (undocumented) StandardD4 = "Standard_D4", - // (undocumented) StandardD4SV3 = "Standard_D4s_v3", - // (undocumented) StandardD4V2 = "Standard_D4_v2", - // (undocumented) StandardD4V3 = "Standard_D4_v3", - // (undocumented) StandardD5V2 = "Standard_D5_v2", - // (undocumented) StandardD64SV3 = "Standard_D64s_v3", - // (undocumented) StandardD64V3 = "Standard_D64_v3", - // (undocumented) StandardD8SV3 = "Standard_D8s_v3", - // (undocumented) StandardD8V3 = "Standard_D8_v3", - // (undocumented) StandardDS1 = "Standard_DS1", - // (undocumented) StandardDS11 = "Standard_DS11", - // (undocumented) StandardDS11V2 = "Standard_DS11_v2", - // (undocumented) StandardDS12 = "Standard_DS12", - // (undocumented) StandardDS12V2 = "Standard_DS12_v2", - // (undocumented) StandardDS13 = "Standard_DS13", - // (undocumented) StandardDS132V2 = "Standard_DS13-2_v2", - // (undocumented) StandardDS134V2 = "Standard_DS13-4_v2", - // (undocumented) StandardDS13V2 = "Standard_DS13_v2", - // (undocumented) StandardDS14 = "Standard_DS14", - // (undocumented) StandardDS144V2 = "Standard_DS14-4_v2", - // (undocumented) StandardDS148V2 = "Standard_DS14-8_v2", - // (undocumented) StandardDS14V2 = "Standard_DS14_v2", - // (undocumented) StandardDS15V2 = "Standard_DS15_v2", - // (undocumented) StandardDS1V2 = "Standard_DS1_v2", - // (undocumented) StandardDS2 = "Standard_DS2", - // (undocumented) StandardDS2V2 = "Standard_DS2_v2", - // (undocumented) StandardDS3 = "Standard_DS3", - // (undocumented) StandardDS3V2 = "Standard_DS3_v2", - // (undocumented) StandardDS4 = "Standard_DS4", - // (undocumented) StandardDS4V2 = "Standard_DS4_v2", - // (undocumented) StandardDS5V2 = "Standard_DS5_v2", - // (undocumented) StandardE16SV3 = "Standard_E16s_v3", - // (undocumented) StandardE16V3 = "Standard_E16_v3", - // (undocumented) StandardE2SV3 = "Standard_E2s_v3", - // (undocumented) StandardE2V3 = "Standard_E2_v3", - // (undocumented) StandardE3216V3 = "Standard_E32-16_v3", - // (undocumented) StandardE328SV3 = "Standard_E32-8s_v3", - // (undocumented) StandardE32SV3 = "Standard_E32s_v3", - // (undocumented) StandardE32V3 = "Standard_E32_v3", - // (undocumented) StandardE4SV3 = "Standard_E4s_v3", - // (undocumented) StandardE4V3 = "Standard_E4_v3", - // (undocumented) StandardE6416SV3 = "Standard_E64-16s_v3", - // (undocumented) StandardE6432SV3 = "Standard_E64-32s_v3", - // (undocumented) StandardE64SV3 = "Standard_E64s_v3", - // (undocumented) StandardE64V3 = "Standard_E64_v3", - // (undocumented) StandardE8SV3 = "Standard_E8s_v3", - // (undocumented) StandardE8V3 = "Standard_E8_v3", - // (undocumented) StandardF1 = "Standard_F1", - // (undocumented) StandardF16 = "Standard_F16", - // (undocumented) StandardF16S = "Standard_F16s", - // (undocumented) StandardF16SV2 = "Standard_F16s_v2", - // (undocumented) StandardF1S = "Standard_F1s", - // (undocumented) StandardF2 = "Standard_F2", - // (undocumented) StandardF2S = "Standard_F2s", - // (undocumented) StandardF2SV2 = "Standard_F2s_v2", - // (undocumented) StandardF32SV2 = "Standard_F32s_v2", - // (undocumented) StandardF4 = "Standard_F4", - // (undocumented) StandardF4S = "Standard_F4s", - // (undocumented) StandardF4SV2 = "Standard_F4s_v2", - // (undocumented) StandardF64SV2 = "Standard_F64s_v2", - // (undocumented) StandardF72SV2 = "Standard_F72s_v2", - // (undocumented) StandardF8 = "Standard_F8", - // (undocumented) StandardF8S = "Standard_F8s", - // (undocumented) StandardF8SV2 = "Standard_F8s_v2", - // (undocumented) StandardG1 = "Standard_G1", - // (undocumented) StandardG2 = "Standard_G2", - // (undocumented) StandardG3 = "Standard_G3", - // (undocumented) StandardG4 = "Standard_G4", - // (undocumented) StandardG5 = "Standard_G5", - // (undocumented) StandardGS1 = "Standard_GS1", - // (undocumented) StandardGS2 = "Standard_GS2", - // (undocumented) StandardGS3 = "Standard_GS3", - // (undocumented) StandardGS4 = "Standard_GS4", - // (undocumented) StandardGS44 = "Standard_GS4-4", - // (undocumented) StandardGS48 = "Standard_GS4-8", - // (undocumented) StandardGS5 = "Standard_GS5", - // (undocumented) StandardGS516 = "Standard_GS5-16", - // (undocumented) StandardGS58 = "Standard_GS5-8", - // (undocumented) StandardH16 = "Standard_H16", - // (undocumented) StandardH16M = "Standard_H16m", - // (undocumented) StandardH16Mr = "Standard_H16mr", - // (undocumented) StandardH16R = "Standard_H16r", - // (undocumented) StandardH8 = "Standard_H8", - // (undocumented) StandardH8M = "Standard_H8m", - // (undocumented) StandardL16S = "Standard_L16s", - // (undocumented) StandardL32S = "Standard_L32s", - // (undocumented) StandardL4S = "Standard_L4s", - // (undocumented) StandardL8S = "Standard_L8s", - // (undocumented) StandardM12832Ms = "Standard_M128-32ms", - // (undocumented) StandardM12864Ms = "Standard_M128-64ms", - // (undocumented) StandardM128Ms = "Standard_M128ms", - // (undocumented) StandardM128S = "Standard_M128s", - // (undocumented) StandardM6416Ms = "Standard_M64-16ms", - // (undocumented) StandardM6432Ms = "Standard_M64-32ms", - // (undocumented) StandardM64Ms = "Standard_M64ms", - // (undocumented) StandardM64S = "Standard_M64s", - // (undocumented) StandardNC12 = "Standard_NC12", - // (undocumented) StandardNC12SV2 = "Standard_NC12s_v2", - // (undocumented) StandardNC12SV3 = "Standard_NC12s_v3", - // (undocumented) StandardNC24 = "Standard_NC24", - // (undocumented) StandardNC24R = "Standard_NC24r", - // (undocumented) StandardNC24RsV2 = "Standard_NC24rs_v2", - // (undocumented) StandardNC24RsV3 = "Standard_NC24rs_v3", - // (undocumented) StandardNC24SV2 = "Standard_NC24s_v2", - // (undocumented) StandardNC24SV3 = "Standard_NC24s_v3", - // (undocumented) StandardNC6 = "Standard_NC6", - // (undocumented) StandardNC6SV2 = "Standard_NC6s_v2", - // (undocumented) StandardNC6SV3 = "Standard_NC6s_v3", - // (undocumented) StandardND12S = "Standard_ND12s", - // (undocumented) StandardND24Rs = "Standard_ND24rs", - // (undocumented) StandardND24S = "Standard_ND24s", - // (undocumented) StandardND6S = "Standard_ND6s", - // (undocumented) StandardNV12 = "Standard_NV12", - // (undocumented) StandardNV24 = "Standard_NV24", - // (undocumented) StandardNV6 = "Standard_NV6" } // @public export enum KnownVmDiskTypes { - // (undocumented) None = "None", - // (undocumented) Unmanaged = "Unmanaged" } @@ -1739,15 +1512,15 @@ export interface MaintenanceRedeployStatus { } // @public -export type ManagedDiskParameters = SubResource & { - storageAccountType?: StorageAccountTypes; +export interface ManagedDiskParameters extends SubResource { diskEncryptionSet?: DiskEncryptionSetParameters; -}; + storageAccountType?: StorageAccountTypes; +} // @public -export type NetworkInterfaceReference = SubResource & { +export interface NetworkInterfaceReference extends SubResource { primary?: boolean; -}; +} // @public export interface NetworkProfile { @@ -1849,13 +1622,13 @@ export interface Plan { export type ProtocolTypes = "Http" | "Https"; // @public -export type ProximityPlacementGroup = Resource & { +export interface ProximityPlacementGroup extends Resource { + readonly availabilitySets?: SubResourceWithColocationStatus[]; + colocationStatus?: InstanceViewStatus; proximityPlacementGroupType?: ProximityPlacementGroupType; readonly virtualMachines?: SubResourceWithColocationStatus[]; readonly virtualMachineScaleSets?: SubResourceWithColocationStatus[]; - readonly availabilitySets?: SubResourceWithColocationStatus[]; - colocationStatus?: InstanceViewStatus; -}; +} // @public export interface ProximityPlacementGroupListResult { @@ -1931,7 +1704,8 @@ export type ProximityPlacementGroupsUpdateResponse = ProximityPlacementGroup; export type ProximityPlacementGroupType = string; // @public -export type ProximityPlacementGroupUpdate = UpdateResource & {}; +export interface ProximityPlacementGroupUpdate extends UpdateResource { +} // @public export interface PurchasePlan { @@ -1950,9 +1724,9 @@ export interface RecoveryWalkResponse { } // @public -export type RequestRateByIntervalInput = LogAnalyticsInputBase & { +export interface RequestRateByIntervalInput extends LogAnalyticsInputBase { intervalLength: IntervalInMins; -}; +} // @public export interface Resource { @@ -2012,12 +1786,12 @@ export interface RollingUpgradeRunningStatus { export type RollingUpgradeStatusCode = "RollingForward" | "Cancelled" | "Completed" | "Faulted"; // @public -export type RollingUpgradeStatusInfo = Resource & { - readonly policy?: RollingUpgradePolicy; - readonly runningStatus?: RollingUpgradeRunningStatus; - readonly progress?: RollingUpgradeProgressInfo; +export interface RollingUpgradeStatusInfo extends Resource { readonly error?: ApiError; -}; + readonly policy?: RollingUpgradePolicy; + readonly progress?: RollingUpgradeProgressInfo; + readonly runningStatus?: RollingUpgradeRunningStatus; +} // @public export interface ScaleInPolicy { @@ -2045,21 +1819,21 @@ export interface Sku { } // @public -export type Snapshot = Resource & { +export interface Snapshot extends Resource { + creationData?: CreationData; + readonly diskSizeBytes?: number; + diskSizeGB?: number; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + hyperVGeneration?: HyperVGeneration; + incremental?: boolean; readonly managedBy?: string; + osType?: OperatingSystemTypes; + readonly provisioningState?: string; sku?: SnapshotSku; readonly timeCreated?: Date; - osType?: OperatingSystemTypes; - hyperVGeneration?: HyperVGeneration; - creationData?: CreationData; - diskSizeGB?: number; - readonly diskSizeBytes?: number; readonly uniqueId?: string; - encryptionSettingsCollection?: EncryptionSettingsCollection; - readonly provisioningState?: string; - incremental?: boolean; - encryption?: Encryption; -}; +} // @public export interface SnapshotList { @@ -2206,9 +1980,9 @@ export interface SshPublicKeyGenerateKeyPairResult { } // @public -export type SshPublicKeyResource = Resource & { +export interface SshPublicKeyResource extends Resource { publicKey?: string; -}; +} // @public export interface SshPublicKeys { @@ -2288,9 +2062,9 @@ export interface SshPublicKeysUpdateOptionalParams extends coreClient.OperationO export type SshPublicKeysUpdateResponse = SshPublicKeyResource; // @public -export type SshPublicKeyUpdateResource = UpdateResource & { +export interface SshPublicKeyUpdateResource extends UpdateResource { publicKey?: string; -}; +} // @public export type StatusLevelTypes = "Info" | "Warning" | "Error"; @@ -2316,9 +2090,9 @@ export interface SubResourceReadOnly { } // @public (undocumented) -export type SubResourceWithColocationStatus = SubResource & { +export interface SubResourceWithColocationStatus extends SubResource { colocationStatus?: InstanceViewStatus; -}; +} // @public (undocumented) export interface TerminateNotificationProfile { @@ -2327,7 +2101,8 @@ export interface TerminateNotificationProfile { } // @public -export type ThrottledRequestsInput = LogAnalyticsInputBase & {}; +export interface ThrottledRequestsInput extends LogAnalyticsInputBase { +} // @public export interface UpdateResource { @@ -2433,32 +2208,32 @@ export interface VirtualHardDisk { } // @public -export type VirtualMachine = Resource & { - plan?: Plan; - readonly resources?: VirtualMachineExtension[]; - identity?: VirtualMachineIdentity; - zones?: string[]; - hardwareProfile?: HardwareProfile; - storageProfile?: StorageProfile; +export interface VirtualMachine extends Resource { additionalCapabilities?: AdditionalCapabilities; - osProfile?: OSProfile; - networkProfile?: NetworkProfile; - securityProfile?: SecurityProfile; - diagnosticsProfile?: DiagnosticsProfile; availabilitySet?: SubResource; - virtualMachineScaleSet?: SubResource; - proximityPlacementGroup?: SubResource; - priority?: VirtualMachinePriorityTypes; - evictionPolicy?: VirtualMachineEvictionPolicyTypes; billingProfile?: BillingProfile; + diagnosticsProfile?: DiagnosticsProfile; + evictionPolicy?: VirtualMachineEvictionPolicyTypes; + extensionsTimeBudget?: string; + hardwareProfile?: HardwareProfile; host?: SubResource; hostGroup?: SubResource; - readonly provisioningState?: string; + identity?: VirtualMachineIdentity; readonly instanceView?: VirtualMachineInstanceView; licenseType?: string; + networkProfile?: NetworkProfile; + osProfile?: OSProfile; + plan?: Plan; + priority?: VirtualMachinePriorityTypes; + readonly provisioningState?: string; + proximityPlacementGroup?: SubResource; + readonly resources?: VirtualMachineExtension[]; + securityProfile?: SecurityProfile; + storageProfile?: StorageProfile; + virtualMachineScaleSet?: SubResource; readonly vmId?: string; - extensionsTimeBudget?: string; -}; + zones?: string[]; +} // @public export interface VirtualMachineAgentInstanceView { @@ -2487,29 +2262,29 @@ export interface VirtualMachineCaptureParameters { } // @public -export type VirtualMachineCaptureResult = SubResource & { - readonly schema?: string; +export interface VirtualMachineCaptureResult extends SubResource { readonly contentVersion?: string; readonly parameters?: Record; readonly resources?: Record[]; -}; + readonly schema?: string; +} // @public export type VirtualMachineEvictionPolicyTypes = string; // @public -export type VirtualMachineExtension = Resource & { - forceUpdateTag?: string; - publisher?: string; - typePropertiesType?: string; - typeHandlerVersion?: string; +export interface VirtualMachineExtension extends Resource { autoUpgradeMinorVersion?: boolean; enableAutomaticUpgrade?: boolean; - settings?: Record; + forceUpdateTag?: string; + instanceView?: VirtualMachineExtensionInstanceView; protectedSettings?: Record; readonly provisioningState?: string; - instanceView?: VirtualMachineExtensionInstanceView; -}; + publisher?: string; + settings?: Record; + typeHandlerVersion?: string; + typePropertiesType?: string; +} // @public export interface VirtualMachineExtensionHandlerInstanceView { @@ -2519,17 +2294,17 @@ export interface VirtualMachineExtensionHandlerInstanceView { } // @public -export type VirtualMachineExtensionImage = Resource & { - operatingSystem?: string; +export interface VirtualMachineExtensionImage extends Resource { computeRole?: string; handlerSchema?: string; - vmScaleSetEnabled?: boolean; + operatingSystem?: string; supportsMultipleExtensions?: boolean; -}; + vmScaleSetEnabled?: boolean; +} // @public export interface VirtualMachineExtensionImages { - get(location: string, publisherName: string, version: string, typeParam: string, options?: VirtualMachineExtensionImagesGetOptionalParams): Promise; + get(location: string, publisherName: string, typeParam: string, version: string, options?: VirtualMachineExtensionImagesGetOptionalParams): Promise; listTypes(location: string, publisherName: string, options?: VirtualMachineExtensionImagesListTypesOptionalParams): Promise; listVersions(location: string, publisherName: string, typeParam: string, options?: VirtualMachineExtensionImagesListVersionsOptionalParams): Promise; } @@ -2627,16 +2402,16 @@ export interface VirtualMachineExtensionsUpdateOptionalParams extends coreClient export type VirtualMachineExtensionsUpdateResponse = VirtualMachineExtension; // @public -export type VirtualMachineExtensionUpdate = UpdateResource & { - forceUpdateTag?: string; - publisher?: string; - type?: string; - typeHandlerVersion?: string; +export interface VirtualMachineExtensionUpdate extends UpdateResource { autoUpgradeMinorVersion?: boolean; enableAutomaticUpgrade?: boolean; - settings?: Record; + forceUpdateTag?: string; protectedSettings?: Record; -}; + publisher?: string; + settings?: Record; + type?: string; + typeHandlerVersion?: string; +} // @public export interface VirtualMachineHealthStatus { @@ -2654,23 +2429,24 @@ export interface VirtualMachineIdentity { } // @public -export type VirtualMachineImage = VirtualMachineImageResource & { - plan?: PurchasePlan; - osDiskImage?: OSDiskImage; - dataDiskImages?: DataDiskImage[]; +export interface VirtualMachineImage extends VirtualMachineImageResource { automaticOSUpgradeProperties?: AutomaticOSUpgradeProperties; - hyperVGeneration?: HyperVGenerationTypes; + // (undocumented) + dataDiskImages?: DataDiskImage[]; disallowed?: DisallowedConfiguration; -}; + hyperVGeneration?: HyperVGenerationTypes; + osDiskImage?: OSDiskImage; + plan?: PurchasePlan; +} // @public -export type VirtualMachineImageResource = SubResource & { - name: string; +export interface VirtualMachineImageResource extends SubResource { location: string; + name: string; tags?: { [propertyName: string]: string; }; -}; +} // @public export interface VirtualMachineImages { @@ -2812,26 +2588,26 @@ export interface VirtualMachinesAssessPatchesOptionalParams extends coreClient.O export type VirtualMachinesAssessPatchesResponse = VirtualMachineAssessPatchesResult; // @public -export type VirtualMachineScaleSet = Resource & { - sku?: Sku; - plan?: Plan; - identity?: VirtualMachineScaleSetIdentity; - zones?: string[]; - upgradePolicy?: UpgradePolicy; - automaticRepairsPolicy?: AutomaticRepairsPolicy; - virtualMachineProfile?: VirtualMachineScaleSetVMProfile; - readonly provisioningState?: string; - overprovision?: boolean; - doNotRunExtensionsOnOverprovisionedVMs?: boolean; - readonly uniqueId?: string; - singlePlacementGroup?: boolean; - zoneBalance?: boolean; - platformFaultDomainCount?: number; - proximityPlacementGroup?: SubResource; - hostGroup?: SubResource; +export interface VirtualMachineScaleSet extends Resource { additionalCapabilities?: AdditionalCapabilities; + automaticRepairsPolicy?: AutomaticRepairsPolicy; + doNotRunExtensionsOnOverprovisionedVMs?: boolean; + hostGroup?: SubResource; + identity?: VirtualMachineScaleSetIdentity; + overprovision?: boolean; + plan?: Plan; + platformFaultDomainCount?: number; + readonly provisioningState?: string; + proximityPlacementGroup?: SubResource; scaleInPolicy?: ScaleInPolicy; -}; + singlePlacementGroup?: boolean; + sku?: Sku; + readonly uniqueId?: string; + upgradePolicy?: UpgradePolicy; + virtualMachineProfile?: VirtualMachineScaleSetVMProfile; + zoneBalance?: boolean; + zones?: string[]; +} // @public export interface VirtualMachineScaleSetDataDisk { @@ -2847,20 +2623,20 @@ export interface VirtualMachineScaleSetDataDisk { } // @public -export type VirtualMachineScaleSetExtension = SubResourceReadOnly & { - name?: string; - readonly type?: string; - forceUpdateTag?: string; - publisher?: string; - typePropertiesType?: string; - typeHandlerVersion?: string; +export interface VirtualMachineScaleSetExtension extends SubResourceReadOnly { autoUpgradeMinorVersion?: boolean; enableAutomaticUpgrade?: boolean; - settings?: Record; + forceUpdateTag?: string; + name?: string; protectedSettings?: Record; - readonly provisioningState?: string; provisionAfterExtensions?: string[]; -}; + readonly provisioningState?: string; + publisher?: string; + settings?: Record; + readonly type?: string; + typeHandlerVersion?: string; + typePropertiesType?: string; +} // @public export interface VirtualMachineScaleSetExtensionListResult { @@ -2933,20 +2709,20 @@ export interface VirtualMachineScaleSetExtensionsUpdateOptionalParams extends co export type VirtualMachineScaleSetExtensionsUpdateResponse = VirtualMachineScaleSetExtension; // @public -export type VirtualMachineScaleSetExtensionUpdate = SubResourceReadOnly & { - readonly name?: string; - readonly type?: string; - forceUpdateTag?: string; - publisher?: string; - typePropertiesType?: string; - typeHandlerVersion?: string; +export interface VirtualMachineScaleSetExtensionUpdate extends SubResourceReadOnly { autoUpgradeMinorVersion?: boolean; enableAutomaticUpgrade?: boolean; - settings?: Record; + forceUpdateTag?: string; + readonly name?: string; protectedSettings?: Record; - readonly provisioningState?: string; provisionAfterExtensions?: string[]; -}; + readonly provisioningState?: string; + publisher?: string; + settings?: Record; + readonly type?: string; + typeHandlerVersion?: string; + typePropertiesType?: string; +} // @public export interface VirtualMachineScaleSetIdentity { @@ -2978,17 +2754,17 @@ export interface VirtualMachineScaleSetInstanceViewStatusesSummary { } // @public -export type VirtualMachineScaleSetIPConfiguration = SubResource & { - name: string; - subnet?: ApiEntityReference; - primary?: boolean; - publicIPAddressConfiguration?: VirtualMachineScaleSetPublicIPAddressConfiguration; - privateIPAddressVersion?: IPVersion; +export interface VirtualMachineScaleSetIPConfiguration extends SubResource { applicationGatewayBackendAddressPools?: SubResource[]; applicationSecurityGroups?: SubResource[]; loadBalancerBackendAddressPools?: SubResource[]; loadBalancerInboundNatPools?: SubResource[]; -}; + name: string; + primary?: boolean; + privateIPAddressVersion?: IPVersion; + publicIPAddressConfiguration?: VirtualMachineScaleSetPublicIPAddressConfiguration; + subnet?: ApiEntityReference; +} // @public export interface VirtualMachineScaleSetIpTag { @@ -3027,16 +2803,16 @@ export interface VirtualMachineScaleSetManagedDiskParameters { } // @public -export type VirtualMachineScaleSetNetworkConfiguration = SubResource & { - name: string; - primary?: boolean; +export interface VirtualMachineScaleSetNetworkConfiguration extends SubResource { + dnsSettings?: VirtualMachineScaleSetNetworkConfigurationDnsSettings; enableAcceleratedNetworking?: boolean; enableFpga?: boolean; - networkSecurityGroup?: SubResource; - dnsSettings?: VirtualMachineScaleSetNetworkConfigurationDnsSettings; - ipConfigurations?: VirtualMachineScaleSetIPConfiguration[]; enableIPForwarding?: boolean; -}; + ipConfigurations?: VirtualMachineScaleSetIPConfiguration[]; + name: string; + networkSecurityGroup?: SubResource; + primary?: boolean; +} // @public export interface VirtualMachineScaleSetNetworkConfigurationDnsSettings { @@ -3090,9 +2866,9 @@ export interface VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings { } // @public -export type VirtualMachineScaleSetReimageParameters = VirtualMachineScaleSetVMReimageParameters & { +export interface VirtualMachineScaleSetReimageParameters extends VirtualMachineScaleSetVMReimageParameters { instanceIds?: string[]; -}; +} // @public export interface VirtualMachineScaleSetRollingUpgrades { @@ -3379,45 +3155,45 @@ export interface VirtualMachineScaleSetsUpdateOptionalParams extends coreClient. export type VirtualMachineScaleSetsUpdateResponse = VirtualMachineScaleSet; // @public -export type VirtualMachineScaleSetUpdate = UpdateResource & { - sku?: Sku; - plan?: Plan; - identity?: VirtualMachineScaleSetIdentity; - upgradePolicy?: UpgradePolicy; - automaticRepairsPolicy?: AutomaticRepairsPolicy; - virtualMachineProfile?: VirtualMachineScaleSetUpdateVMProfile; - overprovision?: boolean; - doNotRunExtensionsOnOverprovisionedVMs?: boolean; - singlePlacementGroup?: boolean; +export interface VirtualMachineScaleSetUpdate extends UpdateResource { additionalCapabilities?: AdditionalCapabilities; - scaleInPolicy?: ScaleInPolicy; + automaticRepairsPolicy?: AutomaticRepairsPolicy; + doNotRunExtensionsOnOverprovisionedVMs?: boolean; + identity?: VirtualMachineScaleSetIdentity; + overprovision?: boolean; + plan?: Plan; proximityPlacementGroup?: SubResource; -}; + scaleInPolicy?: ScaleInPolicy; + singlePlacementGroup?: boolean; + sku?: Sku; + upgradePolicy?: UpgradePolicy; + virtualMachineProfile?: VirtualMachineScaleSetUpdateVMProfile; +} // @public -export type VirtualMachineScaleSetUpdateIPConfiguration = SubResource & { - name?: string; - subnet?: ApiEntityReference; - primary?: boolean; - publicIPAddressConfiguration?: VirtualMachineScaleSetUpdatePublicIPAddressConfiguration; - privateIPAddressVersion?: IPVersion; +export interface VirtualMachineScaleSetUpdateIPConfiguration extends SubResource { applicationGatewayBackendAddressPools?: SubResource[]; applicationSecurityGroups?: SubResource[]; loadBalancerBackendAddressPools?: SubResource[]; loadBalancerInboundNatPools?: SubResource[]; -}; - -// @public -export type VirtualMachineScaleSetUpdateNetworkConfiguration = SubResource & { name?: string; primary?: boolean; + privateIPAddressVersion?: IPVersion; + publicIPAddressConfiguration?: VirtualMachineScaleSetUpdatePublicIPAddressConfiguration; + subnet?: ApiEntityReference; +} + +// @public +export interface VirtualMachineScaleSetUpdateNetworkConfiguration extends SubResource { + dnsSettings?: VirtualMachineScaleSetNetworkConfigurationDnsSettings; enableAcceleratedNetworking?: boolean; enableFpga?: boolean; - networkSecurityGroup?: SubResource; - dnsSettings?: VirtualMachineScaleSetNetworkConfigurationDnsSettings; - ipConfigurations?: VirtualMachineScaleSetUpdateIPConfiguration[]; enableIPForwarding?: boolean; -}; + ipConfigurations?: VirtualMachineScaleSetUpdateIPConfiguration[]; + name?: string; + networkSecurityGroup?: SubResource; + primary?: boolean; +} // @public export interface VirtualMachineScaleSetUpdateNetworkProfile { @@ -3471,45 +3247,45 @@ export interface VirtualMachineScaleSetUpdateVMProfile { } // @public -export type VirtualMachineScaleSetVM = Resource & { - readonly instanceId?: string; - readonly sku?: Sku; - plan?: Plan; - readonly resources?: VirtualMachineExtension[]; - readonly zones?: string[]; - readonly latestModelApplied?: boolean; - readonly vmId?: string; - readonly instanceView?: VirtualMachineScaleSetVMInstanceView; - hardwareProfile?: HardwareProfile; - storageProfile?: StorageProfile; +export interface VirtualMachineScaleSetVM extends Resource { additionalCapabilities?: AdditionalCapabilities; - osProfile?: OSProfile; - securityProfile?: SecurityProfile; - networkProfile?: NetworkProfile; - networkProfileConfiguration?: VirtualMachineScaleSetVMNetworkProfileConfiguration; - diagnosticsProfile?: DiagnosticsProfile; availabilitySet?: SubResource; - readonly provisioningState?: string; + diagnosticsProfile?: DiagnosticsProfile; + hardwareProfile?: HardwareProfile; + readonly instanceId?: string; + readonly instanceView?: VirtualMachineScaleSetVMInstanceView; + readonly latestModelApplied?: boolean; licenseType?: string; readonly modelDefinitionApplied?: string; + networkProfile?: NetworkProfile; + networkProfileConfiguration?: VirtualMachineScaleSetVMNetworkProfileConfiguration; + osProfile?: OSProfile; + plan?: Plan; protectionPolicy?: VirtualMachineScaleSetVMProtectionPolicy; -}; + readonly provisioningState?: string; + readonly resources?: VirtualMachineExtension[]; + securityProfile?: SecurityProfile; + readonly sku?: Sku; + storageProfile?: StorageProfile; + readonly vmId?: string; + readonly zones?: string[]; +} // @public -export type VirtualMachineScaleSetVMExtension = SubResourceReadOnly & { - readonly name?: string; - readonly type?: string; - forceUpdateTag?: string; - publisher?: string; - typePropertiesType?: string; - typeHandlerVersion?: string; +export interface VirtualMachineScaleSetVMExtension extends SubResourceReadOnly { autoUpgradeMinorVersion?: boolean; enableAutomaticUpgrade?: boolean; - settings?: Record; + forceUpdateTag?: string; + instanceView?: VirtualMachineExtensionInstanceView; + readonly name?: string; protectedSettings?: Record; readonly provisioningState?: string; - instanceView?: VirtualMachineExtensionInstanceView; -}; + publisher?: string; + settings?: Record; + readonly type?: string; + typeHandlerVersion?: string; + typePropertiesType?: string; +} // @public export interface VirtualMachineScaleSetVMExtensions { @@ -3575,18 +3351,18 @@ export interface VirtualMachineScaleSetVMExtensionsUpdateOptionalParams extends export type VirtualMachineScaleSetVMExtensionsUpdateResponse = VirtualMachineScaleSetVMExtension; // @public -export type VirtualMachineScaleSetVMExtensionUpdate = SubResourceReadOnly & { - readonly name?: string; - readonly type?: string; - forceUpdateTag?: string; - publisher?: string; - typePropertiesType?: string; - typeHandlerVersion?: string; +export interface VirtualMachineScaleSetVMExtensionUpdate extends SubResourceReadOnly { autoUpgradeMinorVersion?: boolean; enableAutomaticUpgrade?: boolean; - settings?: Record; + forceUpdateTag?: string; + readonly name?: string; protectedSettings?: Record; -}; + publisher?: string; + settings?: Record; + readonly type?: string; + typeHandlerVersion?: string; + typePropertiesType?: string; +} // @public export interface VirtualMachineScaleSetVMInstanceIDs { @@ -3647,7 +3423,8 @@ export interface VirtualMachineScaleSetVMProtectionPolicy { } // @public -export type VirtualMachineScaleSetVMReimageParameters = VirtualMachineReimageParameters & {}; +export interface VirtualMachineScaleSetVMReimageParameters extends VirtualMachineReimageParameters { +} // @public export interface VirtualMachineScaleSetVMs { @@ -3706,9 +3483,6 @@ export type VirtualMachineScaleSetVMsGetResponse = VirtualMachineScaleSetVM; // @public export interface VirtualMachineScaleSetVMsListNextOptionalParams extends coreClient.OperationOptions { - expand?: string; - filter?: string; - select?: string; } // @public @@ -3876,7 +3650,6 @@ export type VirtualMachineSizeTypes = string; // @public export interface VirtualMachinesListAllNextOptionalParams extends coreClient.OperationOptions { - statusOnly?: string; } // @public @@ -4011,31 +3784,31 @@ export interface VirtualMachinesUpdateOptionalParams extends coreClient.Operatio export type VirtualMachinesUpdateResponse = VirtualMachine; // @public -export type VirtualMachineUpdate = UpdateResource & { - plan?: Plan; - identity?: VirtualMachineIdentity; - zones?: string[]; - hardwareProfile?: HardwareProfile; - storageProfile?: StorageProfile; +export interface VirtualMachineUpdate extends UpdateResource { additionalCapabilities?: AdditionalCapabilities; - osProfile?: OSProfile; - networkProfile?: NetworkProfile; - securityProfile?: SecurityProfile; - diagnosticsProfile?: DiagnosticsProfile; availabilitySet?: SubResource; - virtualMachineScaleSet?: SubResource; - proximityPlacementGroup?: SubResource; - priority?: VirtualMachinePriorityTypes; - evictionPolicy?: VirtualMachineEvictionPolicyTypes; billingProfile?: BillingProfile; + diagnosticsProfile?: DiagnosticsProfile; + evictionPolicy?: VirtualMachineEvictionPolicyTypes; + extensionsTimeBudget?: string; + hardwareProfile?: HardwareProfile; host?: SubResource; hostGroup?: SubResource; - readonly provisioningState?: string; + identity?: VirtualMachineIdentity; readonly instanceView?: VirtualMachineInstanceView; licenseType?: string; + networkProfile?: NetworkProfile; + osProfile?: OSProfile; + plan?: Plan; + priority?: VirtualMachinePriorityTypes; + readonly provisioningState?: string; + proximityPlacementGroup?: SubResource; + securityProfile?: SecurityProfile; + storageProfile?: StorageProfile; + virtualMachineScaleSet?: SubResource; readonly vmId?: string; - extensionsTimeBudget?: string; -}; + zones?: string[]; +} // @public export type VmDiskTypes = string; diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/sample.env b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/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/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/availabilitySetsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/availabilitySetsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..87936fafc92 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/availabilitySetsCreateOrUpdateSample.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 { + AvailabilitySet, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update an availability set. + * + * @summary Create or update an availability set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnAvailabilitySet.json + */ +async function createAnAvailabilitySet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const availabilitySetName = "myAvailabilitySet"; + const parameters: AvailabilitySet = { + location: "westus", + platformFaultDomainCount: 2, + platformUpdateDomainCount: 20 + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.availabilitySets.createOrUpdate( + resourceGroupName, + availabilitySetName, + parameters + ); + console.log(result); +} + +async function main() { + createAnAvailabilitySet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/availabilitySetsListBySubscriptionSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/availabilitySetsListBySubscriptionSample.ts new file mode 100644 index 00000000000..e7e960f8829 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/availabilitySetsListBySubscriptionSample.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 { + AvailabilitySetsListBySubscriptionOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all availability sets in a subscription. + * + * @summary Lists all availability sets in a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailabilitySetsInASubscription.json + */ +async function listAvailabilitySetsInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const expand = "virtualMachines\\$ref"; + const options: AvailabilitySetsListBySubscriptionOptionalParams = { expand }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilitySets.listBySubscription(options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAvailabilitySetsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostGroupsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostGroupsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..1e3d575fe82 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostGroupsCreateOrUpdateSample.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 { + DedicatedHostGroup, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) + * + * @summary Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHostGroup.json + */ +async function createOrUpdateADedicatedHostGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const parameters: DedicatedHostGroup = { + location: "westus", + platformFaultDomainCount: 3, + supportAutomaticPlacement: true, + tags: { department: "finance" }, + zones: ["1"] + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHostGroups.createOrUpdate( + resourceGroupName, + hostGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateADedicatedHostGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostGroupsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostGroupsGetSample.ts new file mode 100644 index 00000000000..d04f04c6fc8 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostGroupsGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about a dedicated host group. + * + * @summary Retrieves information about a dedicated host group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHostGroup.json + */ +async function createADedicatedHostGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHostGroups.get( + resourceGroupName, + hostGroupName + ); + console.log(result); +} + +async function main() { + createADedicatedHostGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..e98cad759ef --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostsCreateOrUpdateSample.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 { + DedicatedHost, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a dedicated host . + * + * @summary Create or update a dedicated host . + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHost.json + */ +async function createOrUpdateADedicatedHost() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const hostName = "myDedicatedHost"; + const parameters: DedicatedHost = { + location: "westus", + platformFaultDomain: 1, + sku: { name: "DSv3-Type1" }, + tags: { department: "HR" } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHosts.beginCreateOrUpdateAndWait( + resourceGroupName, + hostGroupName, + hostName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateADedicatedHost(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostsGetSample.ts new file mode 100644 index 00000000000..33dfc6425c7 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/dedicatedHostsGetSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about a dedicated host. + * + * @summary Retrieves information about a dedicated host. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHost.json + */ +async function getADedicatedHost() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const hostName = "myHost"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHosts.get( + resourceGroupName, + hostGroupName, + hostName + ); + console.log(result); +} + +async function main() { + getADedicatedHost(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..0ec450bef79 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsCreateOrUpdateSample.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 { + DiskEncryptionSet, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a disk encryption set + * + * @summary Creates or updates a disk encryption set + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateADiskEncryptionSet.json + */ +async function createADiskEncryptionSet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const diskEncryptionSet: DiskEncryptionSet = { + activeKey: { + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/{key}", + sourceVault: { + id: + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault" + } + }, + identity: { type: "SystemAssigned" }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginCreateOrUpdateAndWait( + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet + ); + console.log(result); +} + +async function main() { + createADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsDeleteSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsDeleteSample.ts new file mode 100644 index 00000000000..da5797f93cc --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a disk encryption set. + * + * @summary Deletes a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/DeleteADiskEncryptionSet.json + */ +async function deleteADiskEncryptionSet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginDeleteAndWait( + resourceGroupName, + diskEncryptionSetName + ); + console.log(result); +} + +async function main() { + deleteADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsGetSample.ts new file mode 100644 index 00000000000..4451909612e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets information about a disk encryption set. + * + * @summary Gets information about a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutADiskEncryptionSet.json + */ +async function getInformationAboutADiskEncryptionSet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.get( + resourceGroupName, + diskEncryptionSetName + ); + console.log(result); +} + +async function main() { + getInformationAboutADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsListByResourceGroupSample.ts new file mode 100644 index 00000000000..9597b7a41c3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsListByResourceGroupSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the disk encryption sets under a resource group. + * + * @summary Lists all the disk encryption sets under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInAResourceGroup.json + */ +async function listAllDiskEncryptionSetsInAResourceGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.diskEncryptionSets.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllDiskEncryptionSetsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsListSample.ts new file mode 100644 index 00000000000..4367b1f1be1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the disk encryption sets under a subscription. + * + * @summary Lists all the disk encryption sets under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInASubscription.json + */ +async function listAllDiskEncryptionSetsInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.diskEncryptionSets.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllDiskEncryptionSetsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsUpdateSample.ts new file mode 100644 index 00000000000..adc75526920 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/diskEncryptionSetsUpdateSample.ts @@ -0,0 +1,56 @@ +/* + * 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 { + DiskEncryptionSetUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates (patches) a disk encryption set. + * + * @summary Updates (patches) a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/UpdateADiskEncryptionSet.json + */ +async function updateADiskEncryptionSet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const diskEncryptionSet: DiskEncryptionSetUpdate = { + activeKey: { + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/{key}", + sourceVault: { + id: + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault" + } + }, + tags: { department: "Development", project: "Encryption" } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginUpdateAndWait( + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet + ); + console.log(result); +} + +async function main() { + updateADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksCreateOrUpdateSample.ts new file mode 100644 index 00000000000..6db8b6dc02f --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksCreateOrUpdateSample.ts @@ -0,0 +1,238 @@ +/* + * 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 { + Disk, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByCopyingASnapshot.json + */ +async function createAManagedDiskByCopyingASnapshot() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { + createOption: "Import", + sourceUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { + createOption: "Import", + sourceUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskFromAPlatformImage.json + */ +async function createAManagedDiskFromAPlatformImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { + createOption: "FromImage", + imageReference: { + id: + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}" + } + }, + location: "West US", + osType: "Windows" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskFromAnExistingManagedDisk.json + */ +async function createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk2"; + const disk: Disk = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedUploadDisk.json + */ +async function createAManagedUploadDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { createOption: "Upload", uploadSizeBytes: 10737418752 }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAnEmptyManagedDisk.json + */ +async function createAnEmptyManagedDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +async function main() { + createAManagedDiskByCopyingASnapshot(); + createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription(); + createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription(); + createAManagedDiskFromAPlatformImage(); + createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription(); + createAManagedUploadDisk(); + createAnEmptyManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksGetSample.ts new file mode 100644 index 00000000000..b0694524c3f --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets information about a disk. + * + * @summary Gets information about a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutAManagedDisk.json + */ +async function getInformationAboutAManagedDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myManagedDisk"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.get(resourceGroupName, diskName); + console.log(result); +} + +async function main() { + getInformationAboutAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksListByResourceGroupSample.ts new file mode 100644 index 00000000000..71806333e05 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksListByResourceGroupSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the disks under a resource group. + * + * @summary Lists all the disks under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInAResourceGroup.json + */ +async function listAllManagedDisksInAResourceGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllManagedDisksInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksListSample.ts new file mode 100644 index 00000000000..deae840aa3e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/disksListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the disks under a subscription. + * + * @summary Lists all the disks under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInASubscription.json + */ +async function listAllManagedDisksInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllManagedDisksInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesCreateOrUpdateSample.ts new file mode 100644 index 00000000000..8994929e57e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesCreateOrUpdateSample.ts @@ -0,0 +1,414 @@ +/* + * 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 { + Image, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromABlobWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + blobUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + osState: "Generalized", + osType: "Linux" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromABlob.json + */ +async function createAVirtualMachineImageFromABlob() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + blobUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + osState: "Generalized", + osType: "Linux" + }, + zoneResilient: true + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAManagedDiskWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + managedDisk: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + osState: "Generalized", + osType: "Linux" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAManagedDisk.json + */ +async function createAVirtualMachineImageFromAManagedDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + managedDisk: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + osState: "Generalized", + osType: "Linux" + }, + zoneResilient: true + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromASnapshotWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + osState: "Generalized", + osType: "Linux", + snapshot: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromASnapshot.json + */ +async function createAVirtualMachineImageFromASnapshot() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + osState: "Generalized", + osType: "Linux", + snapshot: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + }, + zoneResilient: false + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAVM.json + */ +async function createAVirtualMachineImageFromAnExistingVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + sourceVirtualMachine: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromABlob.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromABlob() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + dataDisks: [ + { + blobUri: + "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd", + lun: 1 + } + ], + osDisk: { + blobUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + osState: "Generalized", + osType: "Linux" + }, + zoneResilient: false + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromAManagedDisk.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + dataDisks: [ + { + lun: 1, + managedDisk: { + id: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2" + } + } + ], + osDisk: { + managedDisk: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + osState: "Generalized", + osType: "Linux" + }, + zoneResilient: false + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromASnapshot.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromASnapshot() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + dataDisks: [ + { + lun: 1, + snapshot: { + id: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2" + } + } + ], + osDisk: { + osState: "Generalized", + osType: "Linux", + snapshot: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + }, + zoneResilient: true + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +async function main() { + createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromABlob(); + createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromAManagedDisk(); + createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromASnapshot(); + createAVirtualMachineImageFromAnExistingVirtualMachine(); + createAVirtualMachineImageThatIncludesADataDiskFromABlob(); + createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk(); + createAVirtualMachineImageThatIncludesADataDiskFromASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesGetSample.ts new file mode 100644 index 00000000000..10ab2d7eb1c --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets an image. + * + * @summary Gets an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetInformationAboutAnImage.json + */ +async function getInformationAboutAVirtualMachineImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.get(resourceGroupName, imageName); + console.log(result); +} + +async function main() { + getInformationAboutAVirtualMachineImage(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesListByResourceGroupSample.ts new file mode 100644 index 00000000000..d509b848ca9 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesListByResourceGroupSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of images under a resource group. + * + * @summary Gets the list of images under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInAResourceGroup.json + */ +async function listAllVirtualMachineImagesInAResourceGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.images.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllVirtualMachineImagesInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesListSample.ts new file mode 100644 index 00000000000..5eba0184d25 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. + * + * @summary Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInASubscription.json + */ +async function listAllVirtualMachineImagesInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.images.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllVirtualMachineImagesInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesUpdateSample.ts new file mode 100644 index 00000000000..199ae6092fc --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/imagesUpdateSample.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 { + ImageUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update an image. + * + * @summary Update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateImage.json + */ +async function updatesTagsOfAnImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: ImageUpdate = { + hyperVGeneration: "V1", + sourceVirtualMachine: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + }, + tags: { department: "HR" } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +async function main() { + updatesTagsOfAnImage(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/logAnalyticsExportRequestRateByIntervalSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/logAnalyticsExportRequestRateByIntervalSample.ts new file mode 100644 index 00000000000..109e4a3fa87 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/logAnalyticsExportRequestRateByIntervalSample.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 { + RequestRateByIntervalInput, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Export logs that show Api requests made by this subscription in the given time window to show throttling activities. + * + * @summary Export logs that show Api requests made by this subscription in the given time window to show throttling activities. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsRequestRateByInterval.json + */ +async function exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const location = "westus"; + const parameters: RequestRateByIntervalInput = { + blobContainerSasUri: "https://somesasuri", + fromTime: new Date("2018-01-21T01:54:06.862601Z"), + groupByResourceName: true, + intervalLength: "FiveMins", + toTime: new Date("2018-01-23T01:54:06.862601Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.logAnalytics.beginExportRequestRateByIntervalAndWait( + location, + parameters + ); + console.log(result); +} + +async function main() { + exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/logAnalyticsExportThrottledRequestsSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/logAnalyticsExportThrottledRequestsSample.ts new file mode 100644 index 00000000000..1e2c80097b6 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/logAnalyticsExportThrottledRequestsSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + ThrottledRequestsInput, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @summary Export logs that show total throttled Api requests for this subscription in the given time window. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsThrottledRequests.json + */ +async function exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const location = "westus"; + const parameters: ThrottledRequestsInput = { + blobContainerSasUri: "https://somesasuri", + fromTime: new Date("2018-01-21T01:54:06.862601Z"), + groupByClientApplicationId: false, + groupByOperationName: true, + groupByResourceName: false, + groupByUserAgent: false, + toTime: new Date("2018-01-23T01:54:06.862601Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.logAnalytics.beginExportThrottledRequestsAndWait( + location, + parameters + ); + console.log(result); +} + +async function main() { + exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..a5180fc5e1f --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsCreateOrUpdateSample.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 { + ProximityPlacementGroup, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a proximity placement group. + * + * @summary Create or update a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateAProximityPlacementGroup.json + */ +async function createOrUpdateAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const parameters: ProximityPlacementGroup = { + location: "westus", + proximityPlacementGroupType: "Standard" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.createOrUpdate( + resourceGroupName, + proximityPlacementGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsDeleteSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsDeleteSample.ts new file mode 100644 index 00000000000..aaa17ee4d39 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a proximity placement group. + * + * @summary Delete a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.delete( + resourceGroupName, + proximityPlacementGroupName + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsGetSample.ts new file mode 100644 index 00000000000..3c89b9476ed --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about a proximity placement group . + * + * @summary Retrieves information about a proximity placement group . + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.get( + resourceGroupName, + proximityPlacementGroupName + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsListByResourceGroupSample.ts new file mode 100644 index 00000000000..77404da6458 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsListByResourceGroupSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all proximity placement groups in a resource group. + * + * @summary Lists all proximity placement groups in a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInAResourceGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.proximityPlacementGroups.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsListBySubscriptionSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsListBySubscriptionSample.ts new file mode 100644 index 00000000000..397b006c130 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all proximity placement groups in a subscription. + * + * @summary Lists all proximity placement groups in a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInASubscription.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.proximityPlacementGroups.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsUpdateSample.ts new file mode 100644 index 00000000000..3f607670f71 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/proximityPlacementGroupsUpdateSample.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 { + ProximityPlacementGroupUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update a proximity placement group. + * + * @summary Update a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/PatchAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const parameters: ProximityPlacementGroupUpdate = { + tags: { additionalProp1: "string" } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.update( + resourceGroupName, + proximityPlacementGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..9d2fd799005 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsCreateOrUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + Snapshot, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot1"; + const snapshot: Snapshot = { + creationData: { + createOption: "Import", + sourceUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + storageAccountId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot1"; + const snapshot: Snapshot = { + creationData: { + createOption: "Import", + sourceUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotFromAnExistingSnapshot.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot2"; + const snapshot: Snapshot = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +async function main() { + createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription(); + createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription(); + createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsGetSample.ts new file mode 100644 index 00000000000..9c2cae80c04 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets information about a snapshot. + * + * @summary Gets information about a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutASnapshot.json + */ +async function getInformationAboutASnapshot() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.get(resourceGroupName, snapshotName); + console.log(result); +} + +async function main() { + getInformationAboutASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsListByResourceGroupSample.ts new file mode 100644 index 00000000000..188aedcac06 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsListByResourceGroupSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists snapshots under a resource group. + * + * @summary Lists snapshots under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInAResourceGroup.json + */ +async function listAllSnapshotsInAResourceGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllSnapshotsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsListSample.ts new file mode 100644 index 00000000000..d4b2715f461 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/snapshotsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists snapshots under a subscription. + * + * @summary Lists snapshots under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInASubscription.json + */ +async function listAllSnapshotsInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllSnapshotsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysCreateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysCreateSample.ts new file mode 100644 index 00000000000..b8c9235e8a3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysCreateSample.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 { + SshPublicKeyResource, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates a new SSH public key resource. + * + * @summary Creates a new SSH public key resource. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnSshPublicKey.json + */ +async function createANewSshPublicKeyResource() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const parameters: SshPublicKeyResource = { + location: "westus", + publicKey: "{ssh-rsa public key}" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.create( + resourceGroupName, + sshPublicKeyName, + parameters + ); + console.log(result); +} + +async function main() { + createANewSshPublicKeyResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysGenerateKeyPairSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysGenerateKeyPairSample.ts new file mode 100644 index 00000000000..657c86c57a1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysGenerateKeyPairSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @summary Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GenerateSshKeyPair.json + */ +async function generateAnSshKeyPair() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.generateKeyPair( + resourceGroupName, + sshPublicKeyName + ); + console.log(result); +} + +async function main() { + generateAnSshKeyPair(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysGetSample.ts new file mode 100644 index 00000000000..99bd89289b1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/sshPublicKeysGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about an SSH public key. + * + * @summary Retrieves information about an SSH public key. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAnSshPublicKey.json + */ +async function getAnSshPublicKey() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.get( + resourceGroupName, + sshPublicKeyName + ); + console.log(result); +} + +async function main() { + getAnSshPublicKey(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts new file mode 100644 index 00000000000..f2d33a6b965 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension version. Instances which are already running the latest extension versions are not affected. + * + * @summary Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension version. Instances which are already running the latest extension versions are not affected. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VMScaleSetExtensionRollingUpgrade.json + */ +async function startAnExtensionRollingUpgrade() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetRollingUpgrades.beginStartExtensionUpgradeAndWait( + resourceGroupName, + vmScaleSetName + ); + console.log(result); +} + +async function main() { + startAnExtensionRollingUpgrade(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..742f186b9ba --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.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 { + VirtualMachineScaleSetVMExtension, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to create or update the VMSS VM extension. + * + * @summary The operation to create or update the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateVirtualMachineScaleSetVMExtensions.json + */ +async function createVirtualMachineScaleSetVMExtension() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const extensionParameters: VirtualMachineScaleSetVMExtension = { + typePropertiesType: "extType", + autoUpgradeMinorVersion: true, + publisher: "extPublisher", + settings: { UserName: "xyz@microsoft.com" }, + typeHandlerVersion: "1.2" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + extensionParameters + ); + console.log(result); +} + +async function main() { + createVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsDeleteSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsDeleteSample.ts new file mode 100644 index 00000000000..bf9b4b790d4 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsDeleteSample.ts @@ -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. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to delete the VMSS VM extension. + * + * @summary The operation to delete the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteVirtualMachineScaleSetVMExtensions.json + */ +async function deleteVirtualMachineScaleSetVMExtension() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginDeleteAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName + ); + console.log(result); +} + +async function main() { + deleteVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsGetSample.ts new file mode 100644 index 00000000000..07117ea54b3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsGetSample.ts @@ -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. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to get the VMSS VM extension. + * + * @summary The operation to get the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMExtensions.json + */ +async function getVirtualMachineScaleSetVMExtension() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.get( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName + ); + console.log(result); +} + +async function main() { + getVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsListSample.ts new file mode 100644 index 00000000000..30fae302e49 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsListSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @summary The operation to get all extensions of an instance in Virtual Machine Scaleset. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachineScaleSetVMExtensions.json + */ +async function listExtensionsInVmssInstance() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.list( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + listExtensionsInVmssInstance(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsUpdateSample.ts new file mode 100644 index 00000000000..95406e833bd --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMExtensionsUpdateSample.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 { + VirtualMachineScaleSetVMExtensionUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to update the VMSS VM extension. + * + * @summary The operation to update the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVirtualMachineScaleSetVMExtensions.json + */ +async function updateVirtualMachineScaleSetVMExtension() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const extensionParameters: VirtualMachineScaleSetVMExtensionUpdate = { + typePropertiesType: "extType", + autoUpgradeMinorVersion: true, + publisher: "extPublisher", + settings: { UserName: "xyz@microsoft.com" }, + typeHandlerVersion: "1.2" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginUpdateAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + extensionParameters + ); + console.log(result); +} + +async function main() { + updateVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSGetInstanceViewSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSGetInstanceViewSample.ts new file mode 100644 index 00000000000..48106c8bdbb --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSGetInstanceViewSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the status of a virtual machine from a VM scale set. + * + * @summary Gets the status of a virtual machine from a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ +async function getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myVirtualMachineScaleSet"; + const instanceId = "0"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.getInstanceView( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts new file mode 100644 index 00000000000..f8120e0b85e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @summary The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVMScaleSetVM.json + */ +async function retrieveBootDiagnosticsDataOfAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const sasUriExpirationTimeInMinutes = 60; + const options: VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataOptionalParams = { + sasUriExpirationTimeInMinutes + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.retrieveBootDiagnosticsData( + resourceGroupName, + vmScaleSetName, + instanceId, + options + ); + console.log(result); +} + +async function main() { + retrieveBootDiagnosticsDataOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSSimulateEvictionSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSSimulateEvictionSample.ts new file mode 100644 index 00000000000..d3accc55510 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetVMSSimulateEvictionSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @summary The operation to simulate the eviction of spot virtual machine in a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVmssVM.json + */ +async function simulateEvictionAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmScaleSetName = "VmScaleSetName"; + const instanceId = "InstanceId"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.simulateEviction( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + simulateEvictionAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..16eea63d7bd --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetsCreateOrUpdateSample.ts @@ -0,0 +1,1567 @@ +/* + * 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 { + VirtualMachineScaleSet, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage.json + */ +async function createACustomImageScaleSetFromAnUnmanagedGeneralizedOSImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + osDisk: { + name: "osDisk", + caching: "ReadWrite", + createOption: "FromImage", + image: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd" + } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAPlatformImageScaleSetWithUnmanagedOsDisks.json + */ +async function createAPlatformImageScaleSetWithUnmanagedOSDisks() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "osDisk", + caching: "ReadWrite", + createOption: "FromImage", + vhdContainers: [ + "http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer" + ] + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetFromACustomImage.json + */ +async function createAScaleSetFromACustomImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScalesetWithDiskEncryptionSetResource.json + */ +async function createAScaleSetWithDiskEncryptionSetResourceInOSDiskAndDataDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + dataDisks: [ + { + caching: "ReadWrite", + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + storageAccountType: "Standard_LRS" + } + } + ], + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + storageAccountType: "Standard_LRS" + } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetFromWithFpgaNetworkInterface.json + */ +async function createAScaleSetWithFpgaNetworkInterfaces() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + }, + { + name: "{fpgaNic-Name}", + enableAcceleratedNetworking: false, + enableFpga: true, + enableIPForwarding: false, + ipConfigurations: [ + { + name: "{fpgaNic-Name}", + primary: true, + privateIPAddressVersion: "IPv4", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}" + } + } + ], + primary: false + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithEncryptionAtHost.json + */ +async function createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + securityProfile: { encryptionAtHost: true }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAMarketplaceImagePlan.json + */ +async function createAScaleSetWithAMarketplaceImagePlan() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAnAzureApplicationGateway.json + */ +async function createAScaleSetWithAnAzureApplicationGateway() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + applicationGatewayBackendAddressPools: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}" + } + ], + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAnAzureLoadBalancer.json + */ +async function createAScaleSetWithAnAzureLoadBalancer() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + loadBalancerBackendAddressPools: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}" + } + ], + loadBalancerInboundNatPools: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}" + } + ], + publicIPAddressConfiguration: { + name: "{vmss-name}", + publicIPAddressVersion: "IPv4" + }, + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAutomaticRepairs.json + */ +async function createAScaleSetWithAutomaticRepairsEnabled() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + automaticRepairsPolicy: { enabled: true, gracePeriod: "PT30M" }, + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithBootDiagnostics.json + */ +async function createAScaleSetWithBootDiagnostics() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: + "http://{existing-storage-account-name}.blob.core.windows.net" + } + }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithEmptyDataDisksOnEachVm.json + */ +async function createAScaleSetWithEmptyDataDisksOnEachVM() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D2_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + diskSizeGB: 512, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithDiffOsDiskUsingDiffDiskPlacement.json + */ +async function createAScaleSetWithEphemeralOSDisksUsingPlacementProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "ResourceDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithDiffOsDisk.json + */ +async function createAScaleSetWithEphemeralOSDisks() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithExtensionsTimeBudget.json + */ +async function createAScaleSetWithExtensionTimeBudget() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: + "http://{existing-storage-account-name}.blob.core.windows.net" + } + }, + extensionProfile: { + extensionsTimeBudget: "PT1H20M", + extensions: [ + { + name: "{extension-name}", + typePropertiesType: "{extension-Type}", + autoUpgradeMinorVersion: false, + publisher: "{extension-Publisher}", + settings: {}, + typeHandlerVersion: "{handler-version}" + } + ] + }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithManagedBootDiagnostics.json + */ +async function createAScaleSetWithManagedBootDiagnostics() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { bootDiagnostics: { enabled: true } }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithPasswordAuthentication.json + */ +async function createAScaleSetWithPasswordAuthentication() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithPremiumStorage.json + */ +async function createAScaleSetWithPremiumStorage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithSshAuthentication.json + */ +async function createAScaleSetWithSshAuthentication() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + linuxConfiguration: { + disablePasswordAuthentication: true, + ssh: { + publicKeys: [ + { + path: "/home/{your-username}/.ssh/authorized_keys", + keyData: + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1" + } + ] + } + } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithTerminateScheduledEventEnabled.json + */ +async function createAScaleSetWithTerminateScheduledEventsEnabled() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + scheduledEventsProfile: { + terminateNotificationProfile: { enable: true, notBeforeTimeout: "PT5M" } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithVMsInDifferentZones.json + */ +async function createAScaleSetWithVirtualMachinesInDifferentZones() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "centralus", + overprovision: true, + sku: { name: "Standard_A1_v2", capacity: 2, tier: "Standard" }, + upgradePolicy: { mode: "Automatic" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + diskSizeGB: 512, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }, + zones: ["1", "3"] + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +async function main() { + createACustomImageScaleSetFromAnUnmanagedGeneralizedOSImage(); + createAPlatformImageScaleSetWithUnmanagedOSDisks(); + createAScaleSetFromACustomImage(); + createAScaleSetWithDiskEncryptionSetResourceInOSDiskAndDataDisk(); + createAScaleSetWithFpgaNetworkInterfaces(); + createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty(); + createAScaleSetWithAMarketplaceImagePlan(); + createAScaleSetWithAnAzureApplicationGateway(); + createAScaleSetWithAnAzureLoadBalancer(); + createAScaleSetWithAutomaticRepairsEnabled(); + createAScaleSetWithBootDiagnostics(); + createAScaleSetWithEmptyDataDisksOnEachVM(); + createAScaleSetWithEphemeralOSDisksUsingPlacementProperty(); + createAScaleSetWithEphemeralOSDisks(); + createAScaleSetWithExtensionTimeBudget(); + createAScaleSetWithManagedBootDiagnostics(); + createAScaleSetWithPasswordAuthentication(); + createAScaleSetWithPremiumStorage(); + createAScaleSetWithSshAuthentication(); + createAScaleSetWithTerminateScheduledEventsEnabled(); + createAScaleSetWithVirtualMachinesInDifferentZones(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetsGetSample.ts new file mode 100644 index 00000000000..31ffe48f5c8 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachineScaleSetsGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Display information about a virtual machine scale set. + * + * @summary Display information about a virtual machine scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetAutoPlacedOnDedicatedHostGroup.json + */ +async function getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myVirtualMachineScaleSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.get( + resourceGroupName, + vmScaleSetName + ); + console.log(result); +} + +async function main() { + getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesAssessPatchesSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesAssessPatchesSample.ts new file mode 100644 index 00000000000..9e3e9921c0b --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesAssessPatchesSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Assess patches on the VM. + * + * @summary Assess patches on the VM. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VirtualMachineAssessPatches.json + */ +async function assessPatchStateOfAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginAssessPatchesAndWait( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + assessPatchStateOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesCreateOrUpdateSample.ts new file mode 100644 index 00000000000..4d816ddc42c --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesCreateOrUpdateSample.ts @@ -0,0 +1,1259 @@ +/* + * 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 { + VirtualMachine, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageVmFromAnUnmanagedGeneralizedOsImage.json + */ +async function createACustomImageVMFromAnUnmanagedGeneralizedOSImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "{vm-name}"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + image: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd" + }, + osType: "Windows", + vhd: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAPlatformImageVmWithUnmanagedOsAndDataDisks.json + */ +async function createAPlatformImageVMWithUnmanagedOSAndDataDisks() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "{vm-name}"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + dataDisks: [ + { + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + vhd: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd" + } + }, + { + createOption: "Empty", + diskSizeGB: 1023, + lun: 1, + vhd: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd" + } + } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + vhd: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmFromACustomImage.json + */ +async function createAVMFromACustomImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmInAnAvailabilitySet.json + */ +async function createAVMInAnAvailabilitySet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + availabilitySet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}" + }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithDiskEncryptionSetResource.json + */ +async function createAVMWithDiskEncryptionSetResourceIdInTheOSDiskAndDataDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + dataDisks: [ + { + caching: "ReadWrite", + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + storageAccountType: "Standard_LRS" + } + }, + { + caching: "ReadWrite", + createOption: "Attach", + diskSizeGB: 1023, + lun: 1, + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}", + storageAccountType: "Standard_LRS" + } + } + ], + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + storageAccountType: "Standard_LRS" + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithEncryptionAtHost.json + */ +async function createAVMWithHostEncryptionUsingEncryptionAtHostProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + securityProfile: { encryptionAtHost: true }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithAMarketplaceImagePlan.json + */ +async function createAVMWithAMarketplaceImagePlan() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfAutomaticByOS.json + */ +async function createAVMWithAPatchSettingPatchModeOfAutomaticByOS() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "AutomaticByOS" }, + provisionVMAgent: true + } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfAutomaticByPlatform.json + */ +async function createAVMWithAPatchSettingPatchModeOfAutomaticByPlatform() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "AutomaticByPlatform" }, + provisionVMAgent: true + } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfManual.json + */ +async function createAVMWithAPatchSettingPatchModeOfManual() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "Manual" }, + provisionVMAgent: true + } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithExtensionsTimeBudget.json + */ +async function createAVMWithAnExtensionsTimeBudget() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: + "http://{existing-storage-account-name}.blob.core.windows.net" + } + }, + extensionsTimeBudget: "PT30M", + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithBootDiagnostics.json + */ +async function createAVMWithBootDiagnostics() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: + "http://{existing-storage-account-name}.blob.core.windows.net" + } + }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithEmptyDataDisks.json + */ +async function createAVMWithEmptyDataDisks() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json + */ +async function createAVMWithEphemeralOSDiskProvisioningInCacheDiskUsingPlacementProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "CacheDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json + */ +async function createAVMWithEphemeralOSDiskProvisioningInResourceDiskUsingPlacementProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "ResourceDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDisk.json + */ +async function createAVMWithEphemeralOSDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithManagedBootDiagnostics.json + */ +async function createAVMWithManagedBootDiagnostics() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + diagnosticsProfile: { bootDiagnostics: { enabled: true } }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPasswordAuthentication.json + */ +async function createAVMWithPasswordAuthentication() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPremiumStorage.json + */ +async function createAVMWithPremiumStorage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithSshAuthentication.json + */ +async function createAVMWithSshAuthentication() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminUsername: "{your-username}", + computerName: "myVM", + linuxConfiguration: { + disablePasswordAuthentication: true, + ssh: { + publicKeys: [ + { + path: "/home/{your-username}/.ssh/authorized_keys", + keyData: + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1" + } + ] + } + } + }, + storageProfile: { + imageReference: { + offer: "{image_offer}", + publisher: "{image_publisher}", + sku: "{image_sku}", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +async function main() { + createACustomImageVMFromAnUnmanagedGeneralizedOSImage(); + createAPlatformImageVMWithUnmanagedOSAndDataDisks(); + createAVMFromACustomImage(); + createAVMInAnAvailabilitySet(); + createAVMWithDiskEncryptionSetResourceIdInTheOSDiskAndDataDisk(); + createAVMWithHostEncryptionUsingEncryptionAtHostProperty(); + createAVMWithAMarketplaceImagePlan(); + createAVMWithAPatchSettingPatchModeOfAutomaticByOS(); + createAVMWithAPatchSettingPatchModeOfAutomaticByPlatform(); + createAVMWithAPatchSettingPatchModeOfManual(); + createAVMWithAnExtensionsTimeBudget(); + createAVMWithBootDiagnostics(); + createAVMWithEmptyDataDisks(); + createAVMWithEphemeralOSDiskProvisioningInCacheDiskUsingPlacementProperty(); + createAVMWithEphemeralOSDiskProvisioningInResourceDiskUsingPlacementProperty(); + createAVMWithEphemeralOSDisk(); + createAVMWithManagedBootDiagnostics(); + createAVMWithPasswordAuthentication(); + createAVMWithPremiumStorage(); + createAVMWithSshAuthentication(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesDeleteSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesDeleteSample.ts new file mode 100644 index 00000000000..5ae1e4d7617 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesDeleteSample.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + VirtualMachinesDeleteOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to delete a virtual machine. + * + * @summary The operation to delete a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ForceDeleteVirtualMachine.json + */ +async function forceDeleteAVM() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const forceDeletion = true; + const options: VirtualMachinesDeleteOptionalParams = { forceDeletion }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDeleteAndWait( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + forceDeleteAVM(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesGeneralizeSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesGeneralizeSample.ts new file mode 100644 index 00000000000..636fe283977 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesGeneralizeSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).
For Linux, please refer to [How to create an image of a virtual machine or VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image). + * + * @summary Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).
For Linux, please refer to [How to create an image of a virtual machine or VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image). + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GeneralizeVirtualMachine.json + */ +async function generalizeAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.generalize( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + generalizeAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesGetSample.ts new file mode 100644 index 00000000000..ec0b736b0b1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesGetSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about the model view or the instance view of a virtual machine. + * + * @summary Retrieves information about the model view or the instance view of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachine.json + */ +async function getAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.get(resourceGroupName, vmName); + console.log(result); +} + +/** + * This sample demonstrates how to Retrieves information about the model view or the instance view of a virtual machine. + * + * @summary Retrieves information about the model view or the instance view of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineAutoPlacedOnDedicatedHostGroup.json + */ +async function getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.get(resourceGroupName, vmName); + console.log(result); +} + +async function main() { + getAVirtualMachine(); + getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesInstanceViewSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesInstanceViewSample.ts new file mode 100644 index 00000000000..87c396098e1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesInstanceViewSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about the run-time state of a virtual machine. + * + * @summary Retrieves information about the run-time state of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineInstanceView.json + */ +async function getVirtualMachineInstanceView() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.instanceView( + resourceGroupName, + vmName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Retrieves information about the run-time state of a virtual machine. + * + * @summary Retrieves information about the run-time state of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ +async function getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.instanceView( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + getVirtualMachineInstanceView(); + getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesListAvailableSizesSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesListAvailableSizesSample.ts new file mode 100644 index 00000000000..015ac640544 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesListAvailableSizesSample.ts @@ -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. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @summary Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailableVmSizes_VirtualMachines.json + */ +async function listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVmName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.listAvailableSizes( + resourceGroupName, + vmName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesListByLocationSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesListByLocationSample.ts new file mode 100644 index 00000000000..6d282fa35ab --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesListByLocationSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all the virtual machines under the specified subscription for the specified location. + * + * @summary Gets all the virtual machines under the specified subscription for the specified location. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachinesInASubscriptionByLocation.json + */ +async function listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.listByLocation(location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesReapplySample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesReapplySample.ts new file mode 100644 index 00000000000..930cff16ae4 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesReapplySample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to reapply a virtual machine's state. + * + * @summary The operation to reapply a virtual machine's state. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReapplyVirtualMachine.json + */ +async function reapplyTheStateOfAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginReapplyAndWait( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + reapplyTheStateOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesReimageSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesReimageSample.ts new file mode 100644 index 00000000000..46a6b11741d --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesReimageSample.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 { + VirtualMachineReimageParameters, + VirtualMachinesReimageOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @summary Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReimageVirtualMachine.json + */ +async function reimageAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVMName"; + const parameters: VirtualMachineReimageParameters = { tempDisk: true }; + const options: VirtualMachinesReimageOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginReimageAndWait( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + reimageAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesRetrieveBootDiagnosticsDataSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesRetrieveBootDiagnosticsDataSample.ts new file mode 100644 index 00000000000..0716f8f0a5a --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesRetrieveBootDiagnosticsDataSample.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 { + VirtualMachinesRetrieveBootDiagnosticsDataOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @summary The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVirtualMachine.json + */ +async function retrieveBootDiagnosticsDataOfAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const sasUriExpirationTimeInMinutes = 60; + const options: VirtualMachinesRetrieveBootDiagnosticsDataOptionalParams = { + sasUriExpirationTimeInMinutes + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.retrieveBootDiagnosticsData( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + retrieveBootDiagnosticsDataOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesSimulateEvictionSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesSimulateEvictionSample.ts new file mode 100644 index 00000000000..ef88f81b66b --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesSimulateEvictionSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to simulate the eviction of spot virtual machine. + * + * @summary The operation to simulate the eviction of spot virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVM.json + */ +async function simulateEvictionAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.simulateEviction( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + simulateEvictionAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesUpdateSample.ts new file mode 100644 index 00000000000..fa8ec904549 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples-dev/virtualMachinesUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + VirtualMachineUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to update a virtual machine. + * + * @summary The operation to update a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVMDetachDataDiskUsingToBeDetachedProperty.json + */ +async function updateAVMByDetachingDataDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachineUpdate = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0, toBeDetached: true }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1, toBeDetached: false } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +async function main() { + updateAVMByDetachingDataDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/README.md b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/README.md new file mode 100644 index 00000000000..5c02b7281dc --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/README.md @@ -0,0 +1,168 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [availabilitySetsCreateOrUpdateSample.js][availabilitysetscreateorupdatesample] | Create or update an availability set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnAvailabilitySet.json | +| [availabilitySetsListBySubscriptionSample.js][availabilitysetslistbysubscriptionsample] | Lists all availability sets in a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailabilitySetsInASubscription.json | +| [dedicatedHostGroupsCreateOrUpdateSample.js][dedicatedhostgroupscreateorupdatesample] | Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHostGroup.json | +| [dedicatedHostGroupsGetSample.js][dedicatedhostgroupsgetsample] | Retrieves information about a dedicated host group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHostGroup.json | +| [dedicatedHostsCreateOrUpdateSample.js][dedicatedhostscreateorupdatesample] | Create or update a dedicated host . x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHost.json | +| [dedicatedHostsGetSample.js][dedicatedhostsgetsample] | Retrieves information about a dedicated host. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHost.json | +| [diskEncryptionSetsCreateOrUpdateSample.js][diskencryptionsetscreateorupdatesample] | Creates or updates a disk encryption set x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateADiskEncryptionSet.json | +| [diskEncryptionSetsDeleteSample.js][diskencryptionsetsdeletesample] | Deletes a disk encryption set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/DeleteADiskEncryptionSet.json | +| [diskEncryptionSetsGetSample.js][diskencryptionsetsgetsample] | Gets information about a disk encryption set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutADiskEncryptionSet.json | +| [diskEncryptionSetsListByResourceGroupSample.js][diskencryptionsetslistbyresourcegroupsample] | Lists all the disk encryption sets under a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInAResourceGroup.json | +| [diskEncryptionSetsListSample.js][diskencryptionsetslistsample] | Lists all the disk encryption sets under a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInASubscription.json | +| [diskEncryptionSetsUpdateSample.js][diskencryptionsetsupdatesample] | Updates (patches) a disk encryption set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/UpdateADiskEncryptionSet.json | +| [disksCreateOrUpdateSample.js][diskscreateorupdatesample] | Creates or updates a disk. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByCopyingASnapshot.json | +| [disksGetSample.js][disksgetsample] | Gets information about a disk. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutAManagedDisk.json | +| [disksListByResourceGroupSample.js][diskslistbyresourcegroupsample] | Lists all the disks under a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInAResourceGroup.json | +| [disksListSample.js][diskslistsample] | Lists all the disks under a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInASubscription.json | +| [imagesCreateOrUpdateSample.js][imagescreateorupdatesample] | Create or update an image. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromABlobWithDiskEncryptionSet.json | +| [imagesGetSample.js][imagesgetsample] | Gets an image. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetInformationAboutAnImage.json | +| [imagesListByResourceGroupSample.js][imageslistbyresourcegroupsample] | Gets the list of images under a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInAResourceGroup.json | +| [imagesListSample.js][imageslistsample] | Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInASubscription.json | +| [imagesUpdateSample.js][imagesupdatesample] | Update an image. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateImage.json | +| [logAnalyticsExportRequestRateByIntervalSample.js][loganalyticsexportrequestratebyintervalsample] | Export logs that show Api requests made by this subscription in the given time window to show throttling activities. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsRequestRateByInterval.json | +| [logAnalyticsExportThrottledRequestsSample.js][loganalyticsexportthrottledrequestssample] | Export logs that show total throttled Api requests for this subscription in the given time window. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsThrottledRequests.json | +| [proximityPlacementGroupsCreateOrUpdateSample.js][proximityplacementgroupscreateorupdatesample] | Create or update a proximity placement group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateAProximityPlacementGroup.json | +| [proximityPlacementGroupsDeleteSample.js][proximityplacementgroupsdeletesample] | Delete a proximity placement group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteAProximityPlacementGroup.json | +| [proximityPlacementGroupsGetSample.js][proximityplacementgroupsgetsample] | Retrieves information about a proximity placement group . x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAProximityPlacementGroup.json | +| [proximityPlacementGroupsListByResourceGroupSample.js][proximityplacementgroupslistbyresourcegroupsample] | Lists all proximity placement groups in a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInAResourceGroup.json | +| [proximityPlacementGroupsListBySubscriptionSample.js][proximityplacementgroupslistbysubscriptionsample] | Lists all proximity placement groups in a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInASubscription.json | +| [proximityPlacementGroupsUpdateSample.js][proximityplacementgroupsupdatesample] | Update a proximity placement group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/PatchAProximityPlacementGroup.json | +| [snapshotsCreateOrUpdateSample.js][snapshotscreateorupdatesample] | Creates or updates a snapshot. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription.json | +| [snapshotsGetSample.js][snapshotsgetsample] | Gets information about a snapshot. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutASnapshot.json | +| [snapshotsListByResourceGroupSample.js][snapshotslistbyresourcegroupsample] | Lists snapshots under a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInAResourceGroup.json | +| [snapshotsListSample.js][snapshotslistsample] | Lists snapshots under a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInASubscription.json | +| [sshPublicKeysCreateSample.js][sshpublickeyscreatesample] | Creates a new SSH public key resource. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnSshPublicKey.json | +| [sshPublicKeysGenerateKeyPairSample.js][sshpublickeysgeneratekeypairsample] | Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GenerateSshKeyPair.json | +| [sshPublicKeysGetSample.js][sshpublickeysgetsample] | Retrieves information about an SSH public key. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAnSshPublicKey.json | +| [virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.js][virtualmachinescalesetrollingupgradesstartextensionupgradesample] | Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension version. Instances which are already running the latest extension versions are not affected. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VMScaleSetExtensionRollingUpgrade.json | +| [virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.js][virtualmachinescalesetvmextensionscreateorupdatesample] | The operation to create or update the VMSS VM extension. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMExtensionsDeleteSample.js][virtualmachinescalesetvmextensionsdeletesample] | The operation to delete the VMSS VM extension. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMExtensionsGetSample.js][virtualmachinescalesetvmextensionsgetsample] | The operation to get the VMSS VM extension. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMExtensionsListSample.js][virtualmachinescalesetvmextensionslistsample] | The operation to get all extensions of an instance in Virtual Machine Scaleset. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMExtensionsUpdateSample.js][virtualmachinescalesetvmextensionsupdatesample] | The operation to update the VMSS VM extension. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMSGetInstanceViewSample.js][virtualmachinescalesetvmsgetinstanceviewsample] | Gets the status of a virtual machine from a VM scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMInstanceViewAutoPlacedOnDedicatedHostGroup.json | +| [virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.js][virtualmachinescalesetvmsretrievebootdiagnosticsdatasample] | The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVMScaleSetVM.json | +| [virtualMachineScaleSetVMSSimulateEvictionSample.js][virtualmachinescalesetvmssimulateevictionsample] | The operation to simulate the eviction of spot virtual machine in a VM scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVmssVM.json | +| [virtualMachineScaleSetsCreateOrUpdateSample.js][virtualmachinescalesetscreateorupdatesample] | Create or update a VM scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage.json | +| [virtualMachineScaleSetsGetSample.js][virtualmachinescalesetsgetsample] | Display information about a virtual machine scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetAutoPlacedOnDedicatedHostGroup.json | +| [virtualMachinesAssessPatchesSample.js][virtualmachinesassesspatchessample] | Assess patches on the VM. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VirtualMachineAssessPatches.json | +| [virtualMachinesCreateOrUpdateSample.js][virtualmachinescreateorupdatesample] | The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageVmFromAnUnmanagedGeneralizedOsImage.json | +| [virtualMachinesDeleteSample.js][virtualmachinesdeletesample] | The operation to delete a virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ForceDeleteVirtualMachine.json | +| [virtualMachinesGeneralizeSample.js][virtualmachinesgeneralizesample] | Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).
For Linux, please refer to [How to create an image of a virtual machine or VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GeneralizeVirtualMachine.json | +| [virtualMachinesGetSample.js][virtualmachinesgetsample] | Retrieves information about the model view or the instance view of a virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachine.json | +| [virtualMachinesInstanceViewSample.js][virtualmachinesinstanceviewsample] | Retrieves information about the run-time state of a virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineInstanceView.json | +| [virtualMachinesListAvailableSizesSample.js][virtualmachineslistavailablesizessample] | Lists all available virtual machine sizes to which the specified virtual machine can be resized. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailableVmSizes_VirtualMachines.json | +| [virtualMachinesListByLocationSample.js][virtualmachineslistbylocationsample] | Gets all the virtual machines under the specified subscription for the specified location. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachinesInASubscriptionByLocation.json | +| [virtualMachinesReapplySample.js][virtualmachinesreapplysample] | The operation to reapply a virtual machine's state. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReapplyVirtualMachine.json | +| [virtualMachinesReimageSample.js][virtualmachinesreimagesample] | Reimages the virtual machine which has an ephemeral OS disk back to its initial state. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReimageVirtualMachine.json | +| [virtualMachinesRetrieveBootDiagnosticsDataSample.js][virtualmachinesretrievebootdiagnosticsdatasample] | The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVirtualMachine.json | +| [virtualMachinesSimulateEvictionSample.js][virtualmachinessimulateevictionsample] | The operation to simulate the eviction of spot virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVM.json | +| [virtualMachinesUpdateSample.js][virtualmachinesupdatesample] | The operation to update a virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVMDetachDataDiskUsingToBeDetachedProperty.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 availabilitySetsCreateOrUpdateSample.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 COMPUTE_SUBSCRIPTION_ID="" COMPUTE_RESOURCE_GROUP="" node availabilitySetsCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[availabilitysetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsCreateOrUpdateSample.js +[availabilitysetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsListBySubscriptionSample.js +[dedicatedhostgroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsCreateOrUpdateSample.js +[dedicatedhostgroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsGetSample.js +[dedicatedhostscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsCreateOrUpdateSample.js +[dedicatedhostsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsGetSample.js +[diskencryptionsetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsCreateOrUpdateSample.js +[diskencryptionsetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsDeleteSample.js +[diskencryptionsetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsGetSample.js +[diskencryptionsetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListByResourceGroupSample.js +[diskencryptionsetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListSample.js +[diskencryptionsetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsUpdateSample.js +[diskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksCreateOrUpdateSample.js +[disksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksGetSample.js +[diskslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListByResourceGroupSample.js +[diskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListSample.js +[imagescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesCreateOrUpdateSample.js +[imagesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesGetSample.js +[imageslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListByResourceGroupSample.js +[imageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListSample.js +[imagesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesUpdateSample.js +[loganalyticsexportrequestratebyintervalsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportRequestRateByIntervalSample.js +[loganalyticsexportthrottledrequestssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportThrottledRequestsSample.js +[proximityplacementgroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsCreateOrUpdateSample.js +[proximityplacementgroupsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsDeleteSample.js +[proximityplacementgroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsGetSample.js +[proximityplacementgroupslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListByResourceGroupSample.js +[proximityplacementgroupslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListBySubscriptionSample.js +[proximityplacementgroupsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsUpdateSample.js +[snapshotscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsCreateOrUpdateSample.js +[snapshotsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsGetSample.js +[snapshotslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListByResourceGroupSample.js +[snapshotslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListSample.js +[sshpublickeyscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysCreateSample.js +[sshpublickeysgeneratekeypairsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGenerateKeyPairSample.js +[sshpublickeysgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGetSample.js +[virtualmachinescalesetrollingupgradesstartextensionupgradesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.js +[virtualmachinescalesetvmextensionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.js +[virtualmachinescalesetvmextensionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsDeleteSample.js +[virtualmachinescalesetvmextensionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsGetSample.js +[virtualmachinescalesetvmextensionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsListSample.js +[virtualmachinescalesetvmextensionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsUpdateSample.js +[virtualmachinescalesetvmsgetinstanceviewsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSGetInstanceViewSample.js +[virtualmachinescalesetvmsretrievebootdiagnosticsdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.js +[virtualmachinescalesetvmssimulateevictionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSSimulateEvictionSample.js +[virtualmachinescalesetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsCreateOrUpdateSample.js +[virtualmachinescalesetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsGetSample.js +[virtualmachinesassesspatchessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesAssessPatchesSample.js +[virtualmachinescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesCreateOrUpdateSample.js +[virtualmachinesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesDeleteSample.js +[virtualmachinesgeneralizesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGeneralizeSample.js +[virtualmachinesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGetSample.js +[virtualmachinesinstanceviewsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesInstanceViewSample.js +[virtualmachineslistavailablesizessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListAvailableSizesSample.js +[virtualmachineslistbylocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListByLocationSample.js +[virtualmachinesreapplysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReapplySample.js +[virtualmachinesreimagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReimageSample.js +[virtualmachinesretrievebootdiagnosticsdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesRetrieveBootDiagnosticsDataSample.js +[virtualmachinessimulateevictionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesSimulateEvictionSample.js +[virtualmachinesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-compute-profile-2020-09-01-hybrid?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/README.md diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsCreateOrUpdateSample.js new file mode 100644 index 00000000000..a5264913236 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsCreateOrUpdateSample.js @@ -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. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update an availability set. + * + * @summary Create or update an availability set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnAvailabilitySet.json + */ +async function createAnAvailabilitySet() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const availabilitySetName = "myAvailabilitySet"; + const parameters = { + location: "westus", + platformFaultDomainCount: 2, + platformUpdateDomainCount: 20, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.availabilitySets.createOrUpdate( + resourceGroupName, + availabilitySetName, + parameters + ); + console.log(result); +} + +async function main() { + createAnAvailabilitySet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsListBySubscriptionSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsListBySubscriptionSample.js new file mode 100644 index 00000000000..84f2dbe8dfe --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/availabilitySetsListBySubscriptionSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all availability sets in a subscription. + * + * @summary Lists all availability sets in a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailabilitySetsInASubscription.json + */ +async function listAvailabilitySetsInASubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const expand = "virtualMachines\\$ref"; + const options = { expand }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilitySets.listBySubscription(options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAvailabilitySetsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsCreateOrUpdateSample.js new file mode 100644 index 00000000000..1aed9391ccc --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsCreateOrUpdateSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) + * + * @summary Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHostGroup.json + */ +async function createOrUpdateADedicatedHostGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const parameters = { + location: "westus", + platformFaultDomainCount: 3, + supportAutomaticPlacement: true, + tags: { department: "finance" }, + zones: ["1"], + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHostGroups.createOrUpdate( + resourceGroupName, + hostGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateADedicatedHostGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsGetSample.js new file mode 100644 index 00000000000..984fdd86d5a --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostGroupsGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Retrieves information about a dedicated host group. + * + * @summary Retrieves information about a dedicated host group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHostGroup.json + */ +async function createADedicatedHostGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHostGroups.get(resourceGroupName, hostGroupName); + console.log(result); +} + +async function main() { + createADedicatedHostGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsCreateOrUpdateSample.js new file mode 100644 index 00000000000..733d14b28ec --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsCreateOrUpdateSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a dedicated host . + * + * @summary Create or update a dedicated host . + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHost.json + */ +async function createOrUpdateADedicatedHost() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const hostName = "myDedicatedHost"; + const parameters = { + location: "westus", + platformFaultDomain: 1, + sku: { name: "DSv3-Type1" }, + tags: { department: "HR" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHosts.beginCreateOrUpdateAndWait( + resourceGroupName, + hostGroupName, + hostName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateADedicatedHost(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsGetSample.js new file mode 100644 index 00000000000..e80b8d51d4e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/dedicatedHostsGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Retrieves information about a dedicated host. + * + * @summary Retrieves information about a dedicated host. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHost.json + */ +async function getADedicatedHost() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const hostName = "myHost"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHosts.get(resourceGroupName, hostGroupName, hostName); + console.log(result); +} + +async function main() { + getADedicatedHost(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsCreateOrUpdateSample.js new file mode 100644 index 00000000000..14bbf094ccc --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsCreateOrUpdateSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a disk encryption set + * + * @summary Creates or updates a disk encryption set + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateADiskEncryptionSet.json + */ +async function createADiskEncryptionSet() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const diskEncryptionSet = { + activeKey: { + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/{key}", + sourceVault: { + id: "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault", + }, + }, + identity: { type: "SystemAssigned" }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginCreateOrUpdateAndWait( + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet + ); + console.log(result); +} + +async function main() { + createADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsDeleteSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsDeleteSample.js new file mode 100644 index 00000000000..7dcf4fc0ec0 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsDeleteSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a disk encryption set. + * + * @summary Deletes a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/DeleteADiskEncryptionSet.json + */ +async function deleteADiskEncryptionSet() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginDeleteAndWait( + resourceGroupName, + diskEncryptionSetName + ); + console.log(result); +} + +async function main() { + deleteADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsGetSample.js new file mode 100644 index 00000000000..61c2a28c679 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets information about a disk encryption set. + * + * @summary Gets information about a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutADiskEncryptionSet.json + */ +async function getInformationAboutADiskEncryptionSet() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.get(resourceGroupName, diskEncryptionSetName); + console.log(result); +} + +async function main() { + getInformationAboutADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListByResourceGroupSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListByResourceGroupSample.js new file mode 100644 index 00000000000..b1200be626c --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListByResourceGroupSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all the disk encryption sets under a resource group. + * + * @summary Lists all the disk encryption sets under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInAResourceGroup.json + */ +async function listAllDiskEncryptionSetsInAResourceGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.diskEncryptionSets.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllDiskEncryptionSetsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListSample.js new file mode 100644 index 00000000000..1721d87bd87 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsListSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all the disk encryption sets under a subscription. + * + * @summary Lists all the disk encryption sets under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInASubscription.json + */ +async function listAllDiskEncryptionSetsInASubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.diskEncryptionSets.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllDiskEncryptionSetsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsUpdateSample.js new file mode 100644 index 00000000000..377880ec7e3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/diskEncryptionSetsUpdateSample.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates (patches) a disk encryption set. + * + * @summary Updates (patches) a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/UpdateADiskEncryptionSet.json + */ +async function updateADiskEncryptionSet() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const diskEncryptionSet = { + activeKey: { + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/{key}", + sourceVault: { + id: "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault", + }, + }, + tags: { department: "Development", project: "Encryption" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginUpdateAndWait( + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet + ); + console.log(result); +} + +async function main() { + updateADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksCreateOrUpdateSample.js new file mode 100644 index 00000000000..9cf9b30ea51 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksCreateOrUpdateSample.js @@ -0,0 +1,188 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByCopyingASnapshot.json + */ +async function createAManagedDiskByCopyingASnapshot() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot", + }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait(resourceGroupName, diskName, disk); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk = { + creationData: { + createOption: "Import", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait(resourceGroupName, diskName, disk); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk = { + creationData: { + createOption: "Import", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait(resourceGroupName, diskName, disk); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskFromAPlatformImage.json + */ +async function createAManagedDiskFromAPlatformImage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk = { + creationData: { + createOption: "FromImage", + imageReference: { + id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}", + }, + }, + location: "West US", + osType: "Windows", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait(resourceGroupName, diskName, disk); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskFromAnExistingManagedDisk.json + */ +async function createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk2"; + const disk = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", + }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait(resourceGroupName, diskName, disk); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedUploadDisk.json + */ +async function createAManagedUploadDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk = { + creationData: { createOption: "Upload", uploadSizeBytes: 10737418752 }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait(resourceGroupName, diskName, disk); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAnEmptyManagedDisk.json + */ +async function createAnEmptyManagedDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk = { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait(resourceGroupName, diskName, disk); + console.log(result); +} + +async function main() { + createAManagedDiskByCopyingASnapshot(); + createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription(); + createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription(); + createAManagedDiskFromAPlatformImage(); + createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription(); + createAManagedUploadDisk(); + createAnEmptyManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksGetSample.js new file mode 100644 index 00000000000..63f279d241b --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets information about a disk. + * + * @summary Gets information about a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutAManagedDisk.json + */ +async function getInformationAboutAManagedDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myManagedDisk"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.get(resourceGroupName, diskName); + console.log(result); +} + +async function main() { + getInformationAboutAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListByResourceGroupSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListByResourceGroupSample.js new file mode 100644 index 00000000000..8c573ce70c8 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListByResourceGroupSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all the disks under a resource group. + * + * @summary Lists all the disks under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInAResourceGroup.json + */ +async function listAllManagedDisksInAResourceGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllManagedDisksInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListSample.js new file mode 100644 index 00000000000..9c316782014 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/disksListSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all the disks under a subscription. + * + * @summary Lists all the disks under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInASubscription.json + */ +async function listAllManagedDisksInASubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllManagedDisksInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesCreateOrUpdateSample.js new file mode 100644 index 00000000000..1a20f16b8b0 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesCreateOrUpdateSample.js @@ -0,0 +1,373 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromABlobWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + osDisk: { + blobUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + diskEncryptionSet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + osState: "Generalized", + osType: "Linux", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromABlob.json + */ +async function createAVirtualMachineImageFromABlob() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + osDisk: { + blobUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + osState: "Generalized", + osType: "Linux", + }, + zoneResilient: true, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAManagedDiskWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + osDisk: { + diskEncryptionSet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + managedDisk: { + id: "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk", + }, + osState: "Generalized", + osType: "Linux", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAManagedDisk.json + */ +async function createAVirtualMachineImageFromAManagedDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + osDisk: { + managedDisk: { + id: "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk", + }, + osState: "Generalized", + osType: "Linux", + }, + zoneResilient: true, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromASnapshotWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + osDisk: { + diskEncryptionSet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + osState: "Generalized", + osType: "Linux", + snapshot: { + id: "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot", + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromASnapshot.json + */ +async function createAVirtualMachineImageFromASnapshot() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + osDisk: { + osState: "Generalized", + osType: "Linux", + snapshot: { + id: "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot", + }, + }, + zoneResilient: false, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAVM.json + */ +async function createAVirtualMachineImageFromAnExistingVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + sourceVirtualMachine: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromABlob.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromABlob() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + dataDisks: [ + { + blobUri: "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd", + lun: 1, + }, + ], + osDisk: { + blobUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + osState: "Generalized", + osType: "Linux", + }, + zoneResilient: false, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromAManagedDisk.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + dataDisks: [ + { + lun: 1, + managedDisk: { + id: "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2", + }, + }, + ], + osDisk: { + managedDisk: { + id: "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk", + }, + osState: "Generalized", + osType: "Linux", + }, + zoneResilient: false, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromASnapshot.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromASnapshot() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + location: "West US", + storageProfile: { + dataDisks: [ + { + lun: 1, + snapshot: { + id: "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2", + }, + }, + ], + osDisk: { + osState: "Generalized", + osType: "Linux", + snapshot: { + id: "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot", + }, + }, + zoneResilient: true, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +async function main() { + createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromABlob(); + createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromAManagedDisk(); + createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromASnapshot(); + createAVirtualMachineImageFromAnExistingVirtualMachine(); + createAVirtualMachineImageThatIncludesADataDiskFromABlob(); + createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk(); + createAVirtualMachineImageThatIncludesADataDiskFromASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesGetSample.js new file mode 100644 index 00000000000..227cc568c9a --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets an image. + * + * @summary Gets an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetInformationAboutAnImage.json + */ +async function getInformationAboutAVirtualMachineImage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.get(resourceGroupName, imageName); + console.log(result); +} + +async function main() { + getInformationAboutAVirtualMachineImage(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListByResourceGroupSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListByResourceGroupSample.js new file mode 100644 index 00000000000..e19aee382aa --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListByResourceGroupSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the list of images under a resource group. + * + * @summary Gets the list of images under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInAResourceGroup.json + */ +async function listAllVirtualMachineImagesInAResourceGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.images.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllVirtualMachineImagesInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListSample.js new file mode 100644 index 00000000000..74a434d73ce --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesListSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. + * + * @summary Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInASubscription.json + */ +async function listAllVirtualMachineImagesInASubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.images.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllVirtualMachineImagesInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesUpdateSample.js new file mode 100644 index 00000000000..a7e244027be --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/imagesUpdateSample.js @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Update an image. + * + * @summary Update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateImage.json + */ +async function updatesTagsOfAnImage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters = { + hyperVGeneration: "V1", + sourceVirtualMachine: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM", + }, + tags: { department: "HR" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginUpdateAndWait(resourceGroupName, imageName, parameters); + console.log(result); +} + +async function main() { + updatesTagsOfAnImage(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportRequestRateByIntervalSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportRequestRateByIntervalSample.js new file mode 100644 index 00000000000..f4c9b9701e3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportRequestRateByIntervalSample.js @@ -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. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Export logs that show Api requests made by this subscription in the given time window to show throttling activities. + * + * @summary Export logs that show Api requests made by this subscription in the given time window to show throttling activities. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsRequestRateByInterval.json + */ +async function exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const location = "westus"; + const parameters = { + blobContainerSasUri: "https://somesasuri", + fromTime: new Date("2018-01-21T01:54:06.862601Z"), + groupByResourceName: true, + intervalLength: "FiveMins", + toTime: new Date("2018-01-23T01:54:06.862601Z"), + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.logAnalytics.beginExportRequestRateByIntervalAndWait( + location, + parameters + ); + console.log(result); +} + +async function main() { + exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportThrottledRequestsSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportThrottledRequestsSample.js new file mode 100644 index 00000000000..06b848b6e07 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/logAnalyticsExportThrottledRequestsSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @summary Export logs that show total throttled Api requests for this subscription in the given time window. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsThrottledRequests.json + */ +async function exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const location = "westus"; + const parameters = { + blobContainerSasUri: "https://somesasuri", + fromTime: new Date("2018-01-21T01:54:06.862601Z"), + groupByClientApplicationId: false, + groupByOperationName: true, + groupByResourceName: false, + groupByUserAgent: false, + toTime: new Date("2018-01-23T01:54:06.862601Z"), + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.logAnalytics.beginExportThrottledRequestsAndWait( + location, + parameters + ); + console.log(result); +} + +async function main() { + exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/package.json b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/package.json new file mode 100644 index 00000000000..dc0691360e1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-compute-profile-2020-09-01-hybrid-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/compute/arm-compute-profile-2020-09-01-hybrid" + }, + "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/compute/arm-compute-profile-2020-09-01-hybrid", + "dependencies": { + "@azure/arm-compute-profile-2020-09-01-hybrid": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsCreateOrUpdateSample.js new file mode 100644 index 00000000000..20d187ebda0 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsCreateOrUpdateSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a proximity placement group. + * + * @summary Create or update a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateAProximityPlacementGroup.json + */ +async function createOrUpdateAProximityPlacementGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const parameters = { + location: "westus", + proximityPlacementGroupType: "Standard", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.createOrUpdate( + resourceGroupName, + proximityPlacementGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsDeleteSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsDeleteSample.js new file mode 100644 index 00000000000..9395d3b0877 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsDeleteSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a proximity placement group. + * + * @summary Delete a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.delete( + resourceGroupName, + proximityPlacementGroupName + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsGetSample.js new file mode 100644 index 00000000000..de1d5b149b1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Retrieves information about a proximity placement group . + * + * @summary Retrieves information about a proximity placement group . + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.get( + resourceGroupName, + proximityPlacementGroupName + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListByResourceGroupSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListByResourceGroupSample.js new file mode 100644 index 00000000000..165edda718f --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListByResourceGroupSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all proximity placement groups in a resource group. + * + * @summary Lists all proximity placement groups in a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInAResourceGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.proximityPlacementGroups.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListBySubscriptionSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListBySubscriptionSample.js new file mode 100644 index 00000000000..77674a7c219 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsListBySubscriptionSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all proximity placement groups in a subscription. + * + * @summary Lists all proximity placement groups in a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInASubscription.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.proximityPlacementGroups.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsUpdateSample.js new file mode 100644 index 00000000000..eb44f8daab1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/proximityPlacementGroupsUpdateSample.js @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Update a proximity placement group. + * + * @summary Update a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/PatchAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const parameters = { + tags: { additionalProp1: "string" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.update( + resourceGroupName, + proximityPlacementGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/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/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsCreateOrUpdateSample.js new file mode 100644 index 00000000000..2e61279307c --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsCreateOrUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot1"; + const snapshot = { + creationData: { + createOption: "Import", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + storageAccountId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot1"; + const snapshot = { + creationData: { + createOption: "Import", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotFromAnExistingSnapshot.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot2"; + const snapshot = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + }, + location: "West US", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +async function main() { + createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription(); + createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription(); + createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsGetSample.js new file mode 100644 index 00000000000..7343a332d52 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets information about a snapshot. + * + * @summary Gets information about a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutASnapshot.json + */ +async function getInformationAboutASnapshot() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.get(resourceGroupName, snapshotName); + console.log(result); +} + +async function main() { + getInformationAboutASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListByResourceGroupSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListByResourceGroupSample.js new file mode 100644 index 00000000000..10f80e5a46d --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListByResourceGroupSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists snapshots under a resource group. + * + * @summary Lists snapshots under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInAResourceGroup.json + */ +async function listAllSnapshotsInAResourceGroup() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllSnapshotsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListSample.js new file mode 100644 index 00000000000..c45837ec920 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/snapshotsListSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists snapshots under a subscription. + * + * @summary Lists snapshots under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInASubscription.json + */ +async function listAllSnapshotsInASubscription() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllSnapshotsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysCreateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysCreateSample.js new file mode 100644 index 00000000000..4e6c131ad35 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysCreateSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates a new SSH public key resource. + * + * @summary Creates a new SSH public key resource. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnSshPublicKey.json + */ +async function createANewSshPublicKeyResource() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const parameters = { + location: "westus", + publicKey: "{ssh-rsa public key}", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.create(resourceGroupName, sshPublicKeyName, parameters); + console.log(result); +} + +async function main() { + createANewSshPublicKeyResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGenerateKeyPairSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGenerateKeyPairSample.js new file mode 100644 index 00000000000..5d504e731c9 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGenerateKeyPairSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @summary Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GenerateSshKeyPair.json + */ +async function generateAnSshKeyPair() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.generateKeyPair(resourceGroupName, sshPublicKeyName); + console.log(result); +} + +async function main() { + generateAnSshKeyPair(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGetSample.js new file mode 100644 index 00000000000..ea4a3090d34 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/sshPublicKeysGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Retrieves information about an SSH public key. + * + * @summary Retrieves information about an SSH public key. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAnSshPublicKey.json + */ +async function getAnSshPublicKey() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.get(resourceGroupName, sshPublicKeyName); + console.log(result); +} + +async function main() { + getAnSshPublicKey(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.js new file mode 100644 index 00000000000..3a8f9387833 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension version. Instances which are already running the latest extension versions are not affected. + * + * @summary Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension version. Instances which are already running the latest extension versions are not affected. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VMScaleSetExtensionRollingUpgrade.json + */ +async function startAnExtensionRollingUpgrade() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = + await client.virtualMachineScaleSetRollingUpgrades.beginStartExtensionUpgradeAndWait( + resourceGroupName, + vmScaleSetName + ); + console.log(result); +} + +async function main() { + startAnExtensionRollingUpgrade(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.js new file mode 100644 index 00000000000..b171f7d5348 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to create or update the VMSS VM extension. + * + * @summary The operation to create or update the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateVirtualMachineScaleSetVMExtensions.json + */ +async function createVirtualMachineScaleSetVMExtension() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const extensionParameters = { + typePropertiesType: "extType", + autoUpgradeMinorVersion: true, + publisher: "extPublisher", + settings: { UserName: "xyz@microsoft.com" }, + typeHandlerVersion: "1.2", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + extensionParameters + ); + console.log(result); +} + +async function main() { + createVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsDeleteSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsDeleteSample.js new file mode 100644 index 00000000000..9460a3b43ad --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsDeleteSample.js @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to delete the VMSS VM extension. + * + * @summary The operation to delete the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteVirtualMachineScaleSetVMExtensions.json + */ +async function deleteVirtualMachineScaleSetVMExtension() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginDeleteAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName + ); + console.log(result); +} + +async function main() { + deleteVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsGetSample.js new file mode 100644 index 00000000000..1aa8c026635 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsGetSample.js @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to get the VMSS VM extension. + * + * @summary The operation to get the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMExtensions.json + */ +async function getVirtualMachineScaleSetVMExtension() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.get( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName + ); + console.log(result); +} + +async function main() { + getVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsListSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsListSample.js new file mode 100644 index 00000000000..7676096846d --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsListSample.js @@ -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. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @summary The operation to get all extensions of an instance in Virtual Machine Scaleset. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachineScaleSetVMExtensions.json + */ +async function listExtensionsInVmssInstance() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.list( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + listExtensionsInVmssInstance(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsUpdateSample.js new file mode 100644 index 00000000000..484ad0f53a3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMExtensionsUpdateSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to update the VMSS VM extension. + * + * @summary The operation to update the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVirtualMachineScaleSetVMExtensions.json + */ +async function updateVirtualMachineScaleSetVMExtension() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const extensionParameters = { + typePropertiesType: "extType", + autoUpgradeMinorVersion: true, + publisher: "extPublisher", + settings: { UserName: "xyz@microsoft.com" }, + typeHandlerVersion: "1.2", + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginUpdateAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + extensionParameters + ); + console.log(result); +} + +async function main() { + updateVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSGetInstanceViewSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSGetInstanceViewSample.js new file mode 100644 index 00000000000..4c52935cbc7 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSGetInstanceViewSample.js @@ -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. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the status of a virtual machine from a VM scale set. + * + * @summary Gets the status of a virtual machine from a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ +async function getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myVirtualMachineScaleSet"; + const instanceId = "0"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.getInstanceView( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.js new file mode 100644 index 00000000000..9ff3da838d9 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @summary The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVMScaleSetVM.json + */ +async function retrieveBootDiagnosticsDataOfAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const sasUriExpirationTimeInMinutes = 60; + const options = { + sasUriExpirationTimeInMinutes, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.retrieveBootDiagnosticsData( + resourceGroupName, + vmScaleSetName, + instanceId, + options + ); + console.log(result); +} + +async function main() { + retrieveBootDiagnosticsDataOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSSimulateEvictionSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSSimulateEvictionSample.js new file mode 100644 index 00000000000..1fe4f96f608 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetVMSSimulateEvictionSample.js @@ -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. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @summary The operation to simulate the eviction of spot virtual machine in a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVmssVM.json + */ +async function simulateEvictionAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmScaleSetName = "VmScaleSetName"; + const instanceId = "InstanceId"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.simulateEviction( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + simulateEvictionAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsCreateOrUpdateSample.js new file mode 100644 index 00000000000..2db0c4e0715 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsCreateOrUpdateSample.js @@ -0,0 +1,1487 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage.json + */ +async function createACustomImageScaleSetFromAnUnmanagedGeneralizedOSImage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + osDisk: { + name: "osDisk", + caching: "ReadWrite", + createOption: "FromImage", + image: { + uri: "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd", + }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAPlatformImageScaleSetWithUnmanagedOsDisks.json + */ +async function createAPlatformImageScaleSetWithUnmanagedOSDisks() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "osDisk", + caching: "ReadWrite", + createOption: "FromImage", + vhdContainers: [ + "http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer", + ], + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetFromACustomImage.json + */ +async function createAScaleSetFromACustomImage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScalesetWithDiskEncryptionSetResource.json + */ +async function createAScaleSetWithDiskEncryptionSetResourceInOSDiskAndDataDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + dataDisks: [ + { + caching: "ReadWrite", + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + managedDisk: { + diskEncryptionSet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + storageAccountType: "Standard_LRS", + }, + }, + ], + imageReference: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { + diskEncryptionSet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + storageAccountType: "Standard_LRS", + }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetFromWithFpgaNetworkInterface.json + */ +async function createAScaleSetWithFpgaNetworkInterfaces() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + { + name: "{fpgaNic-Name}", + enableAcceleratedNetworking: false, + enableFpga: true, + enableIPForwarding: false, + ipConfigurations: [ + { + name: "{fpgaNic-Name}", + primary: true, + privateIPAddressVersion: "IPv4", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}", + }, + }, + ], + primary: false, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithEncryptionAtHost.json + */ +async function createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + securityProfile: { encryptionAtHost: true }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAMarketplaceImagePlan.json + */ +async function createAScaleSetWithAMarketplaceImagePlan() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAnAzureApplicationGateway.json + */ +async function createAScaleSetWithAnAzureApplicationGateway() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + applicationGatewayBackendAddressPools: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}", + }, + ], + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAnAzureLoadBalancer.json + */ +async function createAScaleSetWithAnAzureLoadBalancer() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + loadBalancerBackendAddressPools: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}", + }, + ], + loadBalancerInboundNatPools: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}", + }, + ], + publicIPAddressConfiguration: { + name: "{vmss-name}", + publicIPAddressVersion: "IPv4", + }, + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAutomaticRepairs.json + */ +async function createAScaleSetWithAutomaticRepairsEnabled() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + automaticRepairsPolicy: { enabled: true, gracePeriod: "PT30M" }, + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithBootDiagnostics.json + */ +async function createAScaleSetWithBootDiagnostics() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: "http://{existing-storage-account-name}.blob.core.windows.net", + }, + }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithEmptyDataDisksOnEachVm.json + */ +async function createAScaleSetWithEmptyDataDisksOnEachVM() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D2_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 }, + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + diskSizeGB: 512, + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithDiffOsDiskUsingDiffDiskPlacement.json + */ +async function createAScaleSetWithEphemeralOSDisksUsingPlacementProperty() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "ResourceDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithDiffOsDisk.json + */ +async function createAScaleSetWithEphemeralOSDisks() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local" }, + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithExtensionsTimeBudget.json + */ +async function createAScaleSetWithExtensionTimeBudget() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: "http://{existing-storage-account-name}.blob.core.windows.net", + }, + }, + extensionProfile: { + extensionsTimeBudget: "PT1H20M", + extensions: [ + { + name: "{extension-name}", + typePropertiesType: "{extension-Type}", + autoUpgradeMinorVersion: false, + publisher: "{extension-Publisher}", + settings: {}, + typeHandlerVersion: "{handler-version}", + }, + ], + }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithManagedBootDiagnostics.json + */ +async function createAScaleSetWithManagedBootDiagnostics() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { bootDiagnostics: { enabled: true } }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithPasswordAuthentication.json + */ +async function createAScaleSetWithPasswordAuthentication() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithPremiumStorage.json + */ +async function createAScaleSetWithPremiumStorage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithSshAuthentication.json + */ +async function createAScaleSetWithSshAuthentication() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + linuxConfiguration: { + disablePasswordAuthentication: true, + ssh: { + publicKeys: [ + { + path: "/home/{your-username}/.ssh/authorized_keys", + keyData: + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1", + }, + ], + }, + }, + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithTerminateScheduledEventEnabled.json + */ +async function createAScaleSetWithTerminateScheduledEventsEnabled() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + scheduledEventsProfile: { + terminateNotificationProfile: { enable: true, notBeforeTimeout: "PT5M" }, + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithVMsInDifferentZones.json + */ +async function createAScaleSetWithVirtualMachinesInDifferentZones() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters = { + location: "centralus", + overprovision: true, + sku: { name: "Standard_A1_v2", capacity: 2, tier: "Standard" }, + upgradePolicy: { mode: "Automatic" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}", + }, + }, + ], + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 }, + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + diskSizeGB: 512, + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }, + zones: ["1", "3"], + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +async function main() { + createACustomImageScaleSetFromAnUnmanagedGeneralizedOSImage(); + createAPlatformImageScaleSetWithUnmanagedOSDisks(); + createAScaleSetFromACustomImage(); + createAScaleSetWithDiskEncryptionSetResourceInOSDiskAndDataDisk(); + createAScaleSetWithFpgaNetworkInterfaces(); + createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty(); + createAScaleSetWithAMarketplaceImagePlan(); + createAScaleSetWithAnAzureApplicationGateway(); + createAScaleSetWithAnAzureLoadBalancer(); + createAScaleSetWithAutomaticRepairsEnabled(); + createAScaleSetWithBootDiagnostics(); + createAScaleSetWithEmptyDataDisksOnEachVM(); + createAScaleSetWithEphemeralOSDisksUsingPlacementProperty(); + createAScaleSetWithEphemeralOSDisks(); + createAScaleSetWithExtensionTimeBudget(); + createAScaleSetWithManagedBootDiagnostics(); + createAScaleSetWithPasswordAuthentication(); + createAScaleSetWithPremiumStorage(); + createAScaleSetWithSshAuthentication(); + createAScaleSetWithTerminateScheduledEventsEnabled(); + createAScaleSetWithVirtualMachinesInDifferentZones(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsGetSample.js new file mode 100644 index 00000000000..b48b3a4ac49 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachineScaleSetsGetSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Display information about a virtual machine scale set. + * + * @summary Display information about a virtual machine scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetAutoPlacedOnDedicatedHostGroup.json + */ +async function getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myVirtualMachineScaleSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.get(resourceGroupName, vmScaleSetName); + console.log(result); +} + +async function main() { + getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesAssessPatchesSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesAssessPatchesSample.js new file mode 100644 index 00000000000..4f0709d0320 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesAssessPatchesSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Assess patches on the VM. + * + * @summary Assess patches on the VM. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VirtualMachineAssessPatches.json + */ +async function assessPatchStateOfAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginAssessPatchesAndWait(resourceGroupName, vmName); + console.log(result); +} + +async function main() { + assessPatchStateOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesCreateOrUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesCreateOrUpdateSample.js new file mode 100644 index 00000000000..267b14d3a79 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesCreateOrUpdateSample.js @@ -0,0 +1,1180 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageVmFromAnUnmanagedGeneralizedOsImage.json + */ +async function createACustomImageVMFromAnUnmanagedGeneralizedOSImage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "{vm-name}"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + image: { + uri: "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd", + }, + osType: "Windows", + vhd: { + uri: "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd", + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAPlatformImageVmWithUnmanagedOsAndDataDisks.json + */ +async function createAPlatformImageVMWithUnmanagedOSAndDataDisks() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "{vm-name}"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + dataDisks: [ + { + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + vhd: { + uri: "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd", + }, + }, + { + createOption: "Empty", + diskSizeGB: 1023, + lun: 1, + vhd: { + uri: "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd", + }, + }, + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + vhd: { + uri: "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd", + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmFromACustomImage.json + */ +async function createAVMFromACustomImage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + imageReference: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmInAnAvailabilitySet.json + */ +async function createAVMInAnAvailabilitySet() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + availabilitySet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}", + }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithDiskEncryptionSetResource.json + */ +async function createAVMWithDiskEncryptionSetResourceIdInTheOSDiskAndDataDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + dataDisks: [ + { + caching: "ReadWrite", + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + managedDisk: { + diskEncryptionSet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + storageAccountType: "Standard_LRS", + }, + }, + { + caching: "ReadWrite", + createOption: "Attach", + diskSizeGB: 1023, + lun: 1, + managedDisk: { + diskEncryptionSet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}", + storageAccountType: "Standard_LRS", + }, + }, + ], + imageReference: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { + diskEncryptionSet: { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + storageAccountType: "Standard_LRS", + }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithEncryptionAtHost.json + */ +async function createAVMWithHostEncryptionUsingEncryptionAtHostProperty() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + securityProfile: { encryptionAtHost: true }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithAMarketplaceImagePlan.json + */ +async function createAVMWithAMarketplaceImagePlan() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfAutomaticByOS.json + */ +async function createAVMWithAPatchSettingPatchModeOfAutomaticByOS() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "AutomaticByOS" }, + provisionVMAgent: true, + }, + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfAutomaticByPlatform.json + */ +async function createAVMWithAPatchSettingPatchModeOfAutomaticByPlatform() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "AutomaticByPlatform" }, + provisionVMAgent: true, + }, + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfManual.json + */ +async function createAVMWithAPatchSettingPatchModeOfManual() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "Manual" }, + provisionVMAgent: true, + }, + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithExtensionsTimeBudget.json + */ +async function createAVMWithAnExtensionsTimeBudget() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: "http://{existing-storage-account-name}.blob.core.windows.net", + }, + }, + extensionsTimeBudget: "PT30M", + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithBootDiagnostics.json + */ +async function createAVMWithBootDiagnostics() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: "http://{existing-storage-account-name}.blob.core.windows.net", + }, + }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithEmptyDataDisks.json + */ +async function createAVMWithEmptyDataDisks() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 }, + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json + */ +async function createAVMWithEphemeralOSDiskProvisioningInCacheDiskUsingPlacementProperty() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "CacheDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json + */ +async function createAVMWithEphemeralOSDiskProvisioningInResourceDiskUsingPlacementProperty() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "ResourceDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDisk.json + */ +async function createAVMWithEphemeralOSDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads", + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local" }, + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithManagedBootDiagnostics.json + */ +async function createAVMWithManagedBootDiagnostics() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + diagnosticsProfile: { bootDiagnostics: { enabled: true } }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPasswordAuthentication.json + */ +async function createAVMWithPasswordAuthentication() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPremiumStorage.json + */ +async function createAVMWithPremiumStorage() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithSshAuthentication.json + */ +async function createAVMWithSshAuthentication() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminUsername: "{your-username}", + computerName: "myVM", + linuxConfiguration: { + disablePasswordAuthentication: true, + ssh: { + publicKeys: [ + { + path: "/home/{your-username}/.ssh/authorized_keys", + keyData: + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1", + }, + ], + }, + }, + }, + storageProfile: { + imageReference: { + offer: "{image_offer}", + publisher: "{image_publisher}", + sku: "{image_sku}", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +async function main() { + createACustomImageVMFromAnUnmanagedGeneralizedOSImage(); + createAPlatformImageVMWithUnmanagedOSAndDataDisks(); + createAVMFromACustomImage(); + createAVMInAnAvailabilitySet(); + createAVMWithDiskEncryptionSetResourceIdInTheOSDiskAndDataDisk(); + createAVMWithHostEncryptionUsingEncryptionAtHostProperty(); + createAVMWithAMarketplaceImagePlan(); + createAVMWithAPatchSettingPatchModeOfAutomaticByOS(); + createAVMWithAPatchSettingPatchModeOfAutomaticByPlatform(); + createAVMWithAPatchSettingPatchModeOfManual(); + createAVMWithAnExtensionsTimeBudget(); + createAVMWithBootDiagnostics(); + createAVMWithEmptyDataDisks(); + createAVMWithEphemeralOSDiskProvisioningInCacheDiskUsingPlacementProperty(); + createAVMWithEphemeralOSDiskProvisioningInResourceDiskUsingPlacementProperty(); + createAVMWithEphemeralOSDisk(); + createAVMWithManagedBootDiagnostics(); + createAVMWithPasswordAuthentication(); + createAVMWithPremiumStorage(); + createAVMWithSshAuthentication(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesDeleteSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesDeleteSample.js new file mode 100644 index 00000000000..946fbc77053 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to delete a virtual machine. + * + * @summary The operation to delete a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ForceDeleteVirtualMachine.json + */ +async function forceDeleteAVM() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const forceDeletion = true; + const options = { forceDeletion }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDeleteAndWait( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + forceDeleteAVM(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGeneralizeSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGeneralizeSample.js new file mode 100644 index 00000000000..8f6d321e0a4 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGeneralizeSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).
For Linux, please refer to [How to create an image of a virtual machine or VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @summary Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).
For Linux, please refer to [How to create an image of a virtual machine or VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GeneralizeVirtualMachine.json + */ +async function generalizeAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.generalize(resourceGroupName, vmName); + console.log(result); +} + +async function main() { + generalizeAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGetSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGetSample.js new file mode 100644 index 00000000000..884b659f89e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesGetSample.js @@ -0,0 +1,52 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Retrieves information about the model view or the instance view of a virtual machine. + * + * @summary Retrieves information about the model view or the instance view of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachine.json + */ +async function getAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.get(resourceGroupName, vmName); + console.log(result); +} + +/** + * This sample demonstrates how to Retrieves information about the model view or the instance view of a virtual machine. + * + * @summary Retrieves information about the model view or the instance view of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineAutoPlacedOnDedicatedHostGroup.json + */ +async function getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.get(resourceGroupName, vmName); + console.log(result); +} + +async function main() { + getAVirtualMachine(); + getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesInstanceViewSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesInstanceViewSample.js new file mode 100644 index 00000000000..1176003c5fa --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesInstanceViewSample.js @@ -0,0 +1,52 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Retrieves information about the run-time state of a virtual machine. + * + * @summary Retrieves information about the run-time state of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineInstanceView.json + */ +async function getVirtualMachineInstanceView() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.instanceView(resourceGroupName, vmName); + console.log(result); +} + +/** + * This sample demonstrates how to Retrieves information about the run-time state of a virtual machine. + * + * @summary Retrieves information about the run-time state of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ +async function getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.instanceView(resourceGroupName, vmName); + console.log(result); +} + +async function main() { + getVirtualMachineInstanceView(); + getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListAvailableSizesSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListAvailableSizesSample.js new file mode 100644 index 00000000000..30e674ff618 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListAvailableSizesSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @summary Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailableVmSizes_VirtualMachines.json + */ +async function listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVmName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.listAvailableSizes(resourceGroupName, vmName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListByLocationSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListByLocationSample.js new file mode 100644 index 00000000000..d4db629d2ac --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesListByLocationSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all the virtual machines under the specified subscription for the specified location. + * + * @summary Gets all the virtual machines under the specified subscription for the specified location. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachinesInASubscriptionByLocation.json + */ +async function listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.listByLocation(location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReapplySample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReapplySample.js new file mode 100644 index 00000000000..ec0c253ac07 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReapplySample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to reapply a virtual machine's state. + * + * @summary The operation to reapply a virtual machine's state. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReapplyVirtualMachine.json + */ +async function reapplyTheStateOfAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginReapplyAndWait(resourceGroupName, vmName); + console.log(result); +} + +async function main() { + reapplyTheStateOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReimageSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReimageSample.js new file mode 100644 index 00000000000..39feb115eb2 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesReimageSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @summary Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReimageVirtualMachine.json + */ +async function reimageAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVMName"; + const parameters = { tempDisk: true }; + const options = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginReimageAndWait( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + reimageAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesRetrieveBootDiagnosticsDataSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesRetrieveBootDiagnosticsDataSample.js new file mode 100644 index 00000000000..879c6702038 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesRetrieveBootDiagnosticsDataSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @summary The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVirtualMachine.json + */ +async function retrieveBootDiagnosticsDataOfAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const sasUriExpirationTimeInMinutes = 60; + const options = { + sasUriExpirationTimeInMinutes, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.retrieveBootDiagnosticsData( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + retrieveBootDiagnosticsDataOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesSimulateEvictionSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesSimulateEvictionSample.js new file mode 100644 index 00000000000..5867afb560b --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesSimulateEvictionSample.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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to simulate the eviction of spot virtual machine. + * + * @summary The operation to simulate the eviction of spot virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVM.json + */ +async function simulateEvictionAVirtualMachine() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.simulateEviction(resourceGroupName, vmName); + console.log(result); +} + +async function main() { + simulateEvictionAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesUpdateSample.js b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesUpdateSample.js new file mode 100644 index 00000000000..e71ca78365a --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/javascript/virtualMachinesUpdateSample.js @@ -0,0 +1,73 @@ +/* + * 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 { ComputeManagementClient } = require("@azure/arm-compute-profile-2020-09-01-hybrid"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to The operation to update a virtual machine. + * + * @summary The operation to update a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVMDetachDataDiskUsingToBeDetachedProperty.json + */ +async function updateAVMByDetachingDataDisk() { + const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + networkProfile: { + networkInterfaces: [ + { + id: "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true, + }, + ], + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0, toBeDetached: true }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1, toBeDetached: false }, + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest", + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +async function main() { + updateAVMByDetachingDataDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/README.md b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/README.md new file mode 100644 index 00000000000..f9dfa431807 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/README.md @@ -0,0 +1,181 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [availabilitySetsCreateOrUpdateSample.ts][availabilitysetscreateorupdatesample] | Create or update an availability set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnAvailabilitySet.json | +| [availabilitySetsListBySubscriptionSample.ts][availabilitysetslistbysubscriptionsample] | Lists all availability sets in a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailabilitySetsInASubscription.json | +| [dedicatedHostGroupsCreateOrUpdateSample.ts][dedicatedhostgroupscreateorupdatesample] | Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHostGroup.json | +| [dedicatedHostGroupsGetSample.ts][dedicatedhostgroupsgetsample] | Retrieves information about a dedicated host group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHostGroup.json | +| [dedicatedHostsCreateOrUpdateSample.ts][dedicatedhostscreateorupdatesample] | Create or update a dedicated host . x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHost.json | +| [dedicatedHostsGetSample.ts][dedicatedhostsgetsample] | Retrieves information about a dedicated host. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHost.json | +| [diskEncryptionSetsCreateOrUpdateSample.ts][diskencryptionsetscreateorupdatesample] | Creates or updates a disk encryption set x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateADiskEncryptionSet.json | +| [diskEncryptionSetsDeleteSample.ts][diskencryptionsetsdeletesample] | Deletes a disk encryption set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/DeleteADiskEncryptionSet.json | +| [diskEncryptionSetsGetSample.ts][diskencryptionsetsgetsample] | Gets information about a disk encryption set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutADiskEncryptionSet.json | +| [diskEncryptionSetsListByResourceGroupSample.ts][diskencryptionsetslistbyresourcegroupsample] | Lists all the disk encryption sets under a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInAResourceGroup.json | +| [diskEncryptionSetsListSample.ts][diskencryptionsetslistsample] | Lists all the disk encryption sets under a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInASubscription.json | +| [diskEncryptionSetsUpdateSample.ts][diskencryptionsetsupdatesample] | Updates (patches) a disk encryption set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/UpdateADiskEncryptionSet.json | +| [disksCreateOrUpdateSample.ts][diskscreateorupdatesample] | Creates or updates a disk. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByCopyingASnapshot.json | +| [disksGetSample.ts][disksgetsample] | Gets information about a disk. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutAManagedDisk.json | +| [disksListByResourceGroupSample.ts][diskslistbyresourcegroupsample] | Lists all the disks under a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInAResourceGroup.json | +| [disksListSample.ts][diskslistsample] | Lists all the disks under a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInASubscription.json | +| [imagesCreateOrUpdateSample.ts][imagescreateorupdatesample] | Create or update an image. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromABlobWithDiskEncryptionSet.json | +| [imagesGetSample.ts][imagesgetsample] | Gets an image. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetInformationAboutAnImage.json | +| [imagesListByResourceGroupSample.ts][imageslistbyresourcegroupsample] | Gets the list of images under a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInAResourceGroup.json | +| [imagesListSample.ts][imageslistsample] | Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInASubscription.json | +| [imagesUpdateSample.ts][imagesupdatesample] | Update an image. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateImage.json | +| [logAnalyticsExportRequestRateByIntervalSample.ts][loganalyticsexportrequestratebyintervalsample] | Export logs that show Api requests made by this subscription in the given time window to show throttling activities. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsRequestRateByInterval.json | +| [logAnalyticsExportThrottledRequestsSample.ts][loganalyticsexportthrottledrequestssample] | Export logs that show total throttled Api requests for this subscription in the given time window. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsThrottledRequests.json | +| [proximityPlacementGroupsCreateOrUpdateSample.ts][proximityplacementgroupscreateorupdatesample] | Create or update a proximity placement group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateAProximityPlacementGroup.json | +| [proximityPlacementGroupsDeleteSample.ts][proximityplacementgroupsdeletesample] | Delete a proximity placement group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteAProximityPlacementGroup.json | +| [proximityPlacementGroupsGetSample.ts][proximityplacementgroupsgetsample] | Retrieves information about a proximity placement group . x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAProximityPlacementGroup.json | +| [proximityPlacementGroupsListByResourceGroupSample.ts][proximityplacementgroupslistbyresourcegroupsample] | Lists all proximity placement groups in a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInAResourceGroup.json | +| [proximityPlacementGroupsListBySubscriptionSample.ts][proximityplacementgroupslistbysubscriptionsample] | Lists all proximity placement groups in a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInASubscription.json | +| [proximityPlacementGroupsUpdateSample.ts][proximityplacementgroupsupdatesample] | Update a proximity placement group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/PatchAProximityPlacementGroup.json | +| [snapshotsCreateOrUpdateSample.ts][snapshotscreateorupdatesample] | Creates or updates a snapshot. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription.json | +| [snapshotsGetSample.ts][snapshotsgetsample] | Gets information about a snapshot. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutASnapshot.json | +| [snapshotsListByResourceGroupSample.ts][snapshotslistbyresourcegroupsample] | Lists snapshots under a resource group. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInAResourceGroup.json | +| [snapshotsListSample.ts][snapshotslistsample] | Lists snapshots under a subscription. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInASubscription.json | +| [sshPublicKeysCreateSample.ts][sshpublickeyscreatesample] | Creates a new SSH public key resource. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnSshPublicKey.json | +| [sshPublicKeysGenerateKeyPairSample.ts][sshpublickeysgeneratekeypairsample] | Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GenerateSshKeyPair.json | +| [sshPublicKeysGetSample.ts][sshpublickeysgetsample] | Retrieves information about an SSH public key. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAnSshPublicKey.json | +| [virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts][virtualmachinescalesetrollingupgradesstartextensionupgradesample] | Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension version. Instances which are already running the latest extension versions are not affected. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VMScaleSetExtensionRollingUpgrade.json | +| [virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.ts][virtualmachinescalesetvmextensionscreateorupdatesample] | The operation to create or update the VMSS VM extension. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMExtensionsDeleteSample.ts][virtualmachinescalesetvmextensionsdeletesample] | The operation to delete the VMSS VM extension. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMExtensionsGetSample.ts][virtualmachinescalesetvmextensionsgetsample] | The operation to get the VMSS VM extension. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMExtensionsListSample.ts][virtualmachinescalesetvmextensionslistsample] | The operation to get all extensions of an instance in Virtual Machine Scaleset. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMExtensionsUpdateSample.ts][virtualmachinescalesetvmextensionsupdatesample] | The operation to update the VMSS VM extension. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVirtualMachineScaleSetVMExtensions.json | +| [virtualMachineScaleSetVMSGetInstanceViewSample.ts][virtualmachinescalesetvmsgetinstanceviewsample] | Gets the status of a virtual machine from a VM scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMInstanceViewAutoPlacedOnDedicatedHostGroup.json | +| [virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts][virtualmachinescalesetvmsretrievebootdiagnosticsdatasample] | The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVMScaleSetVM.json | +| [virtualMachineScaleSetVMSSimulateEvictionSample.ts][virtualmachinescalesetvmssimulateevictionsample] | The operation to simulate the eviction of spot virtual machine in a VM scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVmssVM.json | +| [virtualMachineScaleSetsCreateOrUpdateSample.ts][virtualmachinescalesetscreateorupdatesample] | Create or update a VM scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage.json | +| [virtualMachineScaleSetsGetSample.ts][virtualmachinescalesetsgetsample] | Display information about a virtual machine scale set. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetAutoPlacedOnDedicatedHostGroup.json | +| [virtualMachinesAssessPatchesSample.ts][virtualmachinesassesspatchessample] | Assess patches on the VM. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VirtualMachineAssessPatches.json | +| [virtualMachinesCreateOrUpdateSample.ts][virtualmachinescreateorupdatesample] | The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageVmFromAnUnmanagedGeneralizedOsImage.json | +| [virtualMachinesDeleteSample.ts][virtualmachinesdeletesample] | The operation to delete a virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ForceDeleteVirtualMachine.json | +| [virtualMachinesGeneralizeSample.ts][virtualmachinesgeneralizesample] | Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).
For Linux, please refer to [How to create an image of a virtual machine or VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GeneralizeVirtualMachine.json | +| [virtualMachinesGetSample.ts][virtualmachinesgetsample] | Retrieves information about the model view or the instance view of a virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachine.json | +| [virtualMachinesInstanceViewSample.ts][virtualmachinesinstanceviewsample] | Retrieves information about the run-time state of a virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineInstanceView.json | +| [virtualMachinesListAvailableSizesSample.ts][virtualmachineslistavailablesizessample] | Lists all available virtual machine sizes to which the specified virtual machine can be resized. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailableVmSizes_VirtualMachines.json | +| [virtualMachinesListByLocationSample.ts][virtualmachineslistbylocationsample] | Gets all the virtual machines under the specified subscription for the specified location. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachinesInASubscriptionByLocation.json | +| [virtualMachinesReapplySample.ts][virtualmachinesreapplysample] | The operation to reapply a virtual machine's state. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReapplyVirtualMachine.json | +| [virtualMachinesReimageSample.ts][virtualmachinesreimagesample] | Reimages the virtual machine which has an ephemeral OS disk back to its initial state. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReimageVirtualMachine.json | +| [virtualMachinesRetrieveBootDiagnosticsDataSample.ts][virtualmachinesretrievebootdiagnosticsdatasample] | The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVirtualMachine.json | +| [virtualMachinesSimulateEvictionSample.ts][virtualmachinessimulateevictionsample] | The operation to simulate the eviction of spot virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVM.json | +| [virtualMachinesUpdateSample.ts][virtualmachinesupdatesample] | The operation to update a virtual machine. x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVMDetachDataDiskUsingToBeDetachedProperty.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/availabilitySetsCreateOrUpdateSample.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 COMPUTE_SUBSCRIPTION_ID="" COMPUTE_RESOURCE_GROUP="" node dist/availabilitySetsCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[availabilitysetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsCreateOrUpdateSample.ts +[availabilitysetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsListBySubscriptionSample.ts +[dedicatedhostgroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsCreateOrUpdateSample.ts +[dedicatedhostgroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsGetSample.ts +[dedicatedhostscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsCreateOrUpdateSample.ts +[dedicatedhostsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsGetSample.ts +[diskencryptionsetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsCreateOrUpdateSample.ts +[diskencryptionsetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsDeleteSample.ts +[diskencryptionsetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsGetSample.ts +[diskencryptionsetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListByResourceGroupSample.ts +[diskencryptionsetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListSample.ts +[diskencryptionsetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsUpdateSample.ts +[diskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksCreateOrUpdateSample.ts +[disksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksGetSample.ts +[diskslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListByResourceGroupSample.ts +[diskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListSample.ts +[imagescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesCreateOrUpdateSample.ts +[imagesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesGetSample.ts +[imageslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListByResourceGroupSample.ts +[imageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListSample.ts +[imagesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesUpdateSample.ts +[loganalyticsexportrequestratebyintervalsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportRequestRateByIntervalSample.ts +[loganalyticsexportthrottledrequestssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportThrottledRequestsSample.ts +[proximityplacementgroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsCreateOrUpdateSample.ts +[proximityplacementgroupsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsDeleteSample.ts +[proximityplacementgroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsGetSample.ts +[proximityplacementgroupslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListByResourceGroupSample.ts +[proximityplacementgroupslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListBySubscriptionSample.ts +[proximityplacementgroupsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsUpdateSample.ts +[snapshotscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsCreateOrUpdateSample.ts +[snapshotsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsGetSample.ts +[snapshotslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListByResourceGroupSample.ts +[snapshotslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListSample.ts +[sshpublickeyscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysCreateSample.ts +[sshpublickeysgeneratekeypairsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGenerateKeyPairSample.ts +[sshpublickeysgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGetSample.ts +[virtualmachinescalesetrollingupgradesstartextensionupgradesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts +[virtualmachinescalesetvmextensionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.ts +[virtualmachinescalesetvmextensionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsDeleteSample.ts +[virtualmachinescalesetvmextensionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsGetSample.ts +[virtualmachinescalesetvmextensionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsListSample.ts +[virtualmachinescalesetvmextensionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsUpdateSample.ts +[virtualmachinescalesetvmsgetinstanceviewsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSGetInstanceViewSample.ts +[virtualmachinescalesetvmsretrievebootdiagnosticsdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts +[virtualmachinescalesetvmssimulateevictionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSSimulateEvictionSample.ts +[virtualmachinescalesetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsCreateOrUpdateSample.ts +[virtualmachinescalesetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsGetSample.ts +[virtualmachinesassesspatchessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesAssessPatchesSample.ts +[virtualmachinescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesCreateOrUpdateSample.ts +[virtualmachinesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesDeleteSample.ts +[virtualmachinesgeneralizesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGeneralizeSample.ts +[virtualmachinesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGetSample.ts +[virtualmachinesinstanceviewsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesInstanceViewSample.ts +[virtualmachineslistavailablesizessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListAvailableSizesSample.ts +[virtualmachineslistbylocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListByLocationSample.ts +[virtualmachinesreapplysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReapplySample.ts +[virtualmachinesreimagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReimageSample.ts +[virtualmachinesretrievebootdiagnosticsdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesRetrieveBootDiagnosticsDataSample.ts +[virtualmachinessimulateevictionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesSimulateEvictionSample.ts +[virtualmachinesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-compute-profile-2020-09-01-hybrid?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-profile-2020-09-01-hybrid/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/package.json b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/package.json new file mode 100644 index 00000000000..d6e535aa434 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-compute-profile-2020-09-01-hybrid-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "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/compute/arm-compute-profile-2020-09-01-hybrid" + }, + "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/compute/arm-compute-profile-2020-09-01-hybrid", + "dependencies": { + "@azure/arm-compute-profile-2020-09-01-hybrid": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~4.8.0", + "rimraf": "latest" + } +} diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/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/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..87936fafc92 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsCreateOrUpdateSample.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 { + AvailabilitySet, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update an availability set. + * + * @summary Create or update an availability set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnAvailabilitySet.json + */ +async function createAnAvailabilitySet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const availabilitySetName = "myAvailabilitySet"; + const parameters: AvailabilitySet = { + location: "westus", + platformFaultDomainCount: 2, + platformUpdateDomainCount: 20 + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.availabilitySets.createOrUpdate( + resourceGroupName, + availabilitySetName, + parameters + ); + console.log(result); +} + +async function main() { + createAnAvailabilitySet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsListBySubscriptionSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsListBySubscriptionSample.ts new file mode 100644 index 00000000000..e7e960f8829 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/availabilitySetsListBySubscriptionSample.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 { + AvailabilitySetsListBySubscriptionOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all availability sets in a subscription. + * + * @summary Lists all availability sets in a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailabilitySetsInASubscription.json + */ +async function listAvailabilitySetsInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const expand = "virtualMachines\\$ref"; + const options: AvailabilitySetsListBySubscriptionOptionalParams = { expand }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilitySets.listBySubscription(options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAvailabilitySetsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..1e3d575fe82 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsCreateOrUpdateSample.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 { + DedicatedHostGroup, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) + * + * @summary Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHostGroup.json + */ +async function createOrUpdateADedicatedHostGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const parameters: DedicatedHostGroup = { + location: "westus", + platformFaultDomainCount: 3, + supportAutomaticPlacement: true, + tags: { department: "finance" }, + zones: ["1"] + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHostGroups.createOrUpdate( + resourceGroupName, + hostGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateADedicatedHostGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsGetSample.ts new file mode 100644 index 00000000000..d04f04c6fc8 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostGroupsGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about a dedicated host group. + * + * @summary Retrieves information about a dedicated host group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHostGroup.json + */ +async function createADedicatedHostGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHostGroups.get( + resourceGroupName, + hostGroupName + ); + console.log(result); +} + +async function main() { + createADedicatedHostGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..e98cad759ef --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsCreateOrUpdateSample.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 { + DedicatedHost, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a dedicated host . + * + * @summary Create or update a dedicated host . + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateADedicatedHost.json + */ +async function createOrUpdateADedicatedHost() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const hostName = "myDedicatedHost"; + const parameters: DedicatedHost = { + location: "westus", + platformFaultDomain: 1, + sku: { name: "DSv3-Type1" }, + tags: { department: "HR" } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHosts.beginCreateOrUpdateAndWait( + resourceGroupName, + hostGroupName, + hostName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateADedicatedHost(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsGetSample.ts new file mode 100644 index 00000000000..33dfc6425c7 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/dedicatedHostsGetSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about a dedicated host. + * + * @summary Retrieves information about a dedicated host. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetADedicatedHost.json + */ +async function getADedicatedHost() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const hostGroupName = "myDedicatedHostGroup"; + const hostName = "myHost"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.dedicatedHosts.get( + resourceGroupName, + hostGroupName, + hostName + ); + console.log(result); +} + +async function main() { + getADedicatedHost(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..0ec450bef79 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsCreateOrUpdateSample.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 { + DiskEncryptionSet, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a disk encryption set + * + * @summary Creates or updates a disk encryption set + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateADiskEncryptionSet.json + */ +async function createADiskEncryptionSet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const diskEncryptionSet: DiskEncryptionSet = { + activeKey: { + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/{key}", + sourceVault: { + id: + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault" + } + }, + identity: { type: "SystemAssigned" }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginCreateOrUpdateAndWait( + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet + ); + console.log(result); +} + +async function main() { + createADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsDeleteSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsDeleteSample.ts new file mode 100644 index 00000000000..da5797f93cc --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a disk encryption set. + * + * @summary Deletes a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/DeleteADiskEncryptionSet.json + */ +async function deleteADiskEncryptionSet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginDeleteAndWait( + resourceGroupName, + diskEncryptionSetName + ); + console.log(result); +} + +async function main() { + deleteADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsGetSample.ts new file mode 100644 index 00000000000..4451909612e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets information about a disk encryption set. + * + * @summary Gets information about a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutADiskEncryptionSet.json + */ +async function getInformationAboutADiskEncryptionSet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.get( + resourceGroupName, + diskEncryptionSetName + ); + console.log(result); +} + +async function main() { + getInformationAboutADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListByResourceGroupSample.ts new file mode 100644 index 00000000000..9597b7a41c3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListByResourceGroupSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the disk encryption sets under a resource group. + * + * @summary Lists all the disk encryption sets under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInAResourceGroup.json + */ +async function listAllDiskEncryptionSetsInAResourceGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.diskEncryptionSets.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllDiskEncryptionSetsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListSample.ts new file mode 100644 index 00000000000..4367b1f1be1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the disk encryption sets under a subscription. + * + * @summary Lists all the disk encryption sets under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListDiskEncryptionSetsInASubscription.json + */ +async function listAllDiskEncryptionSetsInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.diskEncryptionSets.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllDiskEncryptionSetsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsUpdateSample.ts new file mode 100644 index 00000000000..adc75526920 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/diskEncryptionSetsUpdateSample.ts @@ -0,0 +1,56 @@ +/* + * 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 { + DiskEncryptionSetUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates (patches) a disk encryption set. + * + * @summary Updates (patches) a disk encryption set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/UpdateADiskEncryptionSet.json + */ +async function updateADiskEncryptionSet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskEncryptionSetName = "myDiskEncryptionSet"; + const diskEncryptionSet: DiskEncryptionSetUpdate = { + activeKey: { + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/{key}", + sourceVault: { + id: + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault" + } + }, + tags: { department: "Development", project: "Encryption" } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.beginUpdateAndWait( + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet + ); + console.log(result); +} + +async function main() { + updateADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksCreateOrUpdateSample.ts new file mode 100644 index 00000000000..6db8b6dc02f --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksCreateOrUpdateSample.ts @@ -0,0 +1,238 @@ +/* + * 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 { + Disk, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByCopyingASnapshot.json + */ +async function createAManagedDiskByCopyingASnapshot() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { + createOption: "Import", + sourceUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { + createOption: "Import", + sourceUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskFromAPlatformImage.json + */ +async function createAManagedDiskFromAPlatformImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { + createOption: "FromImage", + imageReference: { + id: + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}" + } + }, + location: "West US", + osType: "Windows" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedDiskFromAnExistingManagedDisk.json + */ +async function createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk2"; + const disk: Disk = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAManagedUploadDisk.json + */ +async function createAManagedUploadDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { createOption: "Upload", uploadSizeBytes: 10737418752 }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a disk. + * + * @summary Creates or updates a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateAnEmptyManagedDisk.json + */ +async function createAnEmptyManagedDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myDisk"; + const disk: Disk = { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.beginCreateOrUpdateAndWait( + resourceGroupName, + diskName, + disk + ); + console.log(result); +} + +async function main() { + createAManagedDiskByCopyingASnapshot(); + createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription(); + createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription(); + createAManagedDiskFromAPlatformImage(); + createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription(); + createAManagedUploadDisk(); + createAnEmptyManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksGetSample.ts new file mode 100644 index 00000000000..b0694524c3f --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets information about a disk. + * + * @summary Gets information about a disk. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutAManagedDisk.json + */ +async function getInformationAboutAManagedDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const diskName = "myManagedDisk"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.disks.get(resourceGroupName, diskName); + console.log(result); +} + +async function main() { + getInformationAboutAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListByResourceGroupSample.ts new file mode 100644 index 00000000000..71806333e05 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListByResourceGroupSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the disks under a resource group. + * + * @summary Lists all the disks under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInAResourceGroup.json + */ +async function listAllManagedDisksInAResourceGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllManagedDisksInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListSample.ts new file mode 100644 index 00000000000..deae840aa3e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/disksListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the disks under a subscription. + * + * @summary Lists all the disks under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListManagedDisksInASubscription.json + */ +async function listAllManagedDisksInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.disks.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllManagedDisksInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesCreateOrUpdateSample.ts new file mode 100644 index 00000000000..8994929e57e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesCreateOrUpdateSample.ts @@ -0,0 +1,414 @@ +/* + * 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 { + Image, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromABlobWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + blobUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + osState: "Generalized", + osType: "Linux" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromABlob.json + */ +async function createAVirtualMachineImageFromABlob() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + blobUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + osState: "Generalized", + osType: "Linux" + }, + zoneResilient: true + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAManagedDiskWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + managedDisk: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + osState: "Generalized", + osType: "Linux" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAManagedDisk.json + */ +async function createAVirtualMachineImageFromAManagedDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + managedDisk: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + osState: "Generalized", + osType: "Linux" + }, + zoneResilient: true + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromASnapshotWithDiskEncryptionSet.json + */ +async function createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + osState: "Generalized", + osType: "Linux", + snapshot: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromASnapshot.json + */ +async function createAVirtualMachineImageFromASnapshot() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + osDisk: { + osState: "Generalized", + osType: "Linux", + snapshot: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + }, + zoneResilient: false + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageFromAVM.json + */ +async function createAVirtualMachineImageFromAnExistingVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + sourceVirtualMachine: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromABlob.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromABlob() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + dataDisks: [ + { + blobUri: + "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd", + lun: 1 + } + ], + osDisk: { + blobUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + osState: "Generalized", + osType: "Linux" + }, + zoneResilient: false + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromAManagedDisk.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + dataDisks: [ + { + lun: 1, + managedDisk: { + id: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2" + } + } + ], + osDisk: { + managedDisk: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + osState: "Generalized", + osType: "Linux" + }, + zoneResilient: false + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update an image. + * + * @summary Create or update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnImageThatIncludesADataDiskFromASnapshot.json + */ +async function createAVirtualMachineImageThatIncludesADataDiskFromASnapshot() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: Image = { + location: "West US", + storageProfile: { + dataDisks: [ + { + lun: 1, + snapshot: { + id: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2" + } + } + ], + osDisk: { + osState: "Generalized", + osType: "Linux", + snapshot: { + id: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + }, + zoneResilient: true + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginCreateOrUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +async function main() { + createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromABlob(); + createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromAManagedDisk(); + createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource(); + createAVirtualMachineImageFromASnapshot(); + createAVirtualMachineImageFromAnExistingVirtualMachine(); + createAVirtualMachineImageThatIncludesADataDiskFromABlob(); + createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk(); + createAVirtualMachineImageThatIncludesADataDiskFromASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesGetSample.ts new file mode 100644 index 00000000000..10ab2d7eb1c --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets an image. + * + * @summary Gets an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetInformationAboutAnImage.json + */ +async function getInformationAboutAVirtualMachineImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.get(resourceGroupName, imageName); + console.log(result); +} + +async function main() { + getInformationAboutAVirtualMachineImage(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListByResourceGroupSample.ts new file mode 100644 index 00000000000..d509b848ca9 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListByResourceGroupSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of images under a resource group. + * + * @summary Gets the list of images under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInAResourceGroup.json + */ +async function listAllVirtualMachineImagesInAResourceGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.images.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllVirtualMachineImagesInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListSample.ts new file mode 100644 index 00000000000..5eba0184d25 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. + * + * @summary Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListImagesInASubscription.json + */ +async function listAllVirtualMachineImagesInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.images.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllVirtualMachineImagesInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesUpdateSample.ts new file mode 100644 index 00000000000..199ae6092fc --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/imagesUpdateSample.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 { + ImageUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update an image. + * + * @summary Update an image. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateImage.json + */ +async function updatesTagsOfAnImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const imageName = "myImage"; + const parameters: ImageUpdate = { + hyperVGeneration: "V1", + sourceVirtualMachine: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + }, + tags: { department: "HR" } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.images.beginUpdateAndWait( + resourceGroupName, + imageName, + parameters + ); + console.log(result); +} + +async function main() { + updatesTagsOfAnImage(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportRequestRateByIntervalSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportRequestRateByIntervalSample.ts new file mode 100644 index 00000000000..109e4a3fa87 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportRequestRateByIntervalSample.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 { + RequestRateByIntervalInput, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Export logs that show Api requests made by this subscription in the given time window to show throttling activities. + * + * @summary Export logs that show Api requests made by this subscription in the given time window to show throttling activities. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsRequestRateByInterval.json + */ +async function exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const location = "westus"; + const parameters: RequestRateByIntervalInput = { + blobContainerSasUri: "https://somesasuri", + fromTime: new Date("2018-01-21T01:54:06.862601Z"), + groupByResourceName: true, + intervalLength: "FiveMins", + toTime: new Date("2018-01-23T01:54:06.862601Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.logAnalytics.beginExportRequestRateByIntervalAndWait( + location, + parameters + ); + console.log(result); +} + +async function main() { + exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportThrottledRequestsSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportThrottledRequestsSample.ts new file mode 100644 index 00000000000..1e2c80097b6 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/logAnalyticsExportThrottledRequestsSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + ThrottledRequestsInput, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @summary Export logs that show total throttled Api requests for this subscription in the given time window. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/LogAnalyticsThrottledRequests.json + */ +async function exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const location = "westus"; + const parameters: ThrottledRequestsInput = { + blobContainerSasUri: "https://somesasuri", + fromTime: new Date("2018-01-21T01:54:06.862601Z"), + groupByClientApplicationId: false, + groupByOperationName: true, + groupByResourceName: false, + groupByUserAgent: false, + toTime: new Date("2018-01-23T01:54:06.862601Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.logAnalytics.beginExportThrottledRequestsAndWait( + location, + parameters + ); + console.log(result); +} + +async function main() { + exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..a5180fc5e1f --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsCreateOrUpdateSample.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 { + ProximityPlacementGroup, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a proximity placement group. + * + * @summary Create or update a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateAProximityPlacementGroup.json + */ +async function createOrUpdateAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const parameters: ProximityPlacementGroup = { + location: "westus", + proximityPlacementGroupType: "Standard" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.createOrUpdate( + resourceGroupName, + proximityPlacementGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsDeleteSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsDeleteSample.ts new file mode 100644 index 00000000000..aaa17ee4d39 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a proximity placement group. + * + * @summary Delete a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.delete( + resourceGroupName, + proximityPlacementGroupName + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsGetSample.ts new file mode 100644 index 00000000000..3c89b9476ed --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about a proximity placement group . + * + * @summary Retrieves information about a proximity placement group . + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.get( + resourceGroupName, + proximityPlacementGroupName + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListByResourceGroupSample.ts new file mode 100644 index 00000000000..77404da6458 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListByResourceGroupSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all proximity placement groups in a resource group. + * + * @summary Lists all proximity placement groups in a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInAResourceGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.proximityPlacementGroups.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListBySubscriptionSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListBySubscriptionSample.ts new file mode 100644 index 00000000000..397b006c130 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all proximity placement groups in a subscription. + * + * @summary Lists all proximity placement groups in a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListProximityPlacementGroupsInASubscription.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.proximityPlacementGroups.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsUpdateSample.ts new file mode 100644 index 00000000000..3f607670f71 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/proximityPlacementGroupsUpdateSample.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 { + ProximityPlacementGroupUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update a proximity placement group. + * + * @summary Update a proximity placement group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/PatchAProximityPlacementGroup.json + */ +async function createAProximityPlacementGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const proximityPlacementGroupName = "myProximityPlacementGroup"; + const parameters: ProximityPlacementGroupUpdate = { + tags: { additionalProp1: "string" } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.proximityPlacementGroups.update( + resourceGroupName, + proximityPlacementGroupName, + parameters + ); + console.log(result); +} + +async function main() { + createAProximityPlacementGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..9d2fd799005 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsCreateOrUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + Snapshot, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot1"; + const snapshot: Snapshot = { + creationData: { + createOption: "Import", + sourceUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + storageAccountId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot1"; + const snapshot: Snapshot = { + creationData: { + createOption: "Import", + sourceUri: + "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a snapshot. + * + * @summary Creates or updates a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/CreateASnapshotFromAnExistingSnapshot.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot2"; + const snapshot: Snapshot = { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1" + }, + location: "West US" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.beginCreateOrUpdateAndWait( + resourceGroupName, + snapshotName, + snapshot + ); + console.log(result); +} + +async function main() { + createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription(); + createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription(); + createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsGetSample.ts new file mode 100644 index 00000000000..9c2cae80c04 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets information about a snapshot. + * + * @summary Gets information about a snapshot. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/GetInformationAboutASnapshot.json + */ +async function getInformationAboutASnapshot() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const snapshotName = "mySnapshot"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.snapshots.get(resourceGroupName, snapshotName); + console.log(result); +} + +async function main() { + getInformationAboutASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListByResourceGroupSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListByResourceGroupSample.ts new file mode 100644 index 00000000000..188aedcac06 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListByResourceGroupSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists snapshots under a resource group. + * + * @summary Lists snapshots under a resource group. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInAResourceGroup.json + */ +async function listAllSnapshotsInAResourceGroup() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllSnapshotsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListSample.ts new file mode 100644 index 00000000000..d4b2715f461 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/snapshotsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists snapshots under a subscription. + * + * @summary Lists snapshots under a subscription. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/examples/ListSnapshotsInASubscription.json + */ +async function listAllSnapshotsInASubscription() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.snapshots.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllSnapshotsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysCreateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysCreateSample.ts new file mode 100644 index 00000000000..b8c9235e8a3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysCreateSample.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 { + SshPublicKeyResource, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates a new SSH public key resource. + * + * @summary Creates a new SSH public key resource. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAnSshPublicKey.json + */ +async function createANewSshPublicKeyResource() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const parameters: SshPublicKeyResource = { + location: "westus", + publicKey: "{ssh-rsa public key}" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.create( + resourceGroupName, + sshPublicKeyName, + parameters + ); + console.log(result); +} + +async function main() { + createANewSshPublicKeyResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGenerateKeyPairSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGenerateKeyPairSample.ts new file mode 100644 index 00000000000..657c86c57a1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGenerateKeyPairSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @summary Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GenerateSshKeyPair.json + */ +async function generateAnSshKeyPair() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.generateKeyPair( + resourceGroupName, + sshPublicKeyName + ); + console.log(result); +} + +async function main() { + generateAnSshKeyPair(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGetSample.ts new file mode 100644 index 00000000000..99bd89289b1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/sshPublicKeysGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about an SSH public key. + * + * @summary Retrieves information about an SSH public key. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetAnSshPublicKey.json + */ +async function getAnSshPublicKey() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const sshPublicKeyName = "mySshPublicKeyName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.sshPublicKeys.get( + resourceGroupName, + sshPublicKeyName + ); + console.log(result); +} + +async function main() { + getAnSshPublicKey(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts new file mode 100644 index 00000000000..f2d33a6b965 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension version. Instances which are already running the latest extension versions are not affected. + * + * @summary Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension version. Instances which are already running the latest extension versions are not affected. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VMScaleSetExtensionRollingUpgrade.json + */ +async function startAnExtensionRollingUpgrade() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetRollingUpgrades.beginStartExtensionUpgradeAndWait( + resourceGroupName, + vmScaleSetName + ); + console.log(result); +} + +async function main() { + startAnExtensionRollingUpgrade(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..742f186b9ba --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsCreateOrUpdateSample.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 { + VirtualMachineScaleSetVMExtension, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to create or update the VMSS VM extension. + * + * @summary The operation to create or update the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateOrUpdateVirtualMachineScaleSetVMExtensions.json + */ +async function createVirtualMachineScaleSetVMExtension() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const extensionParameters: VirtualMachineScaleSetVMExtension = { + typePropertiesType: "extType", + autoUpgradeMinorVersion: true, + publisher: "extPublisher", + settings: { UserName: "xyz@microsoft.com" }, + typeHandlerVersion: "1.2" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + extensionParameters + ); + console.log(result); +} + +async function main() { + createVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsDeleteSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsDeleteSample.ts new file mode 100644 index 00000000000..bf9b4b790d4 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsDeleteSample.ts @@ -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. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to delete the VMSS VM extension. + * + * @summary The operation to delete the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/DeleteVirtualMachineScaleSetVMExtensions.json + */ +async function deleteVirtualMachineScaleSetVMExtension() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginDeleteAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName + ); + console.log(result); +} + +async function main() { + deleteVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsGetSample.ts new file mode 100644 index 00000000000..07117ea54b3 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsGetSample.ts @@ -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. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to get the VMSS VM extension. + * + * @summary The operation to get the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMExtensions.json + */ +async function getVirtualMachineScaleSetVMExtension() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.get( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName + ); + console.log(result); +} + +async function main() { + getVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsListSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsListSample.ts new file mode 100644 index 00000000000..30fae302e49 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsListSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @summary The operation to get all extensions of an instance in Virtual Machine Scaleset. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachineScaleSetVMExtensions.json + */ +async function listExtensionsInVmssInstance() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.list( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + listExtensionsInVmssInstance(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsUpdateSample.ts new file mode 100644 index 00000000000..95406e833bd --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMExtensionsUpdateSample.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 { + VirtualMachineScaleSetVMExtensionUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to update the VMSS VM extension. + * + * @summary The operation to update the VMSS VM extension. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVirtualMachineScaleSetVMExtensions.json + */ +async function updateVirtualMachineScaleSetVMExtension() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const vmExtensionName = "myVMExtension"; + const extensionParameters: VirtualMachineScaleSetVMExtensionUpdate = { + typePropertiesType: "extType", + autoUpgradeMinorVersion: true, + publisher: "extPublisher", + settings: { UserName: "xyz@microsoft.com" }, + typeHandlerVersion: "1.2" + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMExtensions.beginUpdateAndWait( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + extensionParameters + ); + console.log(result); +} + +async function main() { + updateVirtualMachineScaleSetVMExtension(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSGetInstanceViewSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSGetInstanceViewSample.ts new file mode 100644 index 00000000000..48106c8bdbb --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSGetInstanceViewSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the status of a virtual machine from a VM scale set. + * + * @summary Gets the status of a virtual machine from a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetVMInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ +async function getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myVirtualMachineScaleSet"; + const instanceId = "0"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.getInstanceView( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts new file mode 100644 index 00000000000..f8120e0b85e --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSRetrieveBootDiagnosticsDataSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @summary The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVMScaleSetVM.json + */ +async function retrieveBootDiagnosticsDataOfAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmScaleSetName = "myvmScaleSet"; + const instanceId = "0"; + const sasUriExpirationTimeInMinutes = 60; + const options: VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataOptionalParams = { + sasUriExpirationTimeInMinutes + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.retrieveBootDiagnosticsData( + resourceGroupName, + vmScaleSetName, + instanceId, + options + ); + console.log(result); +} + +async function main() { + retrieveBootDiagnosticsDataOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSSimulateEvictionSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSSimulateEvictionSample.ts new file mode 100644 index 00000000000..d3accc55510 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetVMSSimulateEvictionSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @summary The operation to simulate the eviction of spot virtual machine in a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVmssVM.json + */ +async function simulateEvictionAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmScaleSetName = "VmScaleSetName"; + const instanceId = "InstanceId"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSetVMs.simulateEviction( + resourceGroupName, + vmScaleSetName, + instanceId + ); + console.log(result); +} + +async function main() { + simulateEvictionAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsCreateOrUpdateSample.ts new file mode 100644 index 00000000000..16eea63d7bd --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsCreateOrUpdateSample.ts @@ -0,0 +1,1567 @@ +/* + * 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 { + VirtualMachineScaleSet, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage.json + */ +async function createACustomImageScaleSetFromAnUnmanagedGeneralizedOSImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + osDisk: { + name: "osDisk", + caching: "ReadWrite", + createOption: "FromImage", + image: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd" + } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAPlatformImageScaleSetWithUnmanagedOsDisks.json + */ +async function createAPlatformImageScaleSetWithUnmanagedOSDisks() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "osDisk", + caching: "ReadWrite", + createOption: "FromImage", + vhdContainers: [ + "http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer" + ] + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetFromACustomImage.json + */ +async function createAScaleSetFromACustomImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScalesetWithDiskEncryptionSetResource.json + */ +async function createAScaleSetWithDiskEncryptionSetResourceInOSDiskAndDataDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + dataDisks: [ + { + caching: "ReadWrite", + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + storageAccountType: "Standard_LRS" + } + } + ], + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + storageAccountType: "Standard_LRS" + } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetFromWithFpgaNetworkInterface.json + */ +async function createAScaleSetWithFpgaNetworkInterfaces() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + }, + { + name: "{fpgaNic-Name}", + enableAcceleratedNetworking: false, + enableFpga: true, + enableIPForwarding: false, + ipConfigurations: [ + { + name: "{fpgaNic-Name}", + primary: true, + privateIPAddressVersion: "IPv4", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}" + } + } + ], + primary: false + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithEncryptionAtHost.json + */ +async function createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + securityProfile: { encryptionAtHost: true }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAMarketplaceImagePlan.json + */ +async function createAScaleSetWithAMarketplaceImagePlan() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAnAzureApplicationGateway.json + */ +async function createAScaleSetWithAnAzureApplicationGateway() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + applicationGatewayBackendAddressPools: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}" + } + ], + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAnAzureLoadBalancer.json + */ +async function createAScaleSetWithAnAzureLoadBalancer() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + loadBalancerBackendAddressPools: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}" + } + ], + loadBalancerInboundNatPools: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}" + } + ], + publicIPAddressConfiguration: { + name: "{vmss-name}", + publicIPAddressVersion: "IPv4" + }, + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithAutomaticRepairs.json + */ +async function createAScaleSetWithAutomaticRepairsEnabled() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + automaticRepairsPolicy: { enabled: true, gracePeriod: "PT30M" }, + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithBootDiagnostics.json + */ +async function createAScaleSetWithBootDiagnostics() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: + "http://{existing-storage-account-name}.blob.core.windows.net" + } + }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithEmptyDataDisksOnEachVm.json + */ +async function createAScaleSetWithEmptyDataDisksOnEachVM() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D2_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + diskSizeGB: 512, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithDiffOsDiskUsingDiffDiskPlacement.json + */ +async function createAScaleSetWithEphemeralOSDisksUsingPlacementProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "ResourceDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithDiffOsDisk.json + */ +async function createAScaleSetWithEphemeralOSDisks() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + sku: { name: "Standard_DS1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithExtensionsTimeBudget.json + */ +async function createAScaleSetWithExtensionTimeBudget() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: + "http://{existing-storage-account-name}.blob.core.windows.net" + } + }, + extensionProfile: { + extensionsTimeBudget: "PT1H20M", + extensions: [ + { + name: "{extension-name}", + typePropertiesType: "{extension-Type}", + autoUpgradeMinorVersion: false, + publisher: "{extension-Publisher}", + settings: {}, + typeHandlerVersion: "{handler-version}" + } + ] + }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithManagedBootDiagnostics.json + */ +async function createAScaleSetWithManagedBootDiagnostics() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + diagnosticsProfile: { bootDiagnostics: { enabled: true } }, + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithPasswordAuthentication.json + */ +async function createAScaleSetWithPasswordAuthentication() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithPremiumStorage.json + */ +async function createAScaleSetWithPremiumStorage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithSshAuthentication.json + */ +async function createAScaleSetWithSshAuthentication() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}", + linuxConfiguration: { + disablePasswordAuthentication: true, + ssh: { + publicKeys: [ + { + path: "/home/{your-username}/.ssh/authorized_keys", + keyData: + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1" + } + ] + } + } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithTerminateScheduledEventEnabled.json + */ +async function createAScaleSetWithTerminateScheduledEventsEnabled() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "westus", + overprovision: true, + sku: { name: "Standard_D1_v2", capacity: 3, tier: "Standard" }, + upgradePolicy: { mode: "Manual" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + scheduledEventsProfile: { + terminateNotificationProfile: { enable: true, notBeforeTimeout: "PT5M" } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a VM scale set. + * + * @summary Create or update a VM scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAScaleSetWithVMsInDifferentZones.json + */ +async function createAScaleSetWithVirtualMachinesInDifferentZones() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "{vmss-name}"; + const parameters: VirtualMachineScaleSet = { + location: "centralus", + overprovision: true, + sku: { name: "Standard_A1_v2", capacity: 2, tier: "Standard" }, + upgradePolicy: { mode: "Automatic" }, + virtualMachineProfile: { + networkProfile: { + networkInterfaceConfigurations: [ + { + name: "{vmss-name}", + enableIPForwarding: true, + ipConfigurations: [ + { + name: "{vmss-name}", + subnet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + } + ], + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerNamePrefix: "{vmss-name}" + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + caching: "ReadWrite", + createOption: "FromImage", + diskSizeGB: 512, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }, + zones: ["1", "3"] + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.beginCreateOrUpdateAndWait( + resourceGroupName, + vmScaleSetName, + parameters + ); + console.log(result); +} + +async function main() { + createACustomImageScaleSetFromAnUnmanagedGeneralizedOSImage(); + createAPlatformImageScaleSetWithUnmanagedOSDisks(); + createAScaleSetFromACustomImage(); + createAScaleSetWithDiskEncryptionSetResourceInOSDiskAndDataDisk(); + createAScaleSetWithFpgaNetworkInterfaces(); + createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty(); + createAScaleSetWithAMarketplaceImagePlan(); + createAScaleSetWithAnAzureApplicationGateway(); + createAScaleSetWithAnAzureLoadBalancer(); + createAScaleSetWithAutomaticRepairsEnabled(); + createAScaleSetWithBootDiagnostics(); + createAScaleSetWithEmptyDataDisksOnEachVM(); + createAScaleSetWithEphemeralOSDisksUsingPlacementProperty(); + createAScaleSetWithEphemeralOSDisks(); + createAScaleSetWithExtensionTimeBudget(); + createAScaleSetWithManagedBootDiagnostics(); + createAScaleSetWithPasswordAuthentication(); + createAScaleSetWithPremiumStorage(); + createAScaleSetWithSshAuthentication(); + createAScaleSetWithTerminateScheduledEventsEnabled(); + createAScaleSetWithVirtualMachinesInDifferentZones(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsGetSample.ts new file mode 100644 index 00000000000..31ffe48f5c8 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachineScaleSetsGetSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Display information about a virtual machine scale set. + * + * @summary Display information about a virtual machine scale set. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineScaleSetAutoPlacedOnDedicatedHostGroup.json + */ +async function getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmScaleSetName = "myVirtualMachineScaleSet"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachineScaleSets.get( + resourceGroupName, + vmScaleSetName + ); + console.log(result); +} + +async function main() { + getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesAssessPatchesSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesAssessPatchesSample.ts new file mode 100644 index 00000000000..9e3e9921c0b --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesAssessPatchesSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Assess patches on the VM. + * + * @summary Assess patches on the VM. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/VirtualMachineAssessPatches.json + */ +async function assessPatchStateOfAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroupName"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginAssessPatchesAndWait( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + assessPatchStateOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesCreateOrUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesCreateOrUpdateSample.ts new file mode 100644 index 00000000000..4d816ddc42c --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesCreateOrUpdateSample.ts @@ -0,0 +1,1259 @@ +/* + * 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 { + VirtualMachine, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateACustomImageVmFromAnUnmanagedGeneralizedOsImage.json + */ +async function createACustomImageVMFromAnUnmanagedGeneralizedOSImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "{vm-name}"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + image: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd" + }, + osType: "Windows", + vhd: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAPlatformImageVmWithUnmanagedOsAndDataDisks.json + */ +async function createAPlatformImageVMWithUnmanagedOSAndDataDisks() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "{vm-name}"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + dataDisks: [ + { + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + vhd: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd" + } + }, + { + createOption: "Empty", + diskSizeGB: 1023, + lun: 1, + vhd: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd" + } + } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + vhd: { + uri: + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmFromACustomImage.json + */ +async function createAVMFromACustomImage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmInAnAvailabilitySet.json + */ +async function createAVMInAnAvailabilitySet() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + availabilitySet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}" + }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithDiskEncryptionSetResource.json + */ +async function createAVMWithDiskEncryptionSetResourceIdInTheOSDiskAndDataDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + dataDisks: [ + { + caching: "ReadWrite", + createOption: "Empty", + diskSizeGB: 1023, + lun: 0, + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + storageAccountType: "Standard_LRS" + } + }, + { + caching: "ReadWrite", + createOption: "Attach", + diskSizeGB: 1023, + lun: 1, + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}", + storageAccountType: "Standard_LRS" + } + } + ], + imageReference: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { + diskEncryptionSet: { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + storageAccountType: "Standard_LRS" + } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithEncryptionAtHost.json + */ +async function createAVMWithHostEncryptionUsingEncryptionAtHostProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + securityProfile: { encryptionAtHost: true }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithAMarketplaceImagePlan.json + */ +async function createAVMWithAMarketplaceImagePlan() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfAutomaticByOS.json + */ +async function createAVMWithAPatchSettingPatchModeOfAutomaticByOS() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "AutomaticByOS" }, + provisionVMAgent: true + } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfAutomaticByPlatform.json + */ +async function createAVMWithAPatchSettingPatchModeOfAutomaticByPlatform() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "AutomaticByPlatform" }, + provisionVMAgent: true + } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPatchSettingModeOfManual.json + */ +async function createAVMWithAPatchSettingPatchModeOfManual() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM", + windowsConfiguration: { + enableAutomaticUpdates: true, + patchSettings: { patchMode: "Manual" }, + provisionVMAgent: true + } + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithExtensionsTimeBudget.json + */ +async function createAVMWithAnExtensionsTimeBudget() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: + "http://{existing-storage-account-name}.blob.core.windows.net" + } + }, + extensionsTimeBudget: "PT30M", + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithBootDiagnostics.json + */ +async function createAVMWithBootDiagnostics() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + diagnosticsProfile: { + bootDiagnostics: { + enabled: true, + storageUri: + "http://{existing-storage-account-name}.blob.core.windows.net" + } + }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithEmptyDataDisks.json + */ +async function createAVMWithEmptyDataDisks() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0 }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1 } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json + */ +async function createAVMWithEphemeralOSDiskProvisioningInCacheDiskUsingPlacementProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "CacheDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json + */ +async function createAVMWithEphemeralOSDiskProvisioningInResourceDiskUsingPlacementProperty() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local", placement: "ResourceDisk" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithADiffOsDisk.json + */ +async function createAVMWithEphemeralOSDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_DS1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + plan: { + name: "windows2016", + product: "windows-data-science-vm", + publisher: "microsoft-ads" + }, + storageProfile: { + imageReference: { + offer: "windows-data-science-vm", + publisher: "microsoft-ads", + sku: "windows2016", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadOnly", + createOption: "FromImage", + diffDiskSettings: { option: "Local" }, + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithManagedBootDiagnostics.json + */ +async function createAVMWithManagedBootDiagnostics() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + diagnosticsProfile: { bootDiagnostics: { enabled: true } }, + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPasswordAuthentication.json + */ +async function createAVMWithPasswordAuthentication() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithPremiumStorage.json + */ +async function createAVMWithPremiumStorage() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Premium_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * + * @summary The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/CreateAVmWithSshAuthentication.json + */ +async function createAVMWithSshAuthentication() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachine = { + hardwareProfile: { vmSize: "Standard_D1_v2" }, + location: "westus", + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminUsername: "{your-username}", + computerName: "myVM", + linuxConfiguration: { + disablePasswordAuthentication: true, + ssh: { + publicKeys: [ + { + path: "/home/{your-username}/.ssh/authorized_keys", + keyData: + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1" + } + ] + } + } + }, + storageProfile: { + imageReference: { + offer: "{image_offer}", + publisher: "{image_publisher}", + sku: "{image_sku}", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginCreateOrUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +async function main() { + createACustomImageVMFromAnUnmanagedGeneralizedOSImage(); + createAPlatformImageVMWithUnmanagedOSAndDataDisks(); + createAVMFromACustomImage(); + createAVMInAnAvailabilitySet(); + createAVMWithDiskEncryptionSetResourceIdInTheOSDiskAndDataDisk(); + createAVMWithHostEncryptionUsingEncryptionAtHostProperty(); + createAVMWithAMarketplaceImagePlan(); + createAVMWithAPatchSettingPatchModeOfAutomaticByOS(); + createAVMWithAPatchSettingPatchModeOfAutomaticByPlatform(); + createAVMWithAPatchSettingPatchModeOfManual(); + createAVMWithAnExtensionsTimeBudget(); + createAVMWithBootDiagnostics(); + createAVMWithEmptyDataDisks(); + createAVMWithEphemeralOSDiskProvisioningInCacheDiskUsingPlacementProperty(); + createAVMWithEphemeralOSDiskProvisioningInResourceDiskUsingPlacementProperty(); + createAVMWithEphemeralOSDisk(); + createAVMWithManagedBootDiagnostics(); + createAVMWithPasswordAuthentication(); + createAVMWithPremiumStorage(); + createAVMWithSshAuthentication(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesDeleteSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesDeleteSample.ts new file mode 100644 index 00000000000..5ae1e4d7617 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesDeleteSample.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + VirtualMachinesDeleteOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to delete a virtual machine. + * + * @summary The operation to delete a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ForceDeleteVirtualMachine.json + */ +async function forceDeleteAVM() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const forceDeletion = true; + const options: VirtualMachinesDeleteOptionalParams = { forceDeletion }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginDeleteAndWait( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + forceDeleteAVM(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGeneralizeSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGeneralizeSample.ts new file mode 100644 index 00000000000..c93a033e9bf --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGeneralizeSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).
For Linux, please refer to [How to create an image of a virtual machine or VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @summary Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).
For Linux, please refer to [How to create an image of a virtual machine or VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GeneralizeVirtualMachine.json + */ +async function generalizeAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.generalize( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + generalizeAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGetSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGetSample.ts new file mode 100644 index 00000000000..ec0b736b0b1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesGetSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about the model view or the instance view of a virtual machine. + * + * @summary Retrieves information about the model view or the instance view of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachine.json + */ +async function getAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.get(resourceGroupName, vmName); + console.log(result); +} + +/** + * This sample demonstrates how to Retrieves information about the model view or the instance view of a virtual machine. + * + * @summary Retrieves information about the model view or the instance view of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineAutoPlacedOnDedicatedHostGroup.json + */ +async function getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.get(resourceGroupName, vmName); + console.log(result); +} + +async function main() { + getAVirtualMachine(); + getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesInstanceViewSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesInstanceViewSample.ts new file mode 100644 index 00000000000..87c396098e1 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesInstanceViewSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieves information about the run-time state of a virtual machine. + * + * @summary Retrieves information about the run-time state of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineInstanceView.json + */ +async function getVirtualMachineInstanceView() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.instanceView( + resourceGroupName, + vmName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Retrieves information about the run-time state of a virtual machine. + * + * @summary Retrieves information about the run-time state of a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/GetVirtualMachineInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ +async function getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.instanceView( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + getVirtualMachineInstanceView(); + getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListAvailableSizesSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListAvailableSizesSample.ts new file mode 100644 index 00000000000..015ac640544 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListAvailableSizesSample.ts @@ -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. +import { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @summary Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListAvailableVmSizes_VirtualMachines.json + */ +async function listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVmName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.listAvailableSizes( + resourceGroupName, + vmName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListByLocationSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListByLocationSample.ts new file mode 100644 index 00000000000..6d282fa35ab --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesListByLocationSample.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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all the virtual machines under the specified subscription for the specified location. + * + * @summary Gets all the virtual machines under the specified subscription for the specified location. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ListVirtualMachinesInASubscriptionByLocation.json + */ +async function listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.virtualMachines.listByLocation(location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReapplySample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReapplySample.ts new file mode 100644 index 00000000000..930cff16ae4 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReapplySample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to reapply a virtual machine's state. + * + * @summary The operation to reapply a virtual machine's state. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReapplyVirtualMachine.json + */ +async function reapplyTheStateOfAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginReapplyAndWait( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + reapplyTheStateOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReimageSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReimageSample.ts new file mode 100644 index 00000000000..46a6b11741d --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesReimageSample.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 { + VirtualMachineReimageParameters, + VirtualMachinesReimageOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @summary Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/ReimageVirtualMachine.json + */ +async function reimageAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVMName"; + const parameters: VirtualMachineReimageParameters = { tempDisk: true }; + const options: VirtualMachinesReimageOptionalParams = { parameters }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginReimageAndWait( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + reimageAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesRetrieveBootDiagnosticsDataSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesRetrieveBootDiagnosticsDataSample.ts new file mode 100644 index 00000000000..0716f8f0a5a --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesRetrieveBootDiagnosticsDataSample.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 { + VirtualMachinesRetrieveBootDiagnosticsDataOptionalParams, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @summary The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/RetrieveBootDiagnosticsDataVirtualMachine.json + */ +async function retrieveBootDiagnosticsDataOfAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const sasUriExpirationTimeInMinutes = 60; + const options: VirtualMachinesRetrieveBootDiagnosticsDataOptionalParams = { + sasUriExpirationTimeInMinutes + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.retrieveBootDiagnosticsData( + resourceGroupName, + vmName, + options + ); + console.log(result); +} + +async function main() { + retrieveBootDiagnosticsDataOfAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesSimulateEvictionSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesSimulateEvictionSample.ts new file mode 100644 index 00000000000..ef88f81b66b --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesSimulateEvictionSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { ComputeManagementClient } from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to simulate the eviction of spot virtual machine. + * + * @summary The operation to simulate the eviction of spot virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/SimulateEvictionOfVM.json + */ +async function simulateEvictionAVirtualMachine() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "ResourceGroup"; + const vmName = "VMName"; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.simulateEviction( + resourceGroupName, + vmName + ); + console.log(result); +} + +async function main() { + simulateEvictionAVirtualMachine(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesUpdateSample.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesUpdateSample.ts new file mode 100644 index 00000000000..fa8ec904549 --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/src/virtualMachinesUpdateSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + VirtualMachineUpdate, + ComputeManagementClient +} from "@azure/arm-compute-profile-2020-09-01-hybrid"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to The operation to update a virtual machine. + * + * @summary The operation to update a virtual machine. + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2020-06-01/examples/UpdateVMDetachDataDiskUsingToBeDetachedProperty.json + */ +async function updateAVMByDetachingDataDisk() { + const subscriptionId = + process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = + process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup"; + const vmName = "myVM"; + const parameters: VirtualMachineUpdate = { + hardwareProfile: { vmSize: "Standard_D2_v2" }, + networkProfile: { + networkInterfaces: [ + { + id: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + primary: true + } + ] + }, + osProfile: { + adminPassword: "{your-password}", + adminUsername: "{your-username}", + computerName: "myVM" + }, + storageProfile: { + dataDisks: [ + { createOption: "Empty", diskSizeGB: 1023, lun: 0, toBeDetached: true }, + { createOption: "Empty", diskSizeGB: 1023, lun: 1, toBeDetached: false } + ], + imageReference: { + offer: "WindowsServer", + publisher: "MicrosoftWindowsServer", + sku: "2016-Datacenter", + version: "latest" + }, + osDisk: { + name: "myVMosdisk", + caching: "ReadWrite", + createOption: "FromImage", + managedDisk: { storageAccountType: "Standard_LRS" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ComputeManagementClient(credential, subscriptionId); + const result = await client.virtualMachines.beginUpdateAndWait( + resourceGroupName, + vmName, + parameters + ); + console.log(result); +} + +async function main() { + updateAVMByDetachingDataDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/typescript/tsconfig.json new file mode 100644 index 00000000000..e26ce2a6d8f --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/samples/v2/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/compute/arm-compute-profile-2020-09-01-hybrid/src/computeManagementClient.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/computeManagementClient.ts index df6befa49c2..86dd973bf34 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/computeManagementClient.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/computeManagementClient.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { OperationsImpl, @@ -90,24 +91,54 @@ export class ComputeManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-compute-profile-2020-09-01-hybrid/2.0.1`; + const packageDetails = `azsdk-js-arm-compute-profile-2020-09-01-hybrid/2.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + 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; diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/index.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/index.ts index 67331a75789..4f342674dcb 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/index.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { ComputeManagementClient } from "./computeManagementClient"; export * from "./operationsInterfaces"; diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/models/index.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/models/index.ts index c7a94e5d5f7..e1ec2171e2e 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/models/index.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/models/index.ts @@ -2028,23 +2028,23 @@ export interface DiskEncryptionSetList { nextLink?: string; } -export type SubResourceWithColocationStatus = SubResource & { +export interface SubResourceWithColocationStatus extends SubResource { /** Describes colocation status of a resource in the Proximity Placement Group. */ colocationStatus?: InstanceViewStatus; -}; +} /** Virtual machine image resource information. */ -export type VirtualMachineImageResource = SubResource & { +export interface VirtualMachineImageResource extends SubResource { /** The name of the resource. */ name: string; /** The supported Azure location of the resource. */ location: string; /** Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). */ tags?: { [propertyName: string]: string }; -}; +} /** Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set. */ -export type ImageReference = SubResource & { +export interface ImageReference extends SubResource { /** The image publisher. */ publisher?: string; /** Specifies the offer of the platform image or marketplace image used to create the virtual machine. */ @@ -2058,27 +2058,27 @@ export type ImageReference = SubResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly exactVersion?: string; -}; +} /** Describes the parameter of customer managed disk encryption set resource id that can be specified for disk.

NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. */ -export type DiskEncryptionSetParameters = SubResource & {}; +export interface DiskEncryptionSetParameters extends SubResource {} /** The parameters of a managed disk. */ -export type ManagedDiskParameters = SubResource & { +export interface ManagedDiskParameters extends SubResource { /** Specifies the storage account type for the managed disk. Managed OS disk storage account type can only be set when you create the scale set. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. */ storageAccountType?: StorageAccountTypes; /** Specifies the customer managed disk encryption set resource id for the managed disk. */ diskEncryptionSet?: DiskEncryptionSetParameters; -}; +} /** Describes a network interface reference. */ -export type NetworkInterfaceReference = SubResource & { +export interface NetworkInterfaceReference extends SubResource { /** Specifies the primary network interface in case the virtual machine has more than 1 network interface. */ primary?: boolean; -}; +} /** Output of virtual machine capture operation. */ -export type VirtualMachineCaptureResult = SubResource & { +export interface VirtualMachineCaptureResult extends SubResource { /** * the schema of the captured virtual machine * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2099,10 +2099,10 @@ export type VirtualMachineCaptureResult = SubResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly resources?: Record[]; -}; +} /** Describes a virtual machine scale set network profile's IP configuration. */ -export type VirtualMachineScaleSetIPConfiguration = SubResource & { +export interface VirtualMachineScaleSetIPConfiguration extends SubResource { /** The IP configuration name. */ name: string; /** Specifies the identifier of the subnet. */ @@ -2121,10 +2121,11 @@ export type VirtualMachineScaleSetIPConfiguration = SubResource & { loadBalancerBackendAddressPools?: SubResource[]; /** Specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. */ loadBalancerInboundNatPools?: SubResource[]; -}; +} /** Describes a virtual machine scale set network profile's network configurations. */ -export type VirtualMachineScaleSetNetworkConfiguration = SubResource & { +export interface VirtualMachineScaleSetNetworkConfiguration + extends SubResource { /** The network configuration name. */ name: string; /** Specifies the primary network interface in case the virtual machine has more than 1 network interface. */ @@ -2141,10 +2142,11 @@ export type VirtualMachineScaleSetNetworkConfiguration = SubResource & { ipConfigurations?: VirtualMachineScaleSetIPConfiguration[]; /** Whether IP forwarding enabled on this NIC. */ enableIPForwarding?: boolean; -}; +} /** Describes a virtual machine scale set network profile's IP configuration. NOTE: The subnet of a scale set may be modified as long as the original subnet and the new subnet are in the same virtual network */ -export type VirtualMachineScaleSetUpdateIPConfiguration = SubResource & { +export interface VirtualMachineScaleSetUpdateIPConfiguration + extends SubResource { /** The IP configuration name. */ name?: string; /** The subnet. */ @@ -2163,10 +2165,11 @@ export type VirtualMachineScaleSetUpdateIPConfiguration = SubResource & { loadBalancerBackendAddressPools?: SubResource[]; /** The load balancer inbound nat pools. */ loadBalancerInboundNatPools?: SubResource[]; -}; +} /** Describes a virtual machine scale set network profile's network configurations. */ -export type VirtualMachineScaleSetUpdateNetworkConfiguration = SubResource & { +export interface VirtualMachineScaleSetUpdateNetworkConfiguration + extends SubResource { /** The network configuration name. */ name?: string; /** Whether this is a primary NIC on a virtual machine. */ @@ -2183,10 +2186,10 @@ export type VirtualMachineScaleSetUpdateNetworkConfiguration = SubResource & { ipConfigurations?: VirtualMachineScaleSetUpdateIPConfiguration[]; /** Whether IP forwarding enabled on this NIC. */ enableIPForwarding?: boolean; -}; +} /** Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).

For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. */ -export type AvailabilitySet = Resource & { +export interface AvailabilitySet extends Resource { /** Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. */ sku?: Sku; /** Update Domain count. */ @@ -2202,10 +2205,10 @@ export type AvailabilitySet = Resource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly statuses?: InstanceViewStatus[]; -}; +} /** Specifies information about the proximity placement group. */ -export type ProximityPlacementGroup = Resource & { +export interface ProximityPlacementGroup extends Resource { /** Specifies the type of the proximity placement group.

Possible values are:

**Standard** : Co-locate resources within an Azure region or Availability Zone.

**Ultra** : For future use. */ proximityPlacementGroupType?: ProximityPlacementGroupType; /** @@ -2225,10 +2228,10 @@ export type ProximityPlacementGroup = Resource & { readonly availabilitySets?: SubResourceWithColocationStatus[]; /** Describes colocation status of the Proximity Placement Group. */ colocationStatus?: InstanceViewStatus; -}; +} /** Specifies information about the dedicated host group that the dedicated hosts should be assigned to.

Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another dedicated host group. */ -export type DedicatedHostGroup = Resource & { +export interface DedicatedHostGroup extends Resource { /** Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. */ zones?: string[]; /** Number of fault domains that the host group can span. */ @@ -2245,10 +2248,10 @@ export type DedicatedHostGroup = Resource & { readonly instanceView?: DedicatedHostGroupInstanceView; /** Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided.

Minimum api-version: 2020-06-01. */ supportAutomaticPlacement?: boolean; -}; +} /** Specifies information about the Dedicated host. */ -export type DedicatedHost = Resource & { +export interface DedicatedHost extends Resource { /** SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute SKUs for a list of possible values. */ sku: Sku; /** Fault domain of the dedicated host within a dedicated host group. */ @@ -2282,16 +2285,16 @@ export type DedicatedHost = Resource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly instanceView?: DedicatedHostInstanceView; -}; +} /** Specifies information about the SSH public key. */ -export type SshPublicKeyResource = Resource & { +export interface SshPublicKeyResource extends Resource { /** SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. */ publicKey?: string; -}; +} /** Describes a Virtual Machine Extension Image. */ -export type VirtualMachineExtensionImage = Resource & { +export interface VirtualMachineExtensionImage extends Resource { /** The operating system this extension supports. */ operatingSystem?: string; /** The type of role (IaaS or PaaS) this extension supports. */ @@ -2302,10 +2305,10 @@ export type VirtualMachineExtensionImage = Resource & { vmScaleSetEnabled?: boolean; /** Whether the handler can support multiple extensions. */ supportsMultipleExtensions?: boolean; -}; +} /** Describes a Virtual Machine Extension. */ -export type VirtualMachineExtension = Resource & { +export interface VirtualMachineExtension extends Resource { /** How the extension handler should be forced to update even if the extension configuration has not changed. */ forceUpdateTag?: string; /** The name of the extension handler publisher. */ @@ -2329,10 +2332,10 @@ export type VirtualMachineExtension = Resource & { readonly provisioningState?: string; /** The virtual machine extension instance view. */ instanceView?: VirtualMachineExtensionInstanceView; -}; +} /** Describes a Virtual Machine. */ -export type VirtualMachine = Resource & { +export interface VirtualMachine extends Resource { /** Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. */ plan?: Plan; /** @@ -2393,10 +2396,10 @@ export type VirtualMachine = Resource & { readonly vmId?: string; /** Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M).

Minimum api-version: 2020-06-01 */ extensionsTimeBudget?: string; -}; +} /** The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. */ -export type Image = Resource & { +export interface Image extends Resource { /** The source virtual machine from which Image is created. */ sourceVirtualMachine?: SubResource; /** Specifies the storage settings for the virtual machine disks. */ @@ -2408,10 +2411,10 @@ export type Image = Resource & { readonly provisioningState?: string; /** Gets the HyperVGenerationType of the VirtualMachine created from the image */ hyperVGeneration?: HyperVGenerationTypes; -}; +} /** Describes a Virtual Machine Scale Set. */ -export type VirtualMachineScaleSet = Resource & { +export interface VirtualMachineScaleSet extends Resource { /** The virtual machine scale set sku. */ sku?: Sku; /** Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. */ @@ -2454,10 +2457,10 @@ export type VirtualMachineScaleSet = Resource & { additionalCapabilities?: AdditionalCapabilities; /** Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. */ scaleInPolicy?: ScaleInPolicy; -}; +} /** The status of the latest virtual machine scale set rolling upgrade. */ -export type RollingUpgradeStatusInfo = Resource & { +export interface RollingUpgradeStatusInfo extends Resource { /** * The rolling upgrade policies applied for this upgrade. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2478,10 +2481,10 @@ export type RollingUpgradeStatusInfo = Resource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly error?: ApiError; -}; +} /** Describes a virtual machine scale set virtual machine. */ -export type VirtualMachineScaleSetVM = Resource & { +export interface VirtualMachineScaleSetVM extends Resource { /** * The virtual machine instance ID. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2551,10 +2554,10 @@ export type VirtualMachineScaleSetVM = Resource & { readonly modelDefinitionApplied?: string; /** Specifies the protection policy of the virtual machine. */ protectionPolicy?: VirtualMachineScaleSetVMProtectionPolicy; -}; +} /** Disk resource. */ -export type Disk = Resource & { +export interface Disk extends Resource { /** * A relative URI containing the ID of the VM that has the disk attached. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2605,10 +2608,10 @@ export type Disk = Resource & { readonly diskState?: DiskState; /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ encryption?: Encryption; -}; +} /** Snapshot resource. */ -export type Snapshot = Resource & { +export interface Snapshot extends Resource { /** * Unused. Always Null. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2650,10 +2653,10 @@ export type Snapshot = Resource & { incremental?: boolean; /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ encryption?: Encryption; -}; +} /** disk encryption set resource. */ -export type DiskEncryptionSet = Resource & { +export interface DiskEncryptionSet extends Resource { /** The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. */ identity?: EncryptionSetIdentity; /** The key vault key which is currently used by this disk encryption set. */ @@ -2668,10 +2671,10 @@ export type DiskEncryptionSet = Resource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningState?: string; -}; +} /** Specifies information about the availability set that the virtual machine should be assigned to. Only tags may be updated. */ -export type AvailabilitySetUpdate = UpdateResource & { +export interface AvailabilitySetUpdate extends UpdateResource { /** Sku of the availability set */ sku?: Sku; /** Update Domain count. */ @@ -2687,13 +2690,13 @@ export type AvailabilitySetUpdate = UpdateResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly statuses?: InstanceViewStatus[]; -}; +} /** Specifies information about the proximity placement group. */ -export type ProximityPlacementGroupUpdate = UpdateResource & {}; +export interface ProximityPlacementGroupUpdate extends UpdateResource {} /** Specifies information about the dedicated host group that the dedicated host should be assigned to. Only tags may be updated. */ -export type DedicatedHostGroupUpdate = UpdateResource & { +export interface DedicatedHostGroupUpdate extends UpdateResource { /** Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. */ zones?: string[]; /** Number of fault domains that the host group can span. */ @@ -2710,10 +2713,10 @@ export type DedicatedHostGroupUpdate = UpdateResource & { readonly instanceView?: DedicatedHostGroupInstanceView; /** Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided.

Minimum api-version: 2020-06-01. */ supportAutomaticPlacement?: boolean; -}; +} /** Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType may be updated. */ -export type DedicatedHostUpdate = UpdateResource & { +export interface DedicatedHostUpdate extends UpdateResource { /** Fault domain of the dedicated host within a dedicated host group. */ platformFaultDomain?: number; /** Specifies whether the dedicated host should be replaced automatically in case of a failure. The value is defaulted to 'true' when not provided. */ @@ -2745,16 +2748,16 @@ export type DedicatedHostUpdate = UpdateResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly instanceView?: DedicatedHostInstanceView; -}; +} /** Specifies information about the SSH public key. */ -export type SshPublicKeyUpdateResource = UpdateResource & { +export interface SshPublicKeyUpdateResource extends UpdateResource { /** SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. */ publicKey?: string; -}; +} /** Describes a Virtual Machine Extension. */ -export type VirtualMachineExtensionUpdate = UpdateResource & { +export interface VirtualMachineExtensionUpdate extends UpdateResource { /** How the extension handler should be forced to update even if the extension configuration has not changed. */ forceUpdateTag?: string; /** The name of the extension handler publisher. */ @@ -2771,10 +2774,10 @@ export type VirtualMachineExtensionUpdate = UpdateResource & { settings?: Record; /** The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. */ protectedSettings?: Record; -}; +} /** The source user image virtual hard disk. Only tags may be updated. */ -export type ImageUpdate = UpdateResource & { +export interface ImageUpdate extends UpdateResource { /** The source virtual machine from which Image is created. */ sourceVirtualMachine?: SubResource; /** Specifies the storage settings for the virtual machine disks. */ @@ -2786,10 +2789,10 @@ export type ImageUpdate = UpdateResource & { readonly provisioningState?: string; /** Gets the HyperVGenerationType of the VirtualMachine created from the image */ hyperVGeneration?: HyperVGenerationTypes; -}; +} /** Describes a Virtual Machine Update. */ -export type VirtualMachineUpdate = UpdateResource & { +export interface VirtualMachineUpdate extends UpdateResource { /** Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. */ plan?: Plan; /** The identity of the virtual machine, if configured. */ @@ -2845,10 +2848,10 @@ export type VirtualMachineUpdate = UpdateResource & { readonly vmId?: string; /** Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M).

Minimum api-version: 2020-06-01 */ extensionsTimeBudget?: string; -}; +} /** Describes a Virtual Machine Scale Set. */ -export type VirtualMachineScaleSetUpdate = UpdateResource & { +export interface VirtualMachineScaleSetUpdate extends UpdateResource { /** The virtual machine scale set sku. */ sku?: Sku; /** The purchase plan when deploying a virtual machine scale set from VM Marketplace images. */ @@ -2873,10 +2876,10 @@ export type VirtualMachineScaleSetUpdate = UpdateResource & { scaleInPolicy?: ScaleInPolicy; /** Specifies information about the proximity placement group that the virtual machine scale set should be assigned to.

Minimum api-version: 2018-04-01. */ proximityPlacementGroup?: SubResource; -}; +} /** Describes a Virtual Machine Scale Set Extension. */ -export type VirtualMachineScaleSetExtension = SubResourceReadOnly & { +export interface VirtualMachineScaleSetExtension extends SubResourceReadOnly { /** The name of the extension. */ name?: string; /** @@ -2907,10 +2910,11 @@ export type VirtualMachineScaleSetExtension = SubResourceReadOnly & { readonly provisioningState?: string; /** Collection of extension names after which this extension needs to be provisioned. */ provisionAfterExtensions?: string[]; -}; +} /** Describes a Virtual Machine Scale Set Extension. */ -export type VirtualMachineScaleSetExtensionUpdate = SubResourceReadOnly & { +export interface VirtualMachineScaleSetExtensionUpdate + extends SubResourceReadOnly { /** * The name of the extension. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2944,10 +2948,10 @@ export type VirtualMachineScaleSetExtensionUpdate = SubResourceReadOnly & { readonly provisioningState?: string; /** Collection of extension names after which this extension needs to be provisioned. */ provisionAfterExtensions?: string[]; -}; +} /** Describes a VMSS VM Extension. */ -export type VirtualMachineScaleSetVMExtension = SubResourceReadOnly & { +export interface VirtualMachineScaleSetVMExtension extends SubResourceReadOnly { /** * The name of the extension. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2981,10 +2985,11 @@ export type VirtualMachineScaleSetVMExtension = SubResourceReadOnly & { readonly provisioningState?: string; /** The virtual machine extension instance view. */ instanceView?: VirtualMachineExtensionInstanceView; -}; +} /** Describes a VMSS VM Extension. */ -export type VirtualMachineScaleSetVMExtensionUpdate = SubResourceReadOnly & { +export interface VirtualMachineScaleSetVMExtensionUpdate + extends SubResourceReadOnly { /** * The name of the extension. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -3011,45 +3016,47 @@ export type VirtualMachineScaleSetVMExtensionUpdate = SubResourceReadOnly & { settings?: Record; /** The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. */ protectedSettings?: Record; -}; +} /** The instance view of a dedicated host that includes the name of the dedicated host. It is used for the response to the instance view of a dedicated host group. */ -export type DedicatedHostInstanceViewWithName = DedicatedHostInstanceView & { +export interface DedicatedHostInstanceViewWithName + extends DedicatedHostInstanceView { /** * The name of the dedicated host. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; -}; +} /** Describes an Operating System disk. */ -export type ImageOSDisk = ImageDisk & { +export interface ImageOSDisk extends ImageDisk { /** This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image.

Possible values are:

**Windows**

**Linux** */ osType: OperatingSystemTypes; /** The OS State. */ osState: OperatingSystemStateTypes; -}; +} /** Describes a data disk. */ -export type ImageDataDisk = ImageDisk & { +export interface ImageDataDisk extends ImageDisk { /** Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. */ lun: number; -}; +} /** Describes a Virtual Machine Scale Set VM Reimage Parameters. */ -export type VirtualMachineScaleSetVMReimageParameters = VirtualMachineReimageParameters & {}; +export interface VirtualMachineScaleSetVMReimageParameters + extends VirtualMachineReimageParameters {} /** Api request input for LogAnalytics getRequestRateByInterval Api. */ -export type RequestRateByIntervalInput = LogAnalyticsInputBase & { +export interface RequestRateByIntervalInput extends LogAnalyticsInputBase { /** Interval value in minutes used to create LogAnalytics call rate logs. */ intervalLength: IntervalInMins; -}; +} /** Api request input for LogAnalytics getThrottledRequests Api. */ -export type ThrottledRequestsInput = LogAnalyticsInputBase & {}; +export interface ThrottledRequestsInput extends LogAnalyticsInputBase {} /** Describes a Virtual Machine Image. */ -export type VirtualMachineImage = VirtualMachineImageResource & { +export interface VirtualMachineImage extends VirtualMachineImageResource { /** Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. */ plan?: PurchasePlan; /** Contains the os disk image information. */ @@ -3061,17 +3068,20 @@ export type VirtualMachineImage = VirtualMachineImageResource & { hyperVGeneration?: HyperVGenerationTypes; /** Specifies disallowed configuration for the VirtualMachine created from the image */ disallowed?: DisallowedConfiguration; -}; +} /** Describes a Virtual Machine Scale Set VM Reimage Parameters. */ -export type VirtualMachineScaleSetReimageParameters = VirtualMachineScaleSetVMReimageParameters & { +export interface VirtualMachineScaleSetReimageParameters + extends VirtualMachineScaleSetVMReimageParameters { /** The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. */ instanceIds?: string[]; -}; +} /** Known values of {@link ProximityPlacementGroupType} that the service accepts. */ export enum KnownProximityPlacementGroupType { + /** Standard */ Standard = "Standard", + /** Ultra */ Ultra = "Ultra" } @@ -3087,7 +3097,9 @@ export type ProximityPlacementGroupType = string; /** Known values of {@link HyperVGenerationTypes} that the service accepts. */ export enum KnownHyperVGenerationTypes { + /** V1 */ V1 = "V1", + /** V2 */ V2 = "V2" } @@ -3103,7 +3115,9 @@ export type HyperVGenerationTypes = string; /** Known values of {@link VmDiskTypes} that the service accepts. */ export enum KnownVmDiskTypes { + /** None */ None = "None", + /** Unmanaged */ Unmanaged = "Unmanaged" } @@ -3119,171 +3133,337 @@ export type VmDiskTypes = string; /** Known values of {@link VirtualMachineSizeTypes} that the service accepts. */ export enum KnownVirtualMachineSizeTypes { + /** BasicA0 */ BasicA0 = "Basic_A0", + /** BasicA1 */ BasicA1 = "Basic_A1", + /** BasicA2 */ BasicA2 = "Basic_A2", + /** BasicA3 */ BasicA3 = "Basic_A3", + /** BasicA4 */ BasicA4 = "Basic_A4", + /** StandardA0 */ StandardA0 = "Standard_A0", + /** StandardA1 */ StandardA1 = "Standard_A1", + /** StandardA2 */ StandardA2 = "Standard_A2", + /** StandardA3 */ StandardA3 = "Standard_A3", + /** StandardA4 */ StandardA4 = "Standard_A4", + /** StandardA5 */ StandardA5 = "Standard_A5", + /** StandardA6 */ StandardA6 = "Standard_A6", + /** StandardA7 */ StandardA7 = "Standard_A7", + /** StandardA8 */ StandardA8 = "Standard_A8", + /** StandardA9 */ StandardA9 = "Standard_A9", + /** StandardA10 */ StandardA10 = "Standard_A10", + /** StandardA11 */ StandardA11 = "Standard_A11", + /** StandardA1V2 */ StandardA1V2 = "Standard_A1_v2", + /** StandardA2V2 */ StandardA2V2 = "Standard_A2_v2", + /** StandardA4V2 */ StandardA4V2 = "Standard_A4_v2", + /** StandardA8V2 */ StandardA8V2 = "Standard_A8_v2", + /** StandardA2MV2 */ StandardA2MV2 = "Standard_A2m_v2", + /** StandardA4MV2 */ StandardA4MV2 = "Standard_A4m_v2", + /** StandardA8MV2 */ StandardA8MV2 = "Standard_A8m_v2", + /** StandardB1S */ StandardB1S = "Standard_B1s", + /** StandardB1Ms */ StandardB1Ms = "Standard_B1ms", + /** StandardB2S */ StandardB2S = "Standard_B2s", + /** StandardB2Ms */ StandardB2Ms = "Standard_B2ms", + /** StandardB4Ms */ StandardB4Ms = "Standard_B4ms", + /** StandardB8Ms */ StandardB8Ms = "Standard_B8ms", + /** StandardD1 */ StandardD1 = "Standard_D1", + /** StandardD2 */ StandardD2 = "Standard_D2", + /** StandardD3 */ StandardD3 = "Standard_D3", + /** StandardD4 */ StandardD4 = "Standard_D4", + /** StandardD11 */ StandardD11 = "Standard_D11", + /** StandardD12 */ StandardD12 = "Standard_D12", + /** StandardD13 */ StandardD13 = "Standard_D13", + /** StandardD14 */ StandardD14 = "Standard_D14", + /** StandardD1V2 */ StandardD1V2 = "Standard_D1_v2", + /** StandardD2V2 */ StandardD2V2 = "Standard_D2_v2", + /** StandardD3V2 */ StandardD3V2 = "Standard_D3_v2", + /** StandardD4V2 */ StandardD4V2 = "Standard_D4_v2", + /** StandardD5V2 */ StandardD5V2 = "Standard_D5_v2", + /** StandardD2V3 */ StandardD2V3 = "Standard_D2_v3", + /** StandardD4V3 */ StandardD4V3 = "Standard_D4_v3", + /** StandardD8V3 */ StandardD8V3 = "Standard_D8_v3", + /** StandardD16V3 */ StandardD16V3 = "Standard_D16_v3", + /** StandardD32V3 */ StandardD32V3 = "Standard_D32_v3", + /** StandardD64V3 */ StandardD64V3 = "Standard_D64_v3", + /** StandardD2SV3 */ StandardD2SV3 = "Standard_D2s_v3", + /** StandardD4SV3 */ StandardD4SV3 = "Standard_D4s_v3", + /** StandardD8SV3 */ StandardD8SV3 = "Standard_D8s_v3", + /** StandardD16SV3 */ StandardD16SV3 = "Standard_D16s_v3", + /** StandardD32SV3 */ StandardD32SV3 = "Standard_D32s_v3", + /** StandardD64SV3 */ StandardD64SV3 = "Standard_D64s_v3", + /** StandardD11V2 */ StandardD11V2 = "Standard_D11_v2", + /** StandardD12V2 */ StandardD12V2 = "Standard_D12_v2", + /** StandardD13V2 */ StandardD13V2 = "Standard_D13_v2", + /** StandardD14V2 */ StandardD14V2 = "Standard_D14_v2", + /** StandardD15V2 */ StandardD15V2 = "Standard_D15_v2", + /** StandardDS1 */ StandardDS1 = "Standard_DS1", + /** StandardDS2 */ StandardDS2 = "Standard_DS2", + /** StandardDS3 */ StandardDS3 = "Standard_DS3", + /** StandardDS4 */ StandardDS4 = "Standard_DS4", + /** StandardDS11 */ StandardDS11 = "Standard_DS11", + /** StandardDS12 */ StandardDS12 = "Standard_DS12", + /** StandardDS13 */ StandardDS13 = "Standard_DS13", + /** StandardDS14 */ StandardDS14 = "Standard_DS14", + /** StandardDS1V2 */ StandardDS1V2 = "Standard_DS1_v2", + /** StandardDS2V2 */ StandardDS2V2 = "Standard_DS2_v2", + /** StandardDS3V2 */ StandardDS3V2 = "Standard_DS3_v2", + /** StandardDS4V2 */ StandardDS4V2 = "Standard_DS4_v2", + /** StandardDS5V2 */ StandardDS5V2 = "Standard_DS5_v2", + /** StandardDS11V2 */ StandardDS11V2 = "Standard_DS11_v2", + /** StandardDS12V2 */ StandardDS12V2 = "Standard_DS12_v2", + /** StandardDS13V2 */ StandardDS13V2 = "Standard_DS13_v2", + /** StandardDS14V2 */ StandardDS14V2 = "Standard_DS14_v2", + /** StandardDS15V2 */ StandardDS15V2 = "Standard_DS15_v2", + /** StandardDS134V2 */ StandardDS134V2 = "Standard_DS13-4_v2", + /** StandardDS132V2 */ StandardDS132V2 = "Standard_DS13-2_v2", + /** StandardDS148V2 */ StandardDS148V2 = "Standard_DS14-8_v2", + /** StandardDS144V2 */ StandardDS144V2 = "Standard_DS14-4_v2", + /** StandardE2V3 */ StandardE2V3 = "Standard_E2_v3", + /** StandardE4V3 */ StandardE4V3 = "Standard_E4_v3", + /** StandardE8V3 */ StandardE8V3 = "Standard_E8_v3", + /** StandardE16V3 */ StandardE16V3 = "Standard_E16_v3", + /** StandardE32V3 */ StandardE32V3 = "Standard_E32_v3", + /** StandardE64V3 */ StandardE64V3 = "Standard_E64_v3", + /** StandardE2SV3 */ StandardE2SV3 = "Standard_E2s_v3", + /** StandardE4SV3 */ StandardE4SV3 = "Standard_E4s_v3", + /** StandardE8SV3 */ StandardE8SV3 = "Standard_E8s_v3", + /** StandardE16SV3 */ StandardE16SV3 = "Standard_E16s_v3", + /** StandardE32SV3 */ StandardE32SV3 = "Standard_E32s_v3", + /** StandardE64SV3 */ StandardE64SV3 = "Standard_E64s_v3", + /** StandardE3216V3 */ StandardE3216V3 = "Standard_E32-16_v3", + /** StandardE328SV3 */ StandardE328SV3 = "Standard_E32-8s_v3", + /** StandardE6432SV3 */ StandardE6432SV3 = "Standard_E64-32s_v3", + /** StandardE6416SV3 */ StandardE6416SV3 = "Standard_E64-16s_v3", + /** StandardF1 */ StandardF1 = "Standard_F1", + /** StandardF2 */ StandardF2 = "Standard_F2", + /** StandardF4 */ StandardF4 = "Standard_F4", + /** StandardF8 */ StandardF8 = "Standard_F8", + /** StandardF16 */ StandardF16 = "Standard_F16", + /** StandardF1S */ StandardF1S = "Standard_F1s", + /** StandardF2S */ StandardF2S = "Standard_F2s", + /** StandardF4S */ StandardF4S = "Standard_F4s", + /** StandardF8S */ StandardF8S = "Standard_F8s", + /** StandardF16S */ StandardF16S = "Standard_F16s", + /** StandardF2SV2 */ StandardF2SV2 = "Standard_F2s_v2", + /** StandardF4SV2 */ StandardF4SV2 = "Standard_F4s_v2", + /** StandardF8SV2 */ StandardF8SV2 = "Standard_F8s_v2", + /** StandardF16SV2 */ StandardF16SV2 = "Standard_F16s_v2", + /** StandardF32SV2 */ StandardF32SV2 = "Standard_F32s_v2", + /** StandardF64SV2 */ StandardF64SV2 = "Standard_F64s_v2", + /** StandardF72SV2 */ StandardF72SV2 = "Standard_F72s_v2", + /** StandardG1 */ StandardG1 = "Standard_G1", + /** StandardG2 */ StandardG2 = "Standard_G2", + /** StandardG3 */ StandardG3 = "Standard_G3", + /** StandardG4 */ StandardG4 = "Standard_G4", + /** StandardG5 */ StandardG5 = "Standard_G5", + /** StandardGS1 */ StandardGS1 = "Standard_GS1", + /** StandardGS2 */ StandardGS2 = "Standard_GS2", + /** StandardGS3 */ StandardGS3 = "Standard_GS3", + /** StandardGS4 */ StandardGS4 = "Standard_GS4", + /** StandardGS5 */ StandardGS5 = "Standard_GS5", + /** StandardGS48 */ StandardGS48 = "Standard_GS4-8", + /** StandardGS44 */ StandardGS44 = "Standard_GS4-4", + /** StandardGS516 */ StandardGS516 = "Standard_GS5-16", + /** StandardGS58 */ StandardGS58 = "Standard_GS5-8", + /** StandardH8 */ StandardH8 = "Standard_H8", + /** StandardH16 */ StandardH16 = "Standard_H16", + /** StandardH8M */ StandardH8M = "Standard_H8m", + /** StandardH16M */ StandardH16M = "Standard_H16m", + /** StandardH16R */ StandardH16R = "Standard_H16r", + /** StandardH16Mr */ StandardH16Mr = "Standard_H16mr", + /** StandardL4S */ StandardL4S = "Standard_L4s", + /** StandardL8S */ StandardL8S = "Standard_L8s", + /** StandardL16S */ StandardL16S = "Standard_L16s", + /** StandardL32S */ StandardL32S = "Standard_L32s", + /** StandardM64S */ StandardM64S = "Standard_M64s", + /** StandardM64Ms */ StandardM64Ms = "Standard_M64ms", + /** StandardM128S */ StandardM128S = "Standard_M128s", + /** StandardM128Ms */ StandardM128Ms = "Standard_M128ms", + /** StandardM6432Ms */ StandardM6432Ms = "Standard_M64-32ms", + /** StandardM6416Ms */ StandardM6416Ms = "Standard_M64-16ms", + /** StandardM12864Ms */ StandardM12864Ms = "Standard_M128-64ms", + /** StandardM12832Ms */ StandardM12832Ms = "Standard_M128-32ms", + /** StandardNC6 */ StandardNC6 = "Standard_NC6", + /** StandardNC12 */ StandardNC12 = "Standard_NC12", + /** StandardNC24 */ StandardNC24 = "Standard_NC24", + /** StandardNC24R */ StandardNC24R = "Standard_NC24r", + /** StandardNC6SV2 */ StandardNC6SV2 = "Standard_NC6s_v2", + /** StandardNC12SV2 */ StandardNC12SV2 = "Standard_NC12s_v2", + /** StandardNC24SV2 */ StandardNC24SV2 = "Standard_NC24s_v2", + /** StandardNC24RsV2 */ StandardNC24RsV2 = "Standard_NC24rs_v2", + /** StandardNC6SV3 */ StandardNC6SV3 = "Standard_NC6s_v3", + /** StandardNC12SV3 */ StandardNC12SV3 = "Standard_NC12s_v3", + /** StandardNC24SV3 */ StandardNC24SV3 = "Standard_NC24s_v3", + /** StandardNC24RsV3 */ StandardNC24RsV3 = "Standard_NC24rs_v3", + /** StandardND6S */ StandardND6S = "Standard_ND6s", + /** StandardND12S */ StandardND12S = "Standard_ND12s", + /** StandardND24S */ StandardND24S = "Standard_ND24s", + /** StandardND24Rs */ StandardND24Rs = "Standard_ND24rs", + /** StandardNV6 */ StandardNV6 = "Standard_NV6", + /** StandardNV12 */ StandardNV12 = "Standard_NV12", + /** StandardNV24 */ StandardNV24 = "Standard_NV24" } @@ -3463,6 +3643,7 @@ export type VirtualMachineSizeTypes = string; /** Known values of {@link DiffDiskOptions} that the service accepts. */ export enum KnownDiffDiskOptions { + /** Local */ Local = "Local" } @@ -3477,7 +3658,9 @@ export type DiffDiskOptions = string; /** Known values of {@link DiffDiskPlacement} that the service accepts. */ export enum KnownDiffDiskPlacement { + /** CacheDisk */ CacheDisk = "CacheDisk", + /** ResourceDisk */ ResourceDisk = "ResourceDisk" } @@ -3493,8 +3676,11 @@ export type DiffDiskPlacement = string; /** Known values of {@link DiskCreateOptionTypes} that the service accepts. */ export enum KnownDiskCreateOptionTypes { + /** FromImage */ FromImage = "FromImage", + /** Empty */ Empty = "Empty", + /** Attach */ Attach = "Attach" } @@ -3511,9 +3697,13 @@ export type DiskCreateOptionTypes = string; /** Known values of {@link StorageAccountTypes} that the service accepts. */ export enum KnownStorageAccountTypes { + /** StandardLRS */ StandardLRS = "Standard_LRS", + /** PremiumLRS */ PremiumLRS = "Premium_LRS", + /** StandardSSDLRS */ StandardSSDLRS = "StandardSSD_LRS", + /** UltraSSDLRS */ UltraSSDLRS = "UltraSSD_LRS" } @@ -3531,8 +3721,11 @@ export type StorageAccountTypes = string; /** Known values of {@link InGuestPatchMode} that the service accepts. */ export enum KnownInGuestPatchMode { + /** Manual */ Manual = "Manual", + /** AutomaticByOS */ AutomaticByOS = "AutomaticByOS", + /** AutomaticByPlatform */ AutomaticByPlatform = "AutomaticByPlatform" } @@ -3549,8 +3742,11 @@ export type InGuestPatchMode = string; /** Known values of {@link VirtualMachinePriorityTypes} that the service accepts. */ export enum KnownVirtualMachinePriorityTypes { + /** Regular */ Regular = "Regular", + /** Low */ Low = "Low", + /** Spot */ Spot = "Spot" } @@ -3567,7 +3763,9 @@ export type VirtualMachinePriorityTypes = string; /** Known values of {@link VirtualMachineEvictionPolicyTypes} that the service accepts. */ export enum KnownVirtualMachineEvictionPolicyTypes { + /** Deallocate */ Deallocate = "Deallocate", + /** Delete */ Delete = "Delete" } @@ -3583,7 +3781,9 @@ export type VirtualMachineEvictionPolicyTypes = string; /** Known values of {@link HyperVGenerationType} that the service accepts. */ export enum KnownHyperVGenerationType { + /** V1 */ V1 = "V1", + /** V2 */ V2 = "V2" } @@ -3599,9 +3799,13 @@ export type HyperVGenerationType = string; /** Known values of {@link PatchOperationStatus} that the service accepts. */ export enum KnownPatchOperationStatus { + /** InProgress */ InProgress = "InProgress", + /** Failed */ Failed = "Failed", + /** Succeeded */ Succeeded = "Succeeded", + /** CompletedWithWarnings */ CompletedWithWarnings = "CompletedWithWarnings" } @@ -3619,10 +3823,15 @@ export type PatchOperationStatus = string; /** Known values of {@link RebootStatus} that the service accepts. */ export enum KnownRebootStatus { + /** NotNeeded */ NotNeeded = "NotNeeded", + /** Required */ Required = "Required", + /** Started */ Started = "Started", + /** Failed */ Failed = "Failed", + /** Completed */ Completed = "Completed" } @@ -3641,8 +3850,11 @@ export type RebootStatus = string; /** Known values of {@link SoftwareUpdateRebootBehavior} that the service accepts. */ export enum KnownSoftwareUpdateRebootBehavior { + /** NeverReboots */ NeverReboots = "NeverReboots", + /** AlwaysRequiresReboot */ AlwaysRequiresReboot = "AlwaysRequiresReboot", + /** CanRequestReboot */ CanRequestReboot = "CanRequestReboot" } @@ -3659,11 +3871,17 @@ export type SoftwareUpdateRebootBehavior = string; /** Known values of {@link PatchAssessmentState} that the service accepts. */ export enum KnownPatchAssessmentState { + /** Installed */ Installed = "Installed", + /** Failed */ Failed = "Failed", + /** Excluded */ Excluded = "Excluded", + /** NotSelected */ NotSelected = "NotSelected", + /** Pending */ Pending = "Pending", + /** Available */ Available = "Available" } @@ -3683,7 +3901,9 @@ export type PatchAssessmentState = string; /** Known values of {@link IPVersion} that the service accepts. */ export enum KnownIPVersion { + /** IPv4 */ IPv4 = "IPv4", + /** IPv6 */ IPv6 = "IPv6" } @@ -3699,8 +3919,11 @@ export type IPVersion = string; /** Known values of {@link VirtualMachineScaleSetScaleInRules} that the service accepts. */ export enum KnownVirtualMachineScaleSetScaleInRules { + /** Default */ Default = "Default", + /** OldestVM */ OldestVM = "OldestVM", + /** NewestVM */ NewestVM = "NewestVM" } @@ -3717,7 +3940,9 @@ export type VirtualMachineScaleSetScaleInRules = string; /** Known values of {@link OrchestrationServiceNames} that the service accepts. */ export enum KnownOrchestrationServiceNames { + /** AutomaticRepairs */ AutomaticRepairs = "AutomaticRepairs", + /** DummyOrchestrationServiceName */ DummyOrchestrationServiceName = "DummyOrchestrationServiceName" } @@ -3733,8 +3958,11 @@ export type OrchestrationServiceNames = string; /** Known values of {@link OrchestrationServiceState} that the service accepts. */ export enum KnownOrchestrationServiceState { + /** NotRunning */ NotRunning = "NotRunning", + /** Running */ Running = "Running", + /** Suspended */ Suspended = "Suspended" } @@ -3751,7 +3979,9 @@ export type OrchestrationServiceState = string; /** Known values of {@link OrchestrationServiceStateAction} that the service accepts. */ export enum KnownOrchestrationServiceStateAction { + /** Resume */ Resume = "Resume", + /** Suspend */ Suspend = "Suspend" } @@ -3791,7 +4021,9 @@ export type DiskStorageAccountTypes = string; /** Known values of {@link HyperVGeneration} that the service accepts. */ export enum KnownHyperVGeneration { + /** V1 */ V1 = "V1", + /** V2 */ V2 = "V2" } @@ -3888,8 +4120,11 @@ export type EncryptionType = string; /** Known values of {@link AccessLevel} that the service accepts. */ export enum KnownAccessLevel { + /** None */ None = "None", + /** Read */ Read = "Read", + /** Write */ Write = "Write" } @@ -3927,6 +4162,7 @@ export type SnapshotStorageAccountTypes = string; /** Known values of {@link DiskEncryptionSetIdentityType} that the service accepts. */ export enum KnownDiskEncryptionSetIdentityType { + /** SystemAssigned */ SystemAssigned = "SystemAssigned" } @@ -3941,7 +4177,9 @@ export type DiskEncryptionSetIdentityType = string; /** Known values of {@link AvailabilitySetSkuTypes} that the service accepts. */ export enum KnownAvailabilitySetSkuTypes { + /** Classic */ Classic = "Classic", + /** Aligned */ Aligned = "Aligned" } @@ -4068,10 +4306,7 @@ export type AvailabilitySetsListAvailableSizesResponse = VirtualMachineSizeListR /** Optional parameters. */ export interface AvailabilitySetsListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions { - /** The expand expression to apply to the operation. Allowed values are 'instanceView'. */ - expand?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listBySubscriptionNext operation. */ export type AvailabilitySetsListBySubscriptionNextResponse = AvailabilitySetListResult; @@ -4661,10 +4896,7 @@ export type VirtualMachinesListNextResponse = VirtualMachineListResult; /** Optional parameters. */ export interface VirtualMachinesListAllNextOptionalParams - extends coreClient.OperationOptions { - /** statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. */ - statusOnly?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listAllNext operation. */ export type VirtualMachinesListAllNextResponse = VirtualMachineListResult; @@ -5261,14 +5493,7 @@ export interface VirtualMachineScaleSetVMsSimulateEvictionOptionalParams /** Optional parameters. */ export interface VirtualMachineScaleSetVMsListNextOptionalParams - extends coreClient.OperationOptions { - /** The expand expression to apply to the operation. Allowed values are 'instanceView'. */ - expand?: string; - /** The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. */ - filter?: string; - /** The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. */ - select?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type VirtualMachineScaleSetVMsListNextResponse = VirtualMachineScaleSetVMListResult; diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/availabilitySets.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/availabilitySets.ts index 1a5850b7a57..a79e3940af9 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/availabilitySets.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/availabilitySets.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AvailabilitySets } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,10 +17,13 @@ import { AvailabilitySet, AvailabilitySetsListBySubscriptionNextOptionalParams, AvailabilitySetsListBySubscriptionOptionalParams, + AvailabilitySetsListBySubscriptionResponse, AvailabilitySetsListNextOptionalParams, AvailabilitySetsListOptionalParams, + AvailabilitySetsListResponse, VirtualMachineSize, AvailabilitySetsListAvailableSizesOptionalParams, + AvailabilitySetsListAvailableSizesResponse, AvailabilitySetsCreateOrUpdateOptionalParams, AvailabilitySetsCreateOrUpdateResponse, AvailabilitySetUpdate, @@ -28,9 +32,6 @@ import { AvailabilitySetsDeleteOptionalParams, AvailabilitySetsGetOptionalParams, AvailabilitySetsGetResponse, - AvailabilitySetsListBySubscriptionResponse, - AvailabilitySetsListResponse, - AvailabilitySetsListAvailableSizesResponse, AvailabilitySetsListBySubscriptionNextResponse, AvailabilitySetsListNextResponse } from "../models"; @@ -63,22 +64,34 @@ export class AvailabilitySetsImpl implements AvailabilitySets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: AvailabilitySetsListBySubscriptionOptionalParams + options?: AvailabilitySetsListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AvailabilitySetsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -107,19 +120,29 @@ export class AvailabilitySetsImpl implements AvailabilitySets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, options); + 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?: AvailabilitySetsListOptionalParams + options?: AvailabilitySetsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AvailabilitySetsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -127,7 +150,9 @@ export class AvailabilitySetsImpl implements AvailabilitySets { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -164,11 +189,15 @@ export class AvailabilitySetsImpl implements AvailabilitySets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listAvailableSizesPagingPage( resourceGroupName, availabilitySetName, - options + options, + settings ); } }; @@ -177,9 +206,11 @@ export class AvailabilitySetsImpl implements AvailabilitySets { private async *listAvailableSizesPagingPage( resourceGroupName: string, availabilitySetName: string, - options?: AvailabilitySetsListAvailableSizesOptionalParams + options?: AvailabilitySetsListAvailableSizesOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listAvailableSizes( + let result: AvailabilitySetsListAvailableSizesResponse; + result = await this._listAvailableSizes( resourceGroupName, availabilitySetName, options @@ -488,7 +519,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.AvailabilitySetListResult } }, - queryParameters: [Parameters.apiVersion, Parameters.expand], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -505,7 +535,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.AvailabilitySetListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/dedicatedHostGroups.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/dedicatedHostGroups.ts index 4aa9b79e421..f266251ae35 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/dedicatedHostGroups.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/dedicatedHostGroups.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { DedicatedHostGroups } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,8 +17,10 @@ import { DedicatedHostGroup, DedicatedHostGroupsListByResourceGroupNextOptionalParams, DedicatedHostGroupsListByResourceGroupOptionalParams, + DedicatedHostGroupsListByResourceGroupResponse, DedicatedHostGroupsListBySubscriptionNextOptionalParams, DedicatedHostGroupsListBySubscriptionOptionalParams, + DedicatedHostGroupsListBySubscriptionResponse, DedicatedHostGroupsCreateOrUpdateOptionalParams, DedicatedHostGroupsCreateOrUpdateResponse, DedicatedHostGroupUpdate, @@ -26,8 +29,6 @@ import { DedicatedHostGroupsDeleteOptionalParams, DedicatedHostGroupsGetOptionalParams, DedicatedHostGroupsGetResponse, - DedicatedHostGroupsListByResourceGroupResponse, - DedicatedHostGroupsListBySubscriptionResponse, DedicatedHostGroupsListByResourceGroupNextResponse, DedicatedHostGroupsListBySubscriptionNextResponse } from "../models"; @@ -63,19 +64,33 @@ export class DedicatedHostGroupsImpl implements DedicatedHostGroups { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: DedicatedHostGroupsListByResourceGroupOptionalParams + options?: DedicatedHostGroupsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DedicatedHostGroupsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -83,7 +98,9 @@ export class DedicatedHostGroupsImpl implements DedicatedHostGroups { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -115,22 +132,34 @@ export class DedicatedHostGroupsImpl implements DedicatedHostGroups { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: DedicatedHostGroupsListBySubscriptionOptionalParams + options?: DedicatedHostGroupsListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DedicatedHostGroupsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -398,7 +427,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DedicatedHostGroupListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -416,7 +444,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DedicatedHostGroupListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/dedicatedHosts.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/dedicatedHosts.ts index 20f3430a5d7..7e60e6c88a9 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/dedicatedHosts.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/dedicatedHosts.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { DedicatedHosts } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,6 +19,7 @@ import { DedicatedHost, DedicatedHostsListByHostGroupNextOptionalParams, DedicatedHostsListByHostGroupOptionalParams, + DedicatedHostsListByHostGroupResponse, DedicatedHostsCreateOrUpdateOptionalParams, DedicatedHostsCreateOrUpdateResponse, DedicatedHostUpdate, @@ -26,7 +28,6 @@ import { DedicatedHostsDeleteOptionalParams, DedicatedHostsGetOptionalParams, DedicatedHostsGetResponse, - DedicatedHostsListByHostGroupResponse, DedicatedHostsListByHostGroupNextResponse } from "../models"; @@ -67,11 +68,15 @@ export class DedicatedHostsImpl implements DedicatedHosts { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listByHostGroupPagingPage( resourceGroupName, hostGroupName, - options + options, + settings ); } }; @@ -80,15 +85,22 @@ export class DedicatedHostsImpl implements DedicatedHosts { private async *listByHostGroupPagingPage( resourceGroupName: string, hostGroupName: string, - options?: DedicatedHostsListByHostGroupOptionalParams + options?: DedicatedHostsListByHostGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByHostGroup( - resourceGroupName, - hostGroupName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DedicatedHostsListByHostGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByHostGroup( + resourceGroupName, + hostGroupName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByHostGroupNext( resourceGroupName, @@ -97,7 +109,9 @@ export class DedicatedHostsImpl implements DedicatedHosts { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -179,10 +193,12 @@ export class DedicatedHostsImpl implements DedicatedHosts { { resourceGroupName, hostGroupName, hostName, parameters, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -274,10 +290,12 @@ export class DedicatedHostsImpl implements DedicatedHosts { { resourceGroupName, hostGroupName, hostName, parameters, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -362,10 +380,12 @@ export class DedicatedHostsImpl implements DedicatedHosts { { resourceGroupName, hostGroupName, hostName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -573,7 +593,6 @@ const listByHostGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DedicatedHostListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/diskEncryptionSets.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/diskEncryptionSets.ts index c72e12af26e..bcc2c9f8762 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/diskEncryptionSets.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/diskEncryptionSets.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { DiskEncryptionSets } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,8 +19,10 @@ import { DiskEncryptionSet, DiskEncryptionSetsListByResourceGroupNextOptionalParams, DiskEncryptionSetsListByResourceGroupOptionalParams, + DiskEncryptionSetsListByResourceGroupResponse, DiskEncryptionSetsListNextOptionalParams, DiskEncryptionSetsListOptionalParams, + DiskEncryptionSetsListResponse, DiskEncryptionSetsCreateOrUpdateOptionalParams, DiskEncryptionSetsCreateOrUpdateResponse, DiskEncryptionSetUpdate, @@ -28,8 +31,6 @@ import { DiskEncryptionSetsGetOptionalParams, DiskEncryptionSetsGetResponse, DiskEncryptionSetsDeleteOptionalParams, - DiskEncryptionSetsListByResourceGroupResponse, - DiskEncryptionSetsListResponse, DiskEncryptionSetsListByResourceGroupNextResponse, DiskEncryptionSetsListNextResponse } from "../models"; @@ -64,19 +65,33 @@ export class DiskEncryptionSetsImpl implements DiskEncryptionSets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: DiskEncryptionSetsListByResourceGroupOptionalParams + options?: DiskEncryptionSetsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DiskEncryptionSetsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -84,7 +99,9 @@ export class DiskEncryptionSetsImpl implements DiskEncryptionSets { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -115,22 +132,34 @@ export class DiskEncryptionSetsImpl implements DiskEncryptionSets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: DiskEncryptionSetsListOptionalParams + options?: DiskEncryptionSetsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DiskEncryptionSetsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -207,10 +236,12 @@ export class DiskEncryptionSetsImpl implements DiskEncryptionSets { { resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -303,10 +334,12 @@ export class DiskEncryptionSetsImpl implements DiskEncryptionSets { { resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -410,10 +443,12 @@ export class DiskEncryptionSetsImpl implements DiskEncryptionSets { { resourceGroupName, diskEncryptionSetName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -657,7 +692,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -678,7 +712,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/disks.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/disks.ts index f9809a1036f..38c75d962bf 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/disks.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/disks.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Disks } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,8 +19,10 @@ import { Disk, DisksListByResourceGroupNextOptionalParams, DisksListByResourceGroupOptionalParams, + DisksListByResourceGroupResponse, DisksListNextOptionalParams, DisksListOptionalParams, + DisksListResponse, DisksCreateOrUpdateOptionalParams, DisksCreateOrUpdateResponse, DiskUpdate, @@ -28,8 +31,6 @@ import { DisksGetOptionalParams, DisksGetResponse, DisksDeleteOptionalParams, - DisksListByResourceGroupResponse, - DisksListResponse, GrantAccessData, DisksGrantAccessOptionalParams, DisksGrantAccessResponse, @@ -68,19 +69,33 @@ export class DisksImpl implements Disks { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: DisksListByResourceGroupOptionalParams + options?: DisksListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DisksListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -88,7 +103,9 @@ export class DisksImpl implements Disks { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -119,22 +136,34 @@ export class DisksImpl implements Disks { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: DisksListOptionalParams + options?: DisksListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DisksListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -210,10 +239,12 @@ export class DisksImpl implements Disks { { resourceGroupName, diskName, disk, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -301,10 +332,12 @@ export class DisksImpl implements Disks { { resourceGroupName, diskName, disk, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -407,10 +440,12 @@ export class DisksImpl implements Disks { { resourceGroupName, diskName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -517,11 +552,13 @@ export class DisksImpl implements Disks { { resourceGroupName, diskName, grantAccessData, options }, grantAccessOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -605,11 +642,13 @@ export class DisksImpl implements Disks { { resourceGroupName, diskName, options }, revokeAccessOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -844,7 +883,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DiskList } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -862,7 +900,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.DiskList } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/images.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/images.ts index 5746cb96565..37f16d85169 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/images.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/images.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Images } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,8 +19,10 @@ import { Image, ImagesListByResourceGroupNextOptionalParams, ImagesListByResourceGroupOptionalParams, + ImagesListByResourceGroupResponse, ImagesListNextOptionalParams, ImagesListOptionalParams, + ImagesListResponse, ImagesCreateOrUpdateOptionalParams, ImagesCreateOrUpdateResponse, ImageUpdate, @@ -28,8 +31,6 @@ import { ImagesDeleteOptionalParams, ImagesGetOptionalParams, ImagesGetResponse, - ImagesListByResourceGroupResponse, - ImagesListResponse, ImagesListByResourceGroupNextResponse, ImagesListNextResponse } from "../models"; @@ -64,19 +65,33 @@ export class ImagesImpl implements Images { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: ImagesListByResourceGroupOptionalParams + options?: ImagesListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ImagesListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -84,7 +99,9 @@ export class ImagesImpl implements Images { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -116,22 +133,34 @@ export class ImagesImpl implements Images { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: ImagesListOptionalParams + options?: ImagesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ImagesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -205,10 +234,12 @@ export class ImagesImpl implements Images { { resourceGroupName, imageName, parameters, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -292,10 +323,12 @@ export class ImagesImpl implements Images { { resourceGroupName, imageName, parameters, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -375,10 +408,12 @@ export class ImagesImpl implements Images { { resourceGroupName, imageName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -610,7 +645,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ImageListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -628,7 +662,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ImageListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/logAnalytics.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/logAnalytics.ts index 15965ab440a..00d4d08291d 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/logAnalytics.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/logAnalytics.ts @@ -95,11 +95,13 @@ export class LogAnalyticsImpl implements LogAnalytics { { location, parameters, options }, exportRequestRateByIntervalOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** @@ -182,11 +184,13 @@ export class LogAnalyticsImpl implements LogAnalytics { { location, parameters, options }, exportThrottledRequestsOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/operations.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/operations.ts index edc6acebf89..a99c75201e3 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/operations.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/operations.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { Operations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -46,16 +46,21 @@ export class OperationsImpl implements Operations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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 + options?: OperationsListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); + let result: OperationsListResponse; + result = await this._list(options); yield result.value || []; } diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/proximityPlacementGroups.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/proximityPlacementGroups.ts index 218763816ef..4334e74c8a6 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/proximityPlacementGroups.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/proximityPlacementGroups.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { ProximityPlacementGroups } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,8 +17,10 @@ import { ProximityPlacementGroup, ProximityPlacementGroupsListBySubscriptionNextOptionalParams, ProximityPlacementGroupsListBySubscriptionOptionalParams, + ProximityPlacementGroupsListBySubscriptionResponse, ProximityPlacementGroupsListByResourceGroupNextOptionalParams, ProximityPlacementGroupsListByResourceGroupOptionalParams, + ProximityPlacementGroupsListByResourceGroupResponse, ProximityPlacementGroupsCreateOrUpdateOptionalParams, ProximityPlacementGroupsCreateOrUpdateResponse, ProximityPlacementGroupUpdate, @@ -26,8 +29,6 @@ import { ProximityPlacementGroupsDeleteOptionalParams, ProximityPlacementGroupsGetOptionalParams, ProximityPlacementGroupsGetResponse, - ProximityPlacementGroupsListBySubscriptionResponse, - ProximityPlacementGroupsListByResourceGroupResponse, ProximityPlacementGroupsListBySubscriptionNextResponse, ProximityPlacementGroupsListByResourceGroupNextResponse } from "../models"; @@ -60,22 +61,34 @@ export class ProximityPlacementGroupsImpl implements ProximityPlacementGroups { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: ProximityPlacementGroupsListBySubscriptionOptionalParams + options?: ProximityPlacementGroupsListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ProximityPlacementGroupsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -104,19 +117,33 @@ export class ProximityPlacementGroupsImpl implements ProximityPlacementGroups { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: ProximityPlacementGroupsListByResourceGroupOptionalParams + options?: ProximityPlacementGroupsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ProximityPlacementGroupsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -124,7 +151,9 @@ export class ProximityPlacementGroupsImpl implements ProximityPlacementGroups { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -393,7 +422,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ProximityPlacementGroupListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -410,7 +438,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ProximityPlacementGroupListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/snapshots.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/snapshots.ts index 57d18a4b5cc..e21fd89d66e 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/snapshots.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/snapshots.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Snapshots } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,8 +19,10 @@ import { Snapshot, SnapshotsListByResourceGroupNextOptionalParams, SnapshotsListByResourceGroupOptionalParams, + SnapshotsListByResourceGroupResponse, SnapshotsListNextOptionalParams, SnapshotsListOptionalParams, + SnapshotsListResponse, SnapshotsCreateOrUpdateOptionalParams, SnapshotsCreateOrUpdateResponse, SnapshotUpdate, @@ -28,8 +31,6 @@ import { SnapshotsGetOptionalParams, SnapshotsGetResponse, SnapshotsDeleteOptionalParams, - SnapshotsListByResourceGroupResponse, - SnapshotsListResponse, GrantAccessData, SnapshotsGrantAccessOptionalParams, SnapshotsGrantAccessResponse, @@ -68,19 +69,33 @@ export class SnapshotsImpl implements Snapshots { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: SnapshotsListByResourceGroupOptionalParams + options?: SnapshotsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SnapshotsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -88,7 +103,9 @@ export class SnapshotsImpl implements Snapshots { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -119,22 +136,34 @@ export class SnapshotsImpl implements Snapshots { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + 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?: SnapshotsListOptionalParams + options?: SnapshotsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SnapshotsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -210,10 +239,12 @@ export class SnapshotsImpl implements Snapshots { { resourceGroupName, snapshotName, snapshot, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -304,10 +335,12 @@ export class SnapshotsImpl implements Snapshots { { resourceGroupName, snapshotName, snapshot, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -410,10 +443,12 @@ export class SnapshotsImpl implements Snapshots { { resourceGroupName, snapshotName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -526,11 +561,13 @@ export class SnapshotsImpl implements Snapshots { { resourceGroupName, snapshotName, grantAccessData, options }, grantAccessOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -614,11 +651,13 @@ export class SnapshotsImpl implements Snapshots { { resourceGroupName, snapshotName, options }, revokeAccessOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -853,7 +892,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.SnapshotList } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -871,7 +909,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.SnapshotList } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/sshPublicKeys.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/sshPublicKeys.ts index afb9a677032..9260b7418c8 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/sshPublicKeys.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/sshPublicKeys.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SshPublicKeys } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { SshPublicKeyResource, SshPublicKeysListBySubscriptionNextOptionalParams, SshPublicKeysListBySubscriptionOptionalParams, + SshPublicKeysListBySubscriptionResponse, SshPublicKeysListByResourceGroupNextOptionalParams, SshPublicKeysListByResourceGroupOptionalParams, - SshPublicKeysListBySubscriptionResponse, SshPublicKeysListByResourceGroupResponse, SshPublicKeysCreateOptionalParams, SshPublicKeysCreateResponse, @@ -63,22 +64,34 @@ export class SshPublicKeysImpl implements SshPublicKeys { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: SshPublicKeysListBySubscriptionOptionalParams + options?: SshPublicKeysListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SshPublicKeysListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -108,19 +121,33 @@ export class SshPublicKeysImpl implements SshPublicKeys { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: SshPublicKeysListByResourceGroupOptionalParams + options?: SshPublicKeysListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SshPublicKeysListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -128,7 +155,9 @@ export class SshPublicKeysImpl implements SshPublicKeys { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -437,7 +466,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.SshPublicKeysGroupListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -454,7 +482,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.SshPublicKeysGroupListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/usageOperations.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/usageOperations.ts index 97d6999311c..6af2fc8080d 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/usageOperations.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/usageOperations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { UsageOperations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -51,23 +52,35 @@ export class UsageOperationsImpl implements UsageOperations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(location, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(location, options, settings); } }; } private async *listPagingPage( location: string, - options?: UsageListOptionalParams + options?: UsageListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(location, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: UsageListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(location, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(location, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -142,7 +155,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ListUsagesResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineExtensionImages.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineExtensionImages.ts index 6275bba4656..2aaba195fb9 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineExtensionImages.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineExtensionImages.ts @@ -37,19 +37,19 @@ export class VirtualMachineExtensionImagesImpl * Gets a virtual machine extension image. * @param location The name of a supported Azure region. * @param publisherName - * @param version * @param typeParam + * @param version * @param options The options parameters. */ get( location: string, publisherName: string, - version: string, typeParam: string, + version: string, options?: VirtualMachineExtensionImagesGetOptionalParams ): Promise { return this.client.sendOperationRequest( - { location, publisherName, version, typeParam, options }, + { location, publisherName, typeParam, version, options }, getOperationSpec ); } diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineExtensions.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineExtensions.ts index 7eb654e77f5..b753b86ae05 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineExtensions.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineExtensions.ts @@ -109,10 +109,12 @@ export class VirtualMachineExtensionsImpl implements VirtualMachineExtensions { }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -210,10 +212,12 @@ export class VirtualMachineExtensionsImpl implements VirtualMachineExtensions { }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -298,10 +302,12 @@ export class VirtualMachineExtensionsImpl implements VirtualMachineExtensions { { resourceGroupName, vmName, vmExtensionName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetExtensions.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetExtensions.ts index fd8380c79ad..b1595be134f 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetExtensions.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetExtensions.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { VirtualMachineScaleSetExtensions } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,6 +19,7 @@ import { VirtualMachineScaleSetExtension, VirtualMachineScaleSetExtensionsListNextOptionalParams, VirtualMachineScaleSetExtensionsListOptionalParams, + VirtualMachineScaleSetExtensionsListResponse, VirtualMachineScaleSetExtensionsCreateOrUpdateOptionalParams, VirtualMachineScaleSetExtensionsCreateOrUpdateResponse, VirtualMachineScaleSetExtensionUpdate, @@ -26,7 +28,6 @@ import { VirtualMachineScaleSetExtensionsDeleteOptionalParams, VirtualMachineScaleSetExtensionsGetOptionalParams, VirtualMachineScaleSetExtensionsGetResponse, - VirtualMachineScaleSetExtensionsListResponse, VirtualMachineScaleSetExtensionsListNextResponse } from "../models"; @@ -63,8 +64,16 @@ export class VirtualMachineScaleSetExtensionsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, vmScaleSetName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + vmScaleSetName, + options, + settings + ); } }; } @@ -72,11 +81,18 @@ export class VirtualMachineScaleSetExtensionsImpl private async *listPagingPage( resourceGroupName: string, vmScaleSetName: string, - options?: VirtualMachineScaleSetExtensionsListOptionalParams + options?: VirtualMachineScaleSetExtensionsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, vmScaleSetName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachineScaleSetExtensionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, vmScaleSetName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -85,7 +101,9 @@ export class VirtualMachineScaleSetExtensionsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -175,10 +193,12 @@ export class VirtualMachineScaleSetExtensionsImpl }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -276,10 +296,12 @@ export class VirtualMachineScaleSetExtensionsImpl }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -364,10 +386,12 @@ export class VirtualMachineScaleSetExtensionsImpl { resourceGroupName, vmScaleSetName, vmssExtensionName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -574,7 +598,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineScaleSetExtensionListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetRollingUpgrades.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetRollingUpgrades.ts index 408e0d38c72..0b2aa062019 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetRollingUpgrades.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetRollingUpgrades.ts @@ -89,10 +89,12 @@ export class VirtualMachineScaleSetRollingUpgradesImpl { resourceGroupName, vmScaleSetName, options }, cancelOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -171,10 +173,12 @@ export class VirtualMachineScaleSetRollingUpgradesImpl { resourceGroupName, vmScaleSetName, options }, startOSUpgradeOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -255,10 +259,12 @@ export class VirtualMachineScaleSetRollingUpgradesImpl { resourceGroupName, vmScaleSetName, options }, startExtensionUpgradeOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetVMExtensions.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetVMExtensions.ts index ce01f440a37..6b65a2a5b93 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetVMExtensions.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetVMExtensions.ts @@ -115,10 +115,12 @@ export class VirtualMachineScaleSetVMExtensionsImpl }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -222,10 +224,12 @@ export class VirtualMachineScaleSetVMExtensionsImpl }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -321,10 +325,12 @@ export class VirtualMachineScaleSetVMExtensionsImpl }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetVMs.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetVMs.ts index 09a25a682bd..9fc15bfff32 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetVMs.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSetVMs.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { VirtualMachineScaleSetVMs } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,6 +19,7 @@ import { VirtualMachineScaleSetVM, VirtualMachineScaleSetVMsListNextOptionalParams, VirtualMachineScaleSetVMsListOptionalParams, + VirtualMachineScaleSetVMsListResponse, VirtualMachineScaleSetVMsReimageOptionalParams, VirtualMachineScaleSetVMsReimageAllOptionalParams, VirtualMachineScaleSetVMsDeallocateOptionalParams, @@ -28,7 +30,6 @@ import { VirtualMachineScaleSetVMsGetResponse, VirtualMachineScaleSetVMsGetInstanceViewOptionalParams, VirtualMachineScaleSetVMsGetInstanceViewResponse, - VirtualMachineScaleSetVMsListResponse, VirtualMachineScaleSetVMsPowerOffOptionalParams, VirtualMachineScaleSetVMsRestartOptionalParams, VirtualMachineScaleSetVMsStartOptionalParams, @@ -77,11 +78,15 @@ export class VirtualMachineScaleSetVMsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, virtualMachineScaleSetName, - options + options, + settings ); } }; @@ -90,15 +95,22 @@ export class VirtualMachineScaleSetVMsImpl private async *listPagingPage( resourceGroupName: string, virtualMachineScaleSetName: string, - options?: VirtualMachineScaleSetVMsListOptionalParams + options?: VirtualMachineScaleSetVMsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - resourceGroupName, - virtualMachineScaleSetName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachineScaleSetVMsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + virtualMachineScaleSetName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -107,7 +119,9 @@ export class VirtualMachineScaleSetVMsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -182,10 +196,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, reimageOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -268,10 +284,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, reimageAllOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -356,10 +374,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, deallocateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -450,10 +470,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, parameters, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -538,10 +560,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -680,10 +704,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, powerOffOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -767,10 +793,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, restartOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -852,10 +880,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, startOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -938,10 +968,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, redeployOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1043,10 +1075,12 @@ export class VirtualMachineScaleSetVMsImpl { resourceGroupName, vmScaleSetName, instanceId, options }, performMaintenanceOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1394,12 +1428,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineScaleSetVMListResult } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.expand, - Parameters.filter, - Parameters.select - ], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSets.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSets.ts index 5728ced1247..9b66ecc810e 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSets.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineScaleSets.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { VirtualMachineScaleSets } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,14 +19,18 @@ import { VirtualMachineScaleSet, VirtualMachineScaleSetsListNextOptionalParams, VirtualMachineScaleSetsListOptionalParams, + VirtualMachineScaleSetsListResponse, VirtualMachineScaleSetsListAllNextOptionalParams, VirtualMachineScaleSetsListAllOptionalParams, + VirtualMachineScaleSetsListAllResponse, VirtualMachineScaleSetSku, VirtualMachineScaleSetsListSkusNextOptionalParams, VirtualMachineScaleSetsListSkusOptionalParams, + VirtualMachineScaleSetsListSkusResponse, UpgradeOperationHistoricalStatusInfo, VirtualMachineScaleSetsGetOSUpgradeHistoryNextOptionalParams, VirtualMachineScaleSetsGetOSUpgradeHistoryOptionalParams, + VirtualMachineScaleSetsGetOSUpgradeHistoryResponse, VirtualMachineScaleSetsCreateOrUpdateOptionalParams, VirtualMachineScaleSetsCreateOrUpdateResponse, VirtualMachineScaleSetUpdate, @@ -39,10 +44,6 @@ import { VirtualMachineScaleSetsDeleteInstancesOptionalParams, VirtualMachineScaleSetsGetInstanceViewOptionalParams, VirtualMachineScaleSetsGetInstanceViewResponse, - VirtualMachineScaleSetsListResponse, - VirtualMachineScaleSetsListAllResponse, - VirtualMachineScaleSetsListSkusResponse, - VirtualMachineScaleSetsGetOSUpgradeHistoryResponse, VirtualMachineScaleSetsPowerOffOptionalParams, VirtualMachineScaleSetsRestartOptionalParams, VirtualMachineScaleSetsStartOptionalParams, @@ -93,19 +94,29 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, options); + 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?: VirtualMachineScaleSetsListOptionalParams + options?: VirtualMachineScaleSetsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachineScaleSetsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -113,7 +124,9 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -143,22 +156,34 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listAllPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listAllPagingPage(options, settings); } }; } private async *listAllPagingPage( - options?: VirtualMachineScaleSetsListAllOptionalParams + options?: VirtualMachineScaleSetsListAllOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listAll(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachineScaleSetsListAllResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listAll(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listAllNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -194,11 +219,15 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSkusPagingPage( resourceGroupName, vmScaleSetName, - options + options, + settings ); } }; @@ -207,15 +236,18 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { private async *listSkusPagingPage( resourceGroupName: string, vmScaleSetName: string, - options?: VirtualMachineScaleSetsListSkusOptionalParams + options?: VirtualMachineScaleSetsListSkusOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSkus( - resourceGroupName, - vmScaleSetName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachineScaleSetsListSkusResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSkus(resourceGroupName, vmScaleSetName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSkusNext( resourceGroupName, @@ -224,7 +256,9 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -265,11 +299,15 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.getOSUpgradeHistoryPagingPage( resourceGroupName, vmScaleSetName, - options + options, + settings ); } }; @@ -278,15 +316,22 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { private async *getOSUpgradeHistoryPagingPage( resourceGroupName: string, vmScaleSetName: string, - options?: VirtualMachineScaleSetsGetOSUpgradeHistoryOptionalParams + options?: VirtualMachineScaleSetsGetOSUpgradeHistoryOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._getOSUpgradeHistory( - resourceGroupName, - vmScaleSetName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachineScaleSetsGetOSUpgradeHistoryResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getOSUpgradeHistory( + resourceGroupName, + vmScaleSetName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._getOSUpgradeHistoryNext( resourceGroupName, @@ -295,7 +340,9 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -375,10 +422,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, parameters, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -465,10 +514,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, parameters, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -548,10 +599,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -647,10 +700,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, deallocateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -731,10 +786,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, vmInstanceIDs, options }, deleteInstancesOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -895,10 +952,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, powerOffOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -977,10 +1036,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, restartOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1057,10 +1118,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, startOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1138,10 +1201,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, redeployOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1222,10 +1287,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, performMaintenanceOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1307,10 +1374,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, vmInstanceIDs, options }, updateInstancesOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1392,10 +1461,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, reimageOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1475,10 +1546,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, options }, reimageAllOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1599,10 +1672,12 @@ export class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { { resourceGroupName, vmScaleSetName, parameters, options }, setOrchestrationServiceStateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -2113,7 +2188,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineScaleSetListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -2131,7 +2205,6 @@ const listAllNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineScaleSetListWithLinkResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2148,7 +2221,6 @@ const listSkusNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineScaleSetListSkusResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -2167,7 +2239,6 @@ const getOSUpgradeHistoryNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineScaleSetListOSUpgradeHistory } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineSizes.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineSizes.ts index 41c45d893dd..962c1195ed0 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineSizes.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachineSizes.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { VirtualMachineSizes } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -49,17 +49,22 @@ export class VirtualMachineSizesImpl implements VirtualMachineSizes { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(location, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(location, options, settings); } }; } private async *listPagingPage( location: string, - options?: VirtualMachineSizesListOptionalParams + options?: VirtualMachineSizesListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(location, options); + let result: VirtualMachineSizesListResponse; + result = await this._list(location, options); yield result.value || []; } diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachines.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachines.ts index 49d0021751d..4b5bab0a1ae 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachines.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operations/virtualMachines.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { VirtualMachines } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,13 +19,16 @@ import { VirtualMachine, VirtualMachinesListByLocationNextOptionalParams, VirtualMachinesListByLocationOptionalParams, + VirtualMachinesListByLocationResponse, VirtualMachinesListNextOptionalParams, VirtualMachinesListOptionalParams, + VirtualMachinesListResponse, VirtualMachinesListAllNextOptionalParams, VirtualMachinesListAllOptionalParams, + VirtualMachinesListAllResponse, VirtualMachineSize, VirtualMachinesListAvailableSizesOptionalParams, - VirtualMachinesListByLocationResponse, + VirtualMachinesListAvailableSizesResponse, VirtualMachineCaptureParameters, VirtualMachinesCaptureOptionalParams, VirtualMachinesCaptureResponse, @@ -41,9 +45,6 @@ import { VirtualMachinesConvertToManagedDisksOptionalParams, VirtualMachinesDeallocateOptionalParams, VirtualMachinesGeneralizeOptionalParams, - VirtualMachinesListResponse, - VirtualMachinesListAllResponse, - VirtualMachinesListAvailableSizesResponse, VirtualMachinesPowerOffOptionalParams, VirtualMachinesReapplyOptionalParams, VirtualMachinesRestartOptionalParams, @@ -91,19 +92,29 @@ export class VirtualMachinesImpl implements VirtualMachines { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByLocationPagingPage(location, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByLocationPagingPage(location, options, settings); } }; } private async *listByLocationPagingPage( location: string, - options?: VirtualMachinesListByLocationOptionalParams + options?: VirtualMachinesListByLocationOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByLocation(location, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachinesListByLocationResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByLocation(location, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByLocationNext( location, @@ -111,7 +122,9 @@ export class VirtualMachinesImpl implements VirtualMachines { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -142,19 +155,29 @@ export class VirtualMachinesImpl implements VirtualMachines { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, options); + 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?: VirtualMachinesListOptionalParams + options?: VirtualMachinesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachinesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -162,7 +185,9 @@ export class VirtualMachinesImpl implements VirtualMachines { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -191,22 +216,34 @@ export class VirtualMachinesImpl implements VirtualMachines { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listAllPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listAllPagingPage(options, settings); } }; } private async *listAllPagingPage( - options?: VirtualMachinesListAllOptionalParams + options?: VirtualMachinesListAllOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listAll(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VirtualMachinesListAllResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listAll(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listAllNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -241,11 +278,15 @@ export class VirtualMachinesImpl implements VirtualMachines { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listAvailableSizesPagingPage( resourceGroupName, vmName, - options + options, + settings ); } }; @@ -254,13 +295,11 @@ export class VirtualMachinesImpl implements VirtualMachines { private async *listAvailableSizesPagingPage( resourceGroupName: string, vmName: string, - options?: VirtualMachinesListAvailableSizesOptionalParams + options?: VirtualMachinesListAvailableSizesOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listAvailableSizes( - resourceGroupName, - vmName, - options - ); + let result: VirtualMachinesListAvailableSizesResponse; + result = await this._listAvailableSizes(resourceGroupName, vmName, options); yield result.value || []; } @@ -356,11 +395,13 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, parameters, options }, captureOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -449,10 +490,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, parameters, options }, createOrUpdateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -540,10 +583,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, parameters, options }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -623,10 +668,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -734,10 +781,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, convertToManagedDisksOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -816,10 +865,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, deallocateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -964,10 +1015,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, powerOffOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1041,10 +1094,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, reapplyOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1117,10 +1172,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, restartOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1193,10 +1250,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, startOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1269,10 +1328,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, redeployOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1345,10 +1406,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, reimageOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1438,10 +1501,12 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, performMaintenanceOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); + await poller.poll(); + return poller; } /** @@ -1540,11 +1605,13 @@ export class VirtualMachinesImpl implements VirtualMachines { { resourceGroupName, vmName, options }, assessPatchesOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "location" }); + await poller.poll(); + return poller; } /** @@ -2059,7 +2126,6 @@ const listByLocationNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -2077,7 +2143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -2095,7 +2160,6 @@ const listAllNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.VirtualMachineListResult } }, - queryParameters: [Parameters.apiVersion, Parameters.statusOnly], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operationsInterfaces/virtualMachineExtensionImages.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operationsInterfaces/virtualMachineExtensionImages.ts index 9ffcfbb96ad..34eeb14c3ee 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operationsInterfaces/virtualMachineExtensionImages.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/operationsInterfaces/virtualMachineExtensionImages.ts @@ -21,15 +21,15 @@ export interface VirtualMachineExtensionImages { * Gets a virtual machine extension image. * @param location The name of a supported Azure region. * @param publisherName - * @param version * @param typeParam + * @param version * @param options The options parameters. */ get( location: string, publisherName: string, - version: string, typeParam: string, + version: string, options?: VirtualMachineExtensionImagesGetOptionalParams ): Promise; /** diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/pagingHelper.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/src/pagingHelper.ts new file mode 100644 index 00000000000..269a2b9814b --- /dev/null +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/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/compute/arm-compute-profile-2020-09-01-hybrid/test/sampleTest.ts b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/test/sampleTest.ts index 7ed89b043e1..25aeb3ebcc3 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/test/sampleTest.ts +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables }; describe("My test", () => { let recorder: Recorder; - beforeEach(async function() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/tsconfig.json b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/tsconfig.json index 3e6ae96443f..fc8b5fed209 100644 --- a/sdk/compute/arm-compute-profile-2020-09-01-hybrid/tsconfig.json +++ b/sdk/compute/arm-compute-profile-2020-09-01-hybrid/tsconfig.json @@ -15,11 +15,17 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-compute-profile-2020-09-01-hybrid": [ + "./src/index" + ] + } }, "include": [ "./src/**/*.ts", - "./test/**/*.ts" + "./test/**/*.ts", + "samples-dev/**/*.ts" ], "exclude": [ "node_modules"